Exemplo n.º 1
0
        public override void draw()
        {
            CCTMXTiledMap    map   = (CCTMXTiledMap)getChildByTag(1);
            CCTMXObjectGroup group = map.objectGroupNamed("Object Group 1");

            List <Dictionary <string, string> > objects = group.Objects;
            Dictionary <string, string>         dict;

            for (int i = 0; i < objects.Count; i++)
            {
                dict = objects[i];//dynamic_cast<CCStringToStringDictionary*>(*it);

                if (dict == null)
                {
                    break;
                }
                string key = "x";
                int    x   = int.Parse(dict[key]); //dynamic_cast<NSNumber*>(dict->objectForKey("x"))->getNumber();
                key = "y";
                int y = int.Parse(dict[key]);      //dynamic_cast<NSNumber*>(dict->objectForKey("y"))->getNumber();
                key = "width";
                int width = int.Parse(dict[key]);  //dynamic_cast<NSNumber*>(dict->objectForKey("width"))->getNumber();
                key = "height";
                int height = int.Parse(dict[key]); //dynamic_cast<NSNumber*>(dict->objectForKey("height"))->getNumber();


                //glLineWidth(3);

                ccColor4F color = new ccColor4F(255, 255, 255, 255);

                CCDrawingPrimitives.ccDrawLine(new CCPoint(x, y), new CCPoint(x + width, y), color);
                CCDrawingPrimitives.ccDrawLine(new CCPoint(x + width, y), new CCPoint(x + width, y + height), color);
                CCDrawingPrimitives.ccDrawLine(new CCPoint(x + width, y + height), new CCPoint(x, y + height), color);
                CCDrawingPrimitives.ccDrawLine(new CCPoint(x, y + height), new CCPoint(x, y), color);

                //glLineWidth(1);
            }
        }
Exemplo n.º 2
0
        public override void doTest()
        {
            CCSize           s = CCDirector.sharedDirector().getWinSize();
            CCParticleSystem particleSystem = (CCParticleSystem)getChildByTag(PerformanceParticleTest.kTagParticleSystem);

            // duration
            particleSystem.Duration = -1;

            // gravity
            particleSystem.setGravity(new CCPoint(0, -90));

            // angle
            particleSystem.Angle    = 90;
            particleSystem.AngleVar = 0;

            // radial
            particleSystem.setRadialAccel(0);
            particleSystem.setRadialAccelVar(0);

            // speed of particles
            particleSystem.setSpeed(180);
            particleSystem.setSpeedVar(50);

            // emitter position
            particleSystem.position = new CCPoint(s.width / 2, 100);
            particleSystem.PosVar   = new CCPoint(s.width / 2, 0);

            // life of particles
            particleSystem.Life    = 2.0f;
            particleSystem.LifeVar = 1;

            // emits per frame
            particleSystem.EmissionRate = particleSystem.TotalParticles / particleSystem.Life;

            // color of particles
            ccColor4F startColor = new ccColor4F {
                r = 0.5f, g = 0.5f, b = 0.5f, a = 1.0f
            };

            particleSystem.StartColor = startColor;

            ccColor4F startColorVar = new ccColor4F {
                r = 0.5f, g = 0.5f, b = 0.5f, a = 1.0f
            };

            particleSystem.StartColor = startColorVar;

            ccColor4F endColor = new ccColor4F {
                r = 0.1f, g = 0.1f, b = 0.1f, a = 0.2f
            };

            particleSystem.EndColor = endColor;

            ccColor4F endColorVar = new ccColor4F {
                r = 0.1f, g = 0.1f, b = 0.1f, a = 0.2f
            };

            particleSystem.EndColorVar = endColorVar;

            // size, in pixels
            particleSystem.EndSize      = 8.0f;
            particleSystem.StartSize    = 8.0f;
            particleSystem.EndSizeVar   = 0;
            particleSystem.StartSizeVar = 0;

            // additive
            particleSystem.IsBlendAdditive = false;
        }
