Esempio n. 1
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = CCDirector.SharedDirector.WinSize;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            CCLog.Log("S9FrameNameSpriteSheetRotatedInsetsScaled ...");

            var blocks_scaled_with_insets = new CCScale9Sprite();

            blocks_scaled_with_insets.InitWithSpriteFrameName("blocks9.png", new CCRect(32, 32, 32, 32));
            CCLog.Log("... created");

            blocks_scaled_with_insets.ContentSize = new CCSize(96 * 4.5f, 96 * 2.5f);
            CCLog.Log("... setContentSize");

            blocks_scaled_with_insets.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            AddChild(blocks_scaled_with_insets);
            CCLog.Log("AddChild");

            CCLog.Log("... S9FrameNameSpriteSheetRotatedInsetsScaled done.");
        }
Esempio n. 2
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = CCDirector.SharedDirector.WinSize;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);
            var    rgba    = new CCLayerRGBA();

            rgba.CascadeColorEnabled   = true;
            rgba.CascadeOpacityEnabled = true;
            AddChild(rgba);

            CCLog.Log("S9CascadeOpacityAndColor ...");

            var blocks_scaled_with_insets = new CCScale9Sprite();

            blocks_scaled_with_insets.InitWithSpriteFrameName("blocks9r.png");
            CCLog.Log("... created");

            blocks_scaled_with_insets.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            rgba.AddChild(blocks_scaled_with_insets);
            var actions = new CCSequence(new CCFadeIn(1),
                                         new CCTintTo(1, 0, 255, 0),
                                         new CCTintTo(1, 255, 255, 255),
                                         new CCFadeOut(1));
            var repeat = new CCRepeatForever(actions);

            rgba.RunAction(repeat);
            CCLog.Log("AddChild");

            CCLog.Log("... S9CascadeOpacityAndColor done.");
        }
Esempio n. 3
0
        protected override void AddedToScene()
        {
            base.AddedToScene();
            var bg = new CCSprite("iphone5-bg.png");

            bg.Position = ContentSize.Center;
            AddChild(bg);

            var motor = new CCSprite("motor-ss.png");

            motor.Position = new CCPoint(160, 240);
            AddChild(motor);

            var roundedBorder = new CCScale9Sprite("circle.png", CCRect.Zero, new CCRect(50, 50, 1, 1));

            roundedBorder.PreferredSize = new CCSize(300, 300);
            roundedBorder.AnchorPoint   = CCPoint.AnchorMiddle;
            roundedBorder.Position      = ContentSize.Center;
            AddChild(roundedBorder);

            CCLabel label = new CCLabel("Motor", "Courier", 18 * CSF);

            label.AnchorPoint = CCPoint.AnchorMiddle;
            label.Color       = CCColor3B.Red;
            label.Position    = new CCPoint(160, motor.Position.Y + motor.ContentSize.Height / 2 + 10);

            AddChild(label);

            var label2 = new CCLabelBMFont("Rotor", "marker.fnt");

            label2.AnchorPoint = CCPoint.AnchorMiddle;
            label2.Position    = new CCPoint(160, motor.Position.Y - motor.ContentSize.Height / 2 - 10);

            AddChild(label2);
        }
Esempio n. 4
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = CCDirector.SharedDirector.WinSize;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            CCLog.Log("S9FrameNameSpriteSheetRotatedScaledNoInsets ...");

            var blocks_scaled = new CCScale9Sprite();

            blocks_scaled.InitWithSpriteFrameName("blocks9r.png");
            CCLog.Log("... created");

            blocks_scaled.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            blocks_scaled.ContentSize = new CCSize(96 * 4, 96 * 2);
            CCLog.Log("... setContentSize");

            AddChild(blocks_scaled);
            CCLog.Log("AddChild");

            CCLog.Log("... S9FrameNameSpriteSheetRotatedScaledNoInsets done.");
        }
