コード例 #1
0
        public ConvertToNode()
        {
            this.isTouchEnabled = true;
            CCSize s = CCDirector.sharedDirector().getWinSize();

            CCRotateBy      rotate = CCRotateBy.actionWithDuration(10, 360);
            CCRepeatForever action = CCRepeatForever.actionWithAction(rotate);

            for (int i = 0; i < 3; i++)
            {
                CCSprite sprite = CCSprite.spriteWithFile("Images/grossini");
                sprite.position = (new CCPoint(s.width / 4 * (i + 1), s.height / 2));

                CCSprite point = CCSprite.spriteWithFile("Images/r1");
                point.scale    = 0.25f;
                point.position = sprite.position;
                addChild(point, 10, 100 + i);

                switch (i)
                {
                case 0:
                    sprite.anchorPoint = new CCPoint(0, 0);
                    break;

                case 1:
                    sprite.anchorPoint = (new CCPoint(0.5f, 0.5f));
                    break;

                case 2:
                    sprite.anchorPoint = (new CCPoint(1, 1));
                    break;
                }

                point.position = (sprite.position);

                CCRepeatForever copy = (CCRepeatForever)action.copy();
                sprite.runAction(copy);
                addChild(sprite, i);
            }
        }
コード例 #2
0
        public override void onEnter()
        {
            base.onEnter();
            CCSize s = CCDirector.sharedDirector().getWinSize();

            //
            // Sprite 1: GL_LINEAR
            //
            // Default filter is GL_LINEAR

            CCSprite sprite = CCSprite.spriteWithFile("Images/grossinis_sister1");

            sprite.position = new CCPoint(s.width / 3.0f, s.height / 2.0f);
            addChild(sprite);

            // this is the default filterting
            sprite.Texture.setAntiAliasTexParameters();

            //
            // Sprite 1: GL_NEAREST
            //

            CCSprite sprite2 = CCSprite.spriteWithFile("Images/grossinis_sister2");

            sprite2.position = new CCPoint(2 * s.width / 3.0f, s.height / 2.0f);
            addChild(sprite2);

            // Use Nearest in this one
            sprite2.Texture.setAliasTexParameters();

            // scale them to show
            CCScaleBy       sc           = CCScaleBy.actionWithDuration(3, 8.0f);
            CCScaleBy       sc_back      = (CCScaleBy)(sc.reverse());
            CCRepeatForever scaleforever = CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(sc, sc_back)));
            CCRepeatForever scaleToo     = (CCRepeatForever)(scaleforever.copy());

            sprite2.runAction(scaleforever);
            sprite.runAction(scaleToo);
            CCTextureCache.sharedTextureCache().dumpCachedTextureInfo();
        }