Exemplo n.º 3
0
        public override void onEnter()
        {
            base.onEnter();

            m_emitter = new CCParticleSystemQuad();
            m_emitter.initWithTotalParticles(300);
            //m_emitter.autorelease();

            m_background.addChild(m_emitter, 10);
            ////m_emitter.release();	// win32 : Remove this line
            m_emitter.Texture = CCTextureCache.sharedTextureCache().addImage(TestResource.s_stars2);

            // duration
            m_emitter.Duration = -1;

            // gravity
            m_emitter.setGravity(new CCPoint(0, 0));

            // angle
            m_emitter.Angle    = 90;
            m_emitter.AngleVar = 360;

            // speed of particles
            m_emitter.setSpeed(160);
            m_emitter.setSpeedVar(20);

            // radial
            m_emitter.setRadialAccel(-120);
            m_emitter.setRadialAccelVar(0);

            // tagential
            m_emitter.setTangentialAccel(30);
            m_emitter.setTangentialAccelVar(0);

            // emitter position
            m_emitter.position = new CCPoint(160, 240);
            m_emitter.PosVar   = new CCPoint(0, 0);

            // life of particles
            m_emitter.Life    = 3;
            m_emitter.LifeVar = 1;

            // spin of particles
            m_emitter.StartSpin    = 0;
            m_emitter.StartSpinVar = 0;
            m_emitter.EndSpin      = 0;
            m_emitter.EndSpinVar   = 2000;

            // color of particles
            ccColor4F startColor = new ccColor4F(0.5f, 0.5f, 0.5f, 1.0f);

            m_emitter.StartColor = startColor;

            ccColor4F startColorVar = new ccColor4F(0.5f, 0.5f, 0.5f, 1.0f);

            m_emitter.StartColorVar = startColorVar;

            ccColor4F endColor = new ccColor4F(0.1f, 0.1f, 0.1f, 0.2f);

            m_emitter.EndColor = endColor;

            ccColor4F endColorVar = new ccColor4F(0.1f, 0.1f, 0.1f, 0.2f);

            m_emitter.EndColorVar = endColorVar;

            // size, in pixels
            m_emitter.StartSize    = 30.0f;
            m_emitter.StartSizeVar = 00.0f;
            m_emitter.EndSize      = (float)eParticleShowingProperty.kParticleStartSizeEqualToEndSize;

            // emits per second
            m_emitter.EmissionRate = m_emitter.TotalParticles / m_emitter.Life;

            // additive
            m_emitter.IsBlendAdditive = false;

            setEmitterPosition();
        }
Exemplo n.º 4
0
        public override void onEnter()
        {
            base.onEnter();

            m_emitter = new CCParticleSystemPoint();
            m_emitter.initWithTotalParticles(1000);
            //m_emitter.autorelease();

            m_background.addChild(m_emitter, 10);
            ////m_emitter.release();

            CCSize s = CCDirector.sharedDirector().getWinSize();

            // duration
            m_emitter.Duration = -1;

            // gravity
            m_emitter.setGravity(new CCPoint(0, 0));

            // angle
            m_emitter.Angle    = 0;
            m_emitter.AngleVar = 360;

            // radial
            m_emitter.setRadialAccel(70);
            m_emitter.setRadialAccelVar(10);

            // tagential
            m_emitter.setTangentialAccel(80);
            m_emitter.setTangentialAccelVar(0);

            // speed of particles
            m_emitter.setSpeed(50);
            m_emitter.setSpeedVar(10);

            // emitter position
            m_emitter.position = new CCPoint(s.width / 2, s.height / 2);
            m_emitter.PosVar   = new CCPoint(0, 0);

            // life of particles
            m_emitter.Life    = 2.0f;
            m_emitter.LifeVar = 0.3f;

            // emits per frame
            m_emitter.EmissionRate = m_emitter.TotalParticles / m_emitter.Life;

            // color of particles
            ccColor4F startColor = new ccColor4F(0.5f, 0.5f, 0.5f, 1.0f);

            m_emitter.StartColor = startColor;

            ccColor4F startColorVar = new ccColor4F(0.5f, 0.5f, 0.5f, 1.0f);

            m_emitter.StartColorVar = startColorVar;

            ccColor4F endColor = new ccColor4F(0.1f, 0.1f, 0.1f, 0.2f);

            m_emitter.EndColor = endColor;

            ccColor4F endColorVar = new ccColor4F(0.1f, 0.1f, 0.1f, 0.2f);

            m_emitter.EndColorVar = endColorVar;

            // size, in pixels
            m_emitter.StartSize    = 1.0f;
            m_emitter.StartSizeVar = 1.0f;
            m_emitter.EndSize      = 32.0f;
            m_emitter.EndSizeVar   = 8.0f;

            // texture
            m_emitter.Texture = CCTextureCache.sharedTextureCache().addImage(TestResource.s_fire);

            // additive
            m_emitter.IsBlendAdditive = false;

            setEmitterPosition();
        }