Esempio n. 5
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = CCDirector.SharedDirector.WinSize;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            CCLog.Log("S9BatchNodeScaleWithCapInsets ...");

            var batchNode_scaled_with_insets = new CCSpriteBatchNode("Images/blocks9.png");

            CCLog.Log("batchNode_scaled_with_insets created with : Images/blocks9.png");

            var blocks_scaled_with_insets = new CCScale9Sprite();

            CCLog.Log("... created");

            blocks_scaled_with_insets.UpdateWithBatchNode(batchNode_scaled_with_insets, new CCRect(0, 0, 96, 96), false,
                                                          new CCRect(32, 32, 32, 32));
            CCLog.Log("... updateWithBatchNode");

            blocks_scaled_with_insets.ContentSize = new CCSize(96 * 4.5f, 96 * 2.5f);
            CCLog.Log("... setContentSize");

            blocks_scaled_with_insets.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            AddChild(blocks_scaled_with_insets);
            CCLog.Log("AddChild");

            CCLog.Log("... S9BatchNodeScaleWithCapInsets done.");
        }
Esempio n. 6
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = Layer.VisibleBoundsWorldspace.Size;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);
            var    rgba    = new CCLayer();

            rgba.IsColorCascaded   = true;
            rgba.IsOpacityCascaded = true;
            AddChild(rgba);

            CCLog.Log("S9CascadeOpacityAndColor ...");

            var blocks_scaled_with_insets = CCScale9Sprite.SpriteWithFrameName("blocks9r.png");

            CCLog.Log("... created");

            blocks_scaled_with_insets.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            rgba.AddChild(blocks_scaled_with_insets);
            var actions = new CCSequence(new CCFadeIn(1),
                                         new CCTintTo(1, 0, 255, 0),
                                         new CCTintTo(1, 255, 255, 255),
                                         new CCFadeOut(1));
            var repeat = new CCRepeatForever(actions);

            rgba.RunAction(repeat);
            CCLog.Log("AddChild");

            CCLog.Log("... S9CascadeOpacityAndColor done.");
        }
Esempio n. 7
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = Layer.VisibleBoundsWorldspace.Size;

            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFrames("Images/ui.plist");

            float x = winSize.Width / 4;
            float y = 0 + (winSize.Height / 2);

            var buttonNormal = CCScale9Sprite.SpriteWithFrameName("button_normal.png");

            buttonNormal.Position = new CCPoint(x, y);

            buttonNormal.ContentSize = new CCSize(14 * 16, 10 * 16);

            AddChild(buttonNormal);

            x = winSize.Width * 3 / 4;

            var buttonActivated = CCScale9Sprite.SpriteWithFrameName("button_actived.png");

            buttonActivated.Position = new CCPoint(x, y);

            buttonActivated.ContentSize = new CCSize(14 * 16, 10 * 16);

            AddChild(buttonActivated);
        }
Esempio n. 8
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = Layer.VisibleBoundsWorldspace.Size;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            CCLog.Log("S9BatchNodeScaledNoInsets ...");

            // scaled without insets
            var batchNode_scaled = new CCSpriteBatchNode("Images/blocks9.png");

            CCLog.Log("batchNode_scaled created with : Images/blocks9.png");

            var blocks_scaled = new CCScale9Sprite();

            CCLog.Log("... created");
            blocks_scaled.UpdateWithBatchNode(batchNode_scaled, new CCRect(0, 0, 96, 96), false,
                                              new CCRect(0, 0, 96, 96));
            CCLog.Log("... updateWithBatchNode");

            blocks_scaled.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            blocks_scaled.ContentSize = new CCSize(96 * 4, 96 * 2);
            CCLog.Log("... setContentSize");

            AddChild(blocks_scaled);
            CCLog.Log("AddChild");

            CCLog.Log("... S9BtchNodeScaledNoInsets done.");
        }
Esempio n. 9
0
        void LoadMenu()
        {
            var bounds = mainLayer.VisibleBoundsWorldspace;
            var center = bounds.Center;

            var startGameButton = new CCScale9Sprite("redButton");

            startGameButton.AnchorPoint = CCPoint.AnchorMiddle;
            startGameButton.CapInsets   = new CCRect(20, 20, 42, 42);
            startGameButton.ContentSize = new CCSize((mWidth * 0.4f), (mHeight * 0.2f));

            var startGameLabel = new CCLabel("Load Icon Board", "Fonts/MarkerFelt", 22, CCLabelFormat.SpriteFont);

            buttonControl = new CCControlButton(startGameLabel, startGameButton);

            var scale = (mWidth * 0.4f) / buttonControl.ContentSize.Width;

            startGameLabel.Scale = scale;

            buttonControl.PreferredSize = new CCSize(startGameButton.ContentSize.Width * scale, startGameButton.ContentSize.Height * scale);
            buttonControl.PositionX     = center.X;
            buttonControl.PositionY     = bounds.Size.Height / 4.0f;
            buttonControl.Clicked      += PressedButton;

            mainLayer.AddChild(buttonControl);
        }
