Ejemplo n.º 1
0
        public override void onEnter()
        {
            base.onEnter();

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

            // the root object just rotates around
            m_root = CCSprite.spriteWithFile(s_pPathR1);
            addChild(m_root, 1);
            m_root.position = (new CCPoint(s.width / 2, s.height / 2));

            // the target object is offset from root, and the streak is moved to follow it
            m_target = CCSprite.spriteWithFile(s_pPathR1);
            m_root.addChild(m_target);
            m_target.position = (new CCPoint(100, 0));

            // create the streak object and add it to the scene
            //m_streak = CCMotionStreak.streakWithFade(2, 3, s_streak, 32, 32, new ccColor4B(0,255,0,255) );
            addChild(m_streak);
            // schedule an update on each frame so we can syncronize the streak with the target
            schedule(onUpdate);

            CCActionInterval a1 = CCRotateBy.actionWithDuration(2, 360);

            CCAction action1 = CCRepeatForever.actionWithAction(a1);
            CCActionInterval motion = CCMoveBy.actionWithDuration(2, new CCPoint(100, 0));
            m_root.runAction(CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(motion, motion.reverse()))));
            m_root.runAction(action1);
        }
Ejemplo n.º 2
0
        public void initWithSubTest(int nSubTest, CCNode p)
        {
            subtestNumber = nSubTest;
            parent = p;
            batchNode = null;
            /*
            * Tests:
            * 1: 1 (32-bit) PNG sprite of 52 x 139
            * 2: 1 (32-bit) PNG Batch Node using 1 sprite of 52 x 139
            * 3: 1 (16-bit) PNG Batch Node using 1 sprite of 52 x 139
            * 4: 1 (4-bit) PVRTC Batch Node using 1 sprite of 52 x 139

            * 5: 14 (32-bit) PNG sprites of 85 x 121 each
            * 6: 14 (32-bit) PNG Batch Node of 85 x 121 each
            * 7: 14 (16-bit) PNG Batch Node of 85 x 121 each
            * 8: 14 (4-bit) PVRTC Batch Node of 85 x 121 each

            * 9: 64 (32-bit) sprites of 32 x 32 each
            *10: 64 (32-bit) PNG Batch Node of 32 x 32 each
            *11: 64 (16-bit) PNG Batch Node of 32 x 32 each
            *12: 64 (4-bit) PVRTC Batch Node of 32 x 32 each
            */

            // purge textures
            CCTextureCache mgr = CCTextureCache.sharedTextureCache();
            //		[mgr removeAllTextures];
            mgr.removeTexture(mgr.addImage("Images/grossinis_sister1"));
            mgr.removeTexture(mgr.addImage("Images/grossini_dance_atlas"));
            mgr.removeTexture(mgr.addImage("Images/spritesheet1"));

            switch (subtestNumber)
            {
                case 1:
                case 4:
                case 7:
                    break;
                ///
                case 2:
                    CCTexture2D.setDefaultAlphaPixelFormat(CCTexture2DPixelFormat.kCCTexture2DPixelFormat_RGBA8888);
                    batchNode = CCSpriteBatchNode.batchNodeWithFile("Images/grossinis_sister1", 100);
                    p.addChild(batchNode, 0);
                    break;
                case 3:
                    CCTexture2D.setDefaultAlphaPixelFormat(CCTexture2DPixelFormat.kCCTexture2DPixelFormat_RGBA4444);
                    batchNode = CCSpriteBatchNode.batchNodeWithFile("Images/grossinis_sister1", 100);
                    p.addChild(batchNode, 0);
                    break;

                ///
                case 5:
                    CCTexture2D.setDefaultAlphaPixelFormat(CCTexture2DPixelFormat.kCCTexture2DPixelFormat_RGBA8888);
                    batchNode = CCSpriteBatchNode.batchNodeWithFile("Images/grossini_dance_atlas", 100);
                    p.addChild(batchNode, 0);
                    break;
                case 6:
                    CCTexture2D.setDefaultAlphaPixelFormat(CCTexture2DPixelFormat.kCCTexture2DPixelFormat_RGBA4444);
                    batchNode = CCSpriteBatchNode.batchNodeWithFile("Images/grossini_dance_atlas", 100);
                    p.addChild(batchNode, 0);
                    break;

                ///
                case 8:
                    CCTexture2D.setDefaultAlphaPixelFormat(CCTexture2DPixelFormat.kCCTexture2DPixelFormat_RGBA8888);
                    batchNode = CCSpriteBatchNode.batchNodeWithFile("Images/spritesheet1", 100);
                    p.addChild(batchNode, 0);
                    break;
                case 9:
                    CCTexture2D.setDefaultAlphaPixelFormat(CCTexture2DPixelFormat.kCCTexture2DPixelFormat_RGBA4444);
                    batchNode = CCSpriteBatchNode.batchNodeWithFile("Images/spritesheet1", 100);
                    p.addChild(batchNode, 0);
                    break;

                default:
                    break;
            }

            //if (batchNode != null)
            //{
            //    batchNode.retain();
            //}

            CCTexture2D.setDefaultAlphaPixelFormat(CCTexture2DPixelFormat.kCCTexture2DPixelFormat_Default);
        }