public override void OnEnter() { base.OnEnter(); CCSize winSize = Layer.VisibleBoundsWorldspace.Size; 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."); }
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); }
// 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); }
protected override void AddedToScene() { base.AddedToScene(); var bg = new CCSprite("iphone5-bg.png"); bg.Position = ContentSize.Center; AddChild(bg); var motor = new CCSprite("motor.png"); motor.Position = new CCPoint(160, 240) * CSF; AddChild(motor); var roundedBorder = new CCScale9Sprite("circle.png"); roundedBorder.CapInsets = new CCRect(50 * CSF, 50 * CSF, 1, 1); roundedBorder.PreferredSize = new CCSize(300 * CSF, 300 * CSF); roundedBorder.AnchorPoint = CCPoint.AnchorMiddle; roundedBorder.Position = ContentSize.Center; AddChild(roundedBorder); }
public static CCScale9Sprite SpriteWithFrameName(string spriteFrameName) { return(CCScale9Sprite.SpriteWithFrameName(spriteFrameName, CCRect.Zero)); }
public override void OnEnter() { base.OnEnter(); CCSize winSize = Layer.VisibleBoundsWorldspace.Size; 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."); }
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); }
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); }
// 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; }