Esempio n. 10
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = CCDirector.SharedDirector.WinSize;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            CCLog.Log("Scale9FrameNameSpriteSheetRotatedSetCapInsetLater ...");

            var blocks_scaled_with_insets = new CCScale9Sprite();

            blocks_scaled_with_insets.InitWithSpriteFrameName("blocks9r.png");
            CCLog.Log("... created");

            blocks_scaled_with_insets.InsetLeft  = 32;
            blocks_scaled_with_insets.InsetRight = 32;

            blocks_scaled_with_insets.PreferredSize = new CCSize(32 * 5.5f, 32 * 4);
            blocks_scaled_with_insets.Position      = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            AddChild(blocks_scaled_with_insets);
            CCLog.Log("AddChild");

            CCLog.Log("... Scale9FrameNameSpriteSheetRotatedSetCapInsetLater done.");
        }
Esempio n. 11
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = CCDirector.SharedDirector.WinSize;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            CCLog.Log("S9BatchNodeBasic ...");

            var batchNode = new CCSpriteBatchNode("Images/blocks9.png");

            //batchNode.AnchorPoint = new CCPoint(0.5f, 0.5f);
            CCLog.Log("batchNode created with : Images/blocks9.png");

            var blocks = new CCScale9Sprite();

            CCLog.Log("... created");

            blocks.UpdateWithBatchNode(batchNode, new CCRect(0, 0, 96, 96), false, new CCRect(0, 0, 96, 96));
            CCLog.Log("... updateWithBatchNode");

            blocks.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            AddChild(blocks);
            CCLog.Log("AddChild");

            CCLog.Log("... S9BatchNodeBasic done.");
        }
        // Sprite frame name

        // A constructor with argument string already exists (filename), so create this factory method instead
        public static CCScale9Sprite SpriteWithFrameName(string spriteFrameName, CCRect capInsets)
        {
            CCScale9Sprite sprite = new CCScale9Sprite();

            sprite.InitWithSpriteFrameName(spriteFrameName, capInsets);

            return(sprite);
        }
Esempio n. 13
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = Layer.VisibleBoundsWorldspace.Size;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            var blocksWithInsets = CCScale9Sprite.SpriteWithFrameName("blocks9r.png", new CCRect(32, 32, 32, 32));

            blocksWithInsets.Position = new CCPoint(x, y);

            AddChild(blocksWithInsets);
        }
Esempio n. 14
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize  = Layer.VisibleBoundsWorldspace.Size;
            var    position = winSize.Center;

            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFrames("Images/blocks9ss.plist");

            var blocks = CCScale9Sprite.SpriteWithFrameName("blocks9cr.png");

            blocks.Position = position;

            AddChild(blocks);
        }
Esempio n. 15
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = Layer.VisibleBoundsWorldspace.Size;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            var blocksScaled = CCScale9Sprite.SpriteWithFrameName("blocks9r.png");

            blocksScaled.Position = new CCPoint(x, y);

            blocksScaled.ContentSize = new CCSize(96 * 4, 96 * 2);

            AddChild(blocksScaled);
        }
Esempio n. 16
0
        void CreateLayers()
        {
            mainLayer = new StartLayer();

            var blueBackground = new CCScale9Sprite("blueButton");

            blueBackground.AnchorPoint = CCPoint.AnchorMiddle;
            blueBackground.CapInsets   = new CCRect(20, 20, 42, 42);
            blueBackground.ContentSize = new CCSize(mWidth, mHeight);
            blueBackground.PositionX   = mWidth / 2f;
            blueBackground.PositionY   = mHeight / 2f;

            mainLayer.AddChild(blueBackground, 0);

            AddLayer(mainLayer);
        }
