Пример #1
0
        public void createParticleSystem()
        {
            CCParticleSystem particleSystem = null;

            /*
             * Tests:
             * 1: Point Particle System using 32-bit textures (PNG)
             * 2: Point Particle System using 16-bit textures (PNG)
             * 3: Point Particle System using 8-bit textures (PNG)
             * 4: Point Particle System using 4-bit textures (PVRTC)
             *
             * 5: Quad Particle System using 32-bit textures (PNG)
             * 6: Quad Particle System using 16-bit textures (PNG)
             * 7: Quad Particle System using 8-bit textures (PNG)
             * 8: Quad Particle System using 4-bit textures (PVRTC)
             */
            RemoveChildByTag(PerformanceParticleTest.kTagParticleSystem, true);

            // remove the "fire.png" from the TextureCache cache.
            CCTexture2D texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire");

            CCTextureCache.SharedTextureCache.RemoveTexture(texture);

            particleSystem = new CCParticleSystemQuad();

            switch (subtestNumber)
            {
            case 1:
                CCTexture2D.DefaultAlphaPixelFormat = CCTexture2DPixelFormat.kCCTexture2DPixelFormat_RGBA8888;
                particleSystem.InitWithTotalParticles(quantityParticles);
                particleSystem.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire");
                break;

            case 2:
                CCTexture2D.DefaultAlphaPixelFormat = CCTexture2DPixelFormat.kCCTexture2DPixelFormat_RGBA4444;
                particleSystem.InitWithTotalParticles(quantityParticles);
                particleSystem.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire");
                break;

            case 3:
                CCTexture2D.DefaultAlphaPixelFormat = CCTexture2DPixelFormat.kCCTexture2DPixelFormat_A8;
                particleSystem.InitWithTotalParticles(quantityParticles);
                particleSystem.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire");
                break;

            //     case 4:
            //         particleSystem->initWithTotalParticles(quantityParticles);
            //         ////---- particleSystem.texture = [[CCTextureCache sharedTextureCache] addImage:@"fire.pvr"];
            //         particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("Images/fire.png"));
            //         break;
            case 4:
                CCTexture2D.DefaultAlphaPixelFormat = CCTexture2DPixelFormat.kCCTexture2DPixelFormat_RGBA8888;
                particleSystem.InitWithTotalParticles(quantityParticles);
                particleSystem.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire");
                break;

            case 5:
                CCTexture2D.DefaultAlphaPixelFormat = CCTexture2DPixelFormat.kCCTexture2DPixelFormat_RGBA4444;
                particleSystem.InitWithTotalParticles(quantityParticles);
                particleSystem.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire");
                break;

            case 6:
                CCTexture2D.DefaultAlphaPixelFormat = CCTexture2DPixelFormat.kCCTexture2DPixelFormat_A8;
                particleSystem.InitWithTotalParticles(quantityParticles);
                particleSystem.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire");
                break;

            //     case 8:
            //         particleSystem->initWithTotalParticles(quantityParticles);
            //         ////---- particleSystem.texture = [[CCTextureCache sharedTextureCache] addImage:@"fire.pvr"];
            //         particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("Images/fire.png"));
            //         break;
            default:
                particleSystem = null;
                CCLog.Log("Shall not happen!");
                break;
            }
            AddChild(particleSystem, 0, PerformanceParticleTest.kTagParticleSystem);

            doTest();

            // restore the default pixel format
            CCTexture2D.DefaultAlphaPixelFormat = CCTexture2DPixelFormat.kCCTexture2DPixelFormat_RGBA8888;
        }