Exemplo n.º 5
0
        public override void onEnter()
        {
            base.onEnter();

            Color = new ccColor3B(0, 0, 0);
            removeChild(m_background, true);
            m_background = null;

            m_emitter = new CCParticleSystemQuad();
            m_emitter.initWithTotalParticles(100);
            addChild(m_emitter, 10);
            m_emitter.Texture = CCTextureCache.sharedTextureCache().addImage("Images/fire");

            // duration
            m_emitter.Duration = (float)eParticleShowingProperty.kCCParticleDurationInfinity;

            // radius mode
            m_emitter.EmitterMode = (int)eParticleMode.kCCParticleModeRadius;

            // radius mode: start and end radius in pixels
            m_emitter.setStartRadius(50);
            m_emitter.setStartRadiusVar(0);
            m_emitter.setEndRadius((float)eParticleShowingProperty.kCCParticleStartRadiusEqualToEndRadius);
            m_emitter.setEndRadiusVar(0);

            // radius mode: degrees per second
            m_emitter.setRotatePerSecond(0);
            m_emitter.setRotatePerSecondVar(0);


            // angle
            m_emitter.Angle    = 90;
            m_emitter.AngleVar = 0;

            // emitter position
            CCSize size = CCDirector.sharedDirector().getWinSize();

            m_emitter.position = new CCPoint(size.width / 2, size.height / 2);
            m_emitter.PosVar   = new CCPoint(0, 0);

            // life of particles
            m_emitter.Life    = 5;
            m_emitter.LifeVar = 0;

            // spin of particles
            m_emitter.StartSpin    = 0;
            m_emitter.StartSpinVar = 0;
            m_emitter.EndSpin      = 0;
            m_emitter.EndSpinVar   = 0;

            // color of particles
            ccColor4F startColor = new ccColor4F(0.5f, 0.5f, 0.5f, 1.0f);

            m_emitter.StartColor = startColor;

            ccColor4F startColorVar = new ccColor4F(0.5f, 0.5f, 0.5f, 1.0f);

            m_emitter.StartColorVar = startColorVar;

            ccColor4F endColor = new ccColor4F(0.1f, 0.1f, 0.1f, 0.2f);

            m_emitter.EndColor = endColor;

            ccColor4F endColorVar = new ccColor4F(0.1f, 0.1f, 0.1f, 0.2f);

            m_emitter.EndColorVar = endColorVar;

            // size, in pixels
            m_emitter.StartSize    = 16;
            m_emitter.StartSizeVar = 0;
            m_emitter.EndSize      = (float)eParticleShowingProperty.kCCParticleStartSizeEqualToEndSize;

            // emits per second
            m_emitter.EmissionRate = m_emitter.TotalParticles / m_emitter.Life;

            // additive
            m_emitter.IsBlendAdditive = false;

            CCRotateBy rot = CCRotateBy.actionWithDuration(16, 360);

            m_emitter.runAction(CCRepeatForever.actionWithAction(rot));
        }