Esempio n. 17
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = Layer.VisibleBoundsWorldspace.Size;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            var blocksScaledWithInsets = CCScale9Sprite.SpriteWithFrameName("blocks9r.png");

            blocksScaledWithInsets.InsetLeft  = 32;
            blocksScaledWithInsets.InsetRight = 32;

            blocksScaledWithInsets.PreferredSize = new CCSize(32 * 5.5f, 32 * 4);
            blocksScaledWithInsets.Position      = new CCPoint(x, y);

            AddChild(blocksScaledWithInsets);
        }
Esempio n. 18
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = Layer.VisibleBoundsWorldspace.Size;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            var blocksSprite = new CCSprite("Images/blocks9.png");

            var blocks = new CCScale9Sprite();

            blocks.UpdateWithSprite(blocksSprite, new CCRect(0, 0, 96, 96), false, new CCRect(0, 0, 96, 96));

            blocks.Position = new CCPoint(x, y);

            AddChild(blocks);
        }
Esempio n. 19
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = CCDirector.SharedDirector.WinSize;

            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile("Images/ui.plist");

            float x = winSize.Width / 4;
            float y = 0 + (winSize.Height / 2);

            CCLog.Log("S9_TexturePacker ...");

            var s = new CCScale9Sprite();

            s.InitWithSpriteFrameName("button_normal.png");
            CCLog.Log("... created");

            s.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            s.ContentSize = new CCSize(14 * 16, 10 * 16);
            CCLog.Log("... setContentSize");

            AddChild(s);
            CCLog.Log("AddChild");

            x = winSize.Width * 3 / 4;

            var s2 = new CCScale9Sprite();

            s2.InitWithSpriteFrameName("button_actived.png");
            CCLog.Log("... created");

            s2.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            s2.ContentSize = new CCSize(14 * 16, 10 * 16);
            CCLog.Log("... setContentSize");

            AddChild(s2);
            CCLog.Log("AddChild");

            CCLog.Log("... S9_TexturePacker done.");
        }
Esempio n. 20
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = Layer.VisibleBoundsWorldspace.Size;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            var spriteScaledWithInsets = new CCSprite("Images/blocks9.png");

            var blocksScaledWithInsets = new CCScale9Sprite();

            blocksScaledWithInsets.UpdateWithSprite(spriteScaledWithInsets, new CCRect(0, 0, 96, 96), false,
                                                    new CCRect(32, 32, 32, 32));

            blocksScaledWithInsets.ContentSize = new CCSize(96 * 4.5f, 96 * 2.5f);

            blocksScaledWithInsets.Position = new CCPoint(x, y);

            AddChild(blocksScaledWithInsets);
        }
Esempio n. 21
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = Layer.VisibleBoundsWorldspace.Size;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            CCLog.Log("S9FrameNameSpriteSheet ...");

            var blocks = CCScale9Sprite.SpriteWithFrameName("blocks9.png");

            CCLog.Log("... created");

            blocks.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            AddChild(blocks);
            CCLog.Log("AddChild");

            CCLog.Log("... S9FrameNameSpriteSheet done.");
        }
Esempio n. 22
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = CCDirector.SharedDirector.WinSize;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            CCLog.Log("S9FrameNameSpriteSheet ...");

            var blocks = new CCScale9Sprite();

            blocks.InitWithSpriteFrameName("blocks9.png");
            CCLog.Log("... created");

            blocks.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            AddChild(blocks);
            CCLog.Log("AddChild");

            CCLog.Log("... S9FrameNameSpriteSheet done.");
        }
Esempio n. 23
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = Layer.VisibleBoundsWorldspace.Size;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            CCLog.Log("S9FrameNameSpriteSheetRotatedScaledNoInsets ...");

            var blocks_scaled = CCScale9Sprite.SpriteWithFrameName("blocks9r.png");

            CCLog.Log("... created");

            blocks_scaled.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            blocks_scaled.ContentSize = new CCSize(96 * 4, 96 * 2);
            CCLog.Log("... setContentSize");

            AddChild(blocks_scaled);
            CCLog.Log("AddChild");

            CCLog.Log("... S9FrameNameSpriteSheetRotatedScaledNoInsets done.");
        }
Esempio n. 24
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = Layer.VisibleBoundsWorldspace.Size;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            CCLog.Log("S9FrameNameSpriteSheetInsetsScaled ...");

            var blocks_scaled_with_insets = CCScale9Sprite.SpriteWithFrameName("blocks9.png", new CCRect(32, 32, 32, 32));

            CCLog.Log("... created");

            blocks_scaled_with_insets.ContentSize = new CCSize(96 * 4.5f, 96 * 2.5f);
            CCLog.Log("... setContentSize");

            blocks_scaled_with_insets.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            AddChild(blocks_scaled_with_insets);
            CCLog.Log("AddChild");

            CCLog.Log("... S9FrameNameSpriteSheetInsetsScaled done.");
        }
Esempio n. 25
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = Layer.VisibleBoundsWorldspace.Size;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);
            var    rgba    = new CCLayer();

            rgba.IsColorCascaded   = true;
            rgba.IsOpacityCascaded = true;
            AddChild(rgba);

            var blocksScaledWithInsets = CCScale9Sprite.SpriteWithFrameName("blocks9r.png");

            blocksScaledWithInsets.Position = new CCPoint(x, y);

            rgba.AddChild(blocksScaledWithInsets);
            var actions = new CCSequence(new CCFadeIn(1),
                                         new CCTintTo(1, 0, 255, 0),
                                         new CCTintTo(1, 255, 255, 255),
                                         new CCFadeOut(1));

            rgba.RepeatForever(actions);
        }
Esempio n. 26
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize winSize = VisibleBoundsWorldspace.Size;
            float  x       = winSize.Center.X;
            float  y       = winSize.Center.Y;

            //var widgetSize = _widget->getContentSize();

            var moveTo   = new CCMoveBy(1.0f, new CCPoint(30, 0));
            var moveBack = moveTo.Reverse();
            var rotateBy = new CCRotateBy(1.0f, 180);
            var scaleBy  = new CCScaleTo(1.0f, -2.0f);
            var action   = new CCSequence(moveTo, moveBack, rotateBy, scaleBy);


            var normalSprite1 = new CCSprite("Images/animationbuttonnormal.png");

            normalSprite1.Position   = winSize.Center;
            normalSprite1.PositionX -= 100;
            normalSprite1.PositionY += 100;
            normalSprite1.FlipY      = true;


            AddChild(normalSprite1);
            normalSprite1.RunAction(action);

            var normalSprite2 = new CCScale9Sprite("Images/animationbuttonnormal.png");

            normalSprite2.Position        = winSize.Center;
            normalSprite2.PositionX      -= 80;
            normalSprite2.PositionY      += 100;
            normalSprite2.IsScale9Enabled = false;
            normalSprite2.Opacity         = 100;
            AddChild(normalSprite2);
            normalSprite2.Color = CCColor3B.Green;
            normalSprite2.RunAction(action);


            var sp1 = new CCScale9Sprite("Images/animationbuttonnormal.png");

            sp1.Position    = winSize.Center;
            sp1.PositionX  -= 100;
            sp1.PositionY  -= 50;
            sp1.Scale       = 1.2f;
            sp1.ContentSize = new CCSize(100, 100);
            sp1.Color       = CCColor3B.Green;
            AddChild(sp1);
            sp1.RunAction(action);

            var sp2 = new CCScale9Sprite("Images/animationbuttonnormal.png");

            sp2.Position      = winSize.Center;
            sp2.PositionX    += 100;
            sp2.PositionY    -= 50;
            sp2.PreferredSize = sp1.ContentSize * 1.2f;
            sp2.ContentSize   = new CCSize(100, 100);
            sp2.Color         = CCColor3B.Green;
            AddChild(sp2);
            sp2.RunAction(action);
        }
 public static CCScale9Sprite SpriteWithFrameName(string spriteFrameName)
 {
     return(CCScale9Sprite.SpriteWithFrameName(spriteFrameName, CCRect.Zero));
 }
Esempio n. 28
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = Layer.VisibleBoundsWorldspace.Size;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            var statusLabel = new CCLabel("Scale9Enabled", "arial", 10, CCLabelFormat.SpriteFont);

            statusLabel.PositionX = x;
            statusLabel.PositionY = winSize.Height - statusLabel.ContentSize.Height - 100;
            AddChild(statusLabel);

            var normalSprite = CCScale9Sprite.SpriteWithFrameName("blocks9r.png");

            normalSprite.PositionX = x;
            normalSprite.PositionY = y;
            AddChild(normalSprite);


            var normalLabel = new CCLabel("Normal Sprite", "Arial", 10, CCLabelFormat.SpriteFont);

            normalLabel.Position += normalSprite.Position +
                                    new CCPoint(0, normalSprite.ScaledContentSize.Height / 2 + 10);
            AddChild(normalLabel);



            var flipXSprite = CCScale9Sprite.SpriteWithFrameName("blocks9r.png");

            flipXSprite.PositionX = x - 150;
            flipXSprite.PositionY = y;
            flipXSprite.Scale     = 1.2f;
            AddChild(flipXSprite);
            flipXSprite.IsFlippedX = false;

            var flipXLabel = new CCLabel("sprite is not flipped!", "Arial", 10, CCLabelFormat.SpriteFont);

            flipXLabel.Position = flipXSprite.Position +
                                  new CCPoint(0, flipXSprite.ScaledContentSize.Height / 2 + 10);
            AddChild(flipXLabel);


            var flipYSprite = CCScale9Sprite.SpriteWithFrameName("blocks9r.png");

            flipYSprite.PositionX = x + 150;
            flipYSprite.PositionY = y;
            flipYSprite.Scale     = 0.8f;
            AddChild(flipYSprite);
            flipYSprite.IsFlippedY = true;

            var flipYLabel = new CCLabel("sprite is flipped!", "Arial", 10, CCLabelFormat.SpriteFont);

            flipYLabel.Position = flipYSprite.Position +
                                  new CCPoint(0, flipYSprite.ScaledContentSize.Height / 2 + 10);
            AddChild(flipYLabel);


            var toggleFlipXButton = new CCControlButton("Toggle FlipX", "arial", 12);

            toggleFlipXButton.Position = flipXSprite.Position +
                                         new CCPoint(0, -20 - flipXSprite.ScaledContentSize.Height / 2);


            toggleFlipXButton.Clicked += (obj, cevent) =>
            {
                flipXSprite.IsFlippedX = !flipXSprite.IsFlippedX;
                if (flipXSprite.IsFlippedX)
                {
                    flipXLabel.Text = "sprite is flipped";
                }
                else
                {
                    flipXLabel.Text = "sprite is not flipped";
                }
            };

            AddChild(toggleFlipXButton);

            var toggleFlipYButton = new CCControlButton("Toggle FlipY", "arial", 12);

            toggleFlipYButton.Position = flipYSprite.Position +
                                         new CCPoint(0, -20 - flipYSprite.ScaledContentSize.Height / 2);

            toggleFlipYButton.Clicked += (obj, cevent) =>
            {
                flipYSprite.IsFlippedY = !flipYSprite.IsFlippedY;
                if (flipYSprite.IsFlippedY)
                {
                    flipYLabel.Text = "sprite is flipped";
                }
                else
                {
                    flipYLabel.Text = "sprite is not flipped";
                }
            };

            AddChild(toggleFlipYButton);

            var toggleScale9Button = new CCControlButton("Toggle Scale9", "arial", 12);

            toggleScale9Button.Position = normalSprite.Position +
                                          new CCPoint(0, -20 - normalSprite.ContentSize.Height / 2);

            toggleScale9Button.Clicked += (obj, cevent) =>
            {
                flipXSprite.IsScale9Enabled = !flipXSprite.IsScale9Enabled;
                flipYSprite.IsScale9Enabled = !flipYSprite.IsScale9Enabled;

                if (flipXSprite.IsScale9Enabled)
                {
                    statusLabel.Text = "Scale9Enabled";
                }
                else
                {
                    statusLabel.Text = "Scale9Disabled";
                }

                if (flipXSprite.IsFlippedX)
                {
                    flipXLabel.Text = "sprite is flipped";
                }
                else
                {
                    flipXLabel.Text = "sprite is not flipped";
                }

                if (flipYSprite.IsFlippedY)
                {
                    flipYLabel.Text = "sprite is flipped";
                }
                else
                {
                    flipYLabel.Text = "sprite is not flipped";
                }
            };

            AddChild(toggleScale9Button);
        }
        // Sprite frame name

        // A constructor with argument string already exists (filename), so create this factory method instead
        public static CCScale9Sprite SpriteWithFrameName(string spriteFrameName, CCRect capInsets)
        {
            CCScale9Sprite sprite = new CCScale9Sprite();
            sprite.InitWithSpriteFrameName(spriteFrameName, capInsets);

            return sprite;
        }