private void InitBug1159Layer() { CCSize s = Layer.VisibleBoundsWorldspace.Size; CCLayerColor background = new CCLayerColor(new CCColor4B(255, 0, 255, 255)); AddChild(background); CCLayerColor sprite_a = new CCLayerColor(new CCColor4B(255, 0, 0, 255)); sprite_a.AnchorPoint = new CCPoint(0.5f, 0.5f); sprite_a.IgnoreAnchorPointForPosition = true; sprite_a.Position = new CCPoint(0.0f, s.Height / 2); AddChild(sprite_a); sprite_a.RunAction(new CCRepeatForever ((CCFiniteTimeAction)new CCSequence( new CCMoveTo (1.0f, new CCPoint(1024.0f, 384.0f)), new CCMoveTo (1.0f, new CCPoint(0.0f, 384.0f))))); CCLayerColor sprite_b = new CCLayerColor(new CCColor4B(0, 0, 255, 255)); sprite_b.AnchorPoint = new CCPoint(0.5f, 0.5f); sprite_b.IgnoreAnchorPointForPosition = true; sprite_b.Position = new CCPoint(s.Width / 2, s.Height / 2); AddChild(sprite_b); CCMenuItemLabel label = new CCMenuItemLabel(new CCLabel("Flip Me", "Helvetica", 24, CCLabelFormat.SpriteFont), callBack); CCMenu menu = new CCMenu(label); menu.Position = new CCPoint(s.Width - 200.0f, 50.0f); AddChild(menu); }
public TextLayer() : base() { Camera = AppDelegate.SharedCamera; contentLayer = new CCLayer(); CCCamera contentCamera = new CCCamera(Camera.OrthographicViewSizeWorldspace, Camera.CenterInWorldspace, Camera.TargetInWorldspace); contentLayer.Camera = contentCamera; var bg = new CCSprite(TestResource.s_back3); BaseNode = bg; contentLayer.AddChild(bg, 0, EffectTestScene.kTagBackground); var Kathia = new CCSprite(TestResource.s_pPathSister2); BaseNode.AddChild(Kathia, 1, EffectTestScene.kTagKathia); var sc = new CCScaleBy(2, 5); var sc_back = sc.Reverse(); Kathia.RunAction(new CCRepeatForever(sc, sc_back)); var Tamara = new CCSprite(TestResource.s_pPathSister1); BaseNode.AddChild(Tamara, 1, EffectTestScene.kTagTamara); var sc2 = new CCScaleBy(2, 5); var sc2_back = sc2.Reverse(); Tamara.RunAction(new CCRepeatForever(sc2, sc2_back)); var colorBackground = new CCLayerColor(new CCColor4B(32, 128, 32, 255)); contentLayer.AddChild(colorBackground, -1); }
public LayerMultiplexTest() { for (int i = 0; i < 3; i++) { CCLayer l = new CCLayerColor(new CCColor4B(0,255,0)); CCSprite img = null; switch (i) { case 0: img = new CCSprite("Images/grossini"); break; case 1: img = new CCSprite("Images/grossinis_sister1"); break; case 2: img = new CCSprite("Images/grossinis_sister2"); break; } img.AnchorPoint = CCPoint.Zero; img.Position = CCPoint.Zero; l.ContentSize = img.ContentSize; l.AddChild(img); l.Position = new CCPoint(128f, 128f); child.AddLayer(l); } child.InAction = new CCFadeIn(1); AddChild(child); Schedule(new Action<float>(AutoMultiplex), 3f); }
public TextLayer() : base() { contentLayer = new CCLayer(); CCCamera contentCamera = Camera; contentLayer.Camera = contentCamera; var bg = new CCSprite(TestResource.s_back3); BaseNode = bg; contentLayer.AddChild(bg, 0, EffectTestScene.kTagBackground); var Kathia = new CCSprite(TestResource.s_pPathSister2); BaseNode.AddChild(Kathia, 1, EffectTestScene.kTagKathia); var sc = new CCScaleBy(2, 5); var sc_back = sc.Reverse(); Kathia.RunAction(new CCRepeatForever(sc, sc_back)); var Tamara = new CCSprite(TestResource.s_pPathSister1); BaseNode.AddChild(Tamara, 1, EffectTestScene.kTagTamara); var sc2 = new CCScaleBy(2, 5); var sc2_back = sc2.Reverse(); Tamara.RunAction(new CCRepeatForever(sc2, sc2_back)); var colorBackground = new CCLayerColor(new CCColor4B(32, 128, 32, 255)); contentLayer.AddChild(colorBackground, -1); }
public override void OnEnter() { base.OnEnter(); CCSize s = Layer.VisibleBoundsWorldspace.Size; CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFrames("zwoptex/grossini.plist"); CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFrames("zwoptex/grossini-generic.plist"); CCLayerColor layer1 = new CCLayerColor(new CCColor4B(255, 0, 0, 255)); layer1.Position = new CCPoint(s.Width / 2 - 80 - (85.0f * 0.5f), s.Height / 2 - (121.0f * 0.5f)); AddChild(layer1); sprite1 = new CCSprite(CCSpriteFrameCache.SharedSpriteFrameCache["grossini_dance_01.png"]); sprite1.Position = (new CCPoint(s.Width / 2 - 80, s.Height / 2)); AddChild(sprite1); sprite1.FlipX = false; sprite1.FlipY = false; CCLayerColor layer2 = new CCLayerColor(new CCColor4B(255, 0, 0, 255)); layer2.Position = new CCPoint(s.Width / 2 + 80 - (85.0f * 0.5f), s.Height / 2 - (121.0f * 0.5f)); AddChild(layer2); sprite2 = new CCSprite(CCSpriteFrameCache.SharedSpriteFrameCache["grossini_dance_generic_01.png"]); sprite2.Position = (new CCPoint(s.Width / 2 + 80, s.Height / 2)); AddChild(sprite2); sprite2.FlipX = false; sprite2.FlipY = false; Schedule(startIn05Secs, 1.0f); counter = 0; }
public override void OnEnter() { base.OnEnter(); CCSize s = Layer.VisibleBoundsWorldspace.Size; CCLayerColor layer = new CCLayerColor(new CCColor4B(0xFF, 0x00, 0x00, 0x80)); layer.IgnoreAnchorPointForPosition = false; layer.Position = (new CCPoint(s.Width / 2, s.Height / 2)); AddChild(layer, 1, kTagLayer); // // Add two labels using BM label class // CCLabelBMFont var label1 = new CCLabelBMFont("LABEL1", "fonts/konqa32.fnt"); layer.AddChild(label1); label1.Position = new CCPoint(layer.ContentSize.Width / 2, layer.ContentSize.Height * 0.75f); var label2 = new CCLabelBMFont("LABEL2", "fonts/konqa32.fnt"); layer.AddChild(label2); label2.Position = new CCPoint(layer.ContentSize.Width / 2, layer.ContentSize.Height * 0.25f); // // Do the sequence of actions in the bug report layer.Visible = false; layer.RunActions(hide, scaleTo1, show, delay, scaleTo2, scaleTo3, scaleTo4, scaleTo5); }
public override void OnEnter() { base.OnEnter(); var s = Layer.VisibleBoundsWorldspace.Size; var layer1 = new CCLayerColor(new CCColor4B(255, 255, 0, 80)); layer1.Position = (new CCPoint(s.Width / 3, s.Height / 2)); layer1.IgnoreAnchorPointForPosition = false; AddChild(layer1, 1); var layer2 = new CCLayerColor(new CCColor4B(0, 0, 255, 255)); layer2.Position = (new CCPoint((s.Width / 3) * 2, s.Height / 2)); layer2.IgnoreAnchorPointForPosition = false; AddChild(layer2, 1); var actionTint = new CCTintBy (2, -255, -127, 0); var actionTintBack = actionTint.Reverse(); var seq1 = new CCSequence(actionTint, actionTintBack); layer1.RunAction(seq1); var actionFade = new CCFadeOut(2.0f); var actionFadeBack = actionFade.Reverse(); var seq2 = new CCSequence(actionFade, actionFadeBack); layer2.RunAction(seq2); }
public override void OnEnter() { base.OnEnter(); var effect = new CCSequence(new CCDelayTime (2.0f), new CCShaky3D(5.0f, new CCGridSize(5, 5), 16, false)); // cleanup RemoveChild(bgNode, true); // background var layer = new CCLayerColor(new CCColor4B(255, 0, 0, 255)); AddChild(layer, -10); var sprite = new CCSprite("Images/grossini"); sprite.Position = new CCPoint(50, 80); layer.AddChild(sprite, 10); // foreground var layer2Node = new CCNode (); var layer2 = new CCLayerColor(new CCColor4B(0, 255, 0, 255)); var fog = new CCSprite("Images/Fog"); var bf = new CCBlendFunc {Source = CCOGLES.GL_SRC_ALPHA, Destination = CCOGLES.GL_ONE_MINUS_SRC_ALPHA}; fog.BlendFunc = bf; layer2.AddChild(fog, 1); AddChild(layer2Node, 1); layer2Node.AddChild (layer2); layer2Node.RepeatForever(effect); }
public LabelGlyphDesigner() { var layer = new CCLayerColor(new CCColor4B(128, 128, 128, 255)); AddChild(layer, -10); // CCLabelBMFont label1 = new CCLabelBMFont("Testing Glyph Designer", "fonts/futura-48.fnt"); AddChild(label1); }
public override void OnEnter() { base.OnEnter(); CCSize s = Layer.VisibleBoundsWorldspace.Size; var layer1 = new CCLayerColor(new CCColor4B(0xFF, 0xFF, 0x00, 0x80)); layer1.IgnoreAnchorPointForPosition = false; layer1.Position = (new CCPoint(s.Width / 2, s.Height / 2)); layer1.ChildClippingMode = CCClipMode.Bounds; AddChild(layer1, 1); s = layer1.ContentSize; m_pInnerLayer = new CCLayerColor(new CCColor4B(0xFF, 0x00, 0x00, 0x80)); m_pInnerLayer.IgnoreAnchorPointForPosition = false; m_pInnerLayer.Position = (new CCPoint(s.Width / 2, s.Height / 2)); m_pInnerLayer.ChildClippingMode = CCClipMode.Bounds; layer1.AddChild(m_pInnerLayer, 1); // // Add two labels using BM label class // CCLabelBMFont CCLabelBMFont label1 = new CCLabelBMFont("LABEL1", "fonts/konqa32.fnt"); label1.Position = new CCPoint(m_pInnerLayer.ContentSize.Width, m_pInnerLayer.ContentSize.Height * 0.75f); m_pInnerLayer.AddChild(label1); CCLabelBMFont label2 = new CCLabelBMFont("LABEL2", "fonts/konqa32.fnt"); label2.Position = new CCPoint(0, m_pInnerLayer.ContentSize.Height * 0.25f); m_pInnerLayer.AddChild(label2); CCScaleTo scaleTo2 = new CCScaleTo(runTime * 0.25f, 3.0f); CCScaleTo scaleTo3 = new CCScaleTo(runTime * 0.25f, 1.0f); m_pInnerLayer.RepeatForever(scaleTo2, scaleTo3); CCFiniteTimeAction seq = new CCRepeatForever( new CCSequence(scaleTo2, scaleTo3) ); m_pInnerLayer.RunAction(seq); CCSize size = Layer.VisibleBoundsWorldspace.Size; var move1 = new CCMoveTo(2, new CCPoint(size.Width / 2, size.Height)); var move2 = new CCMoveTo(2, new CCPoint(size.Width, size.Height / 2)); var move3 = new CCMoveTo(2, new CCPoint(size.Width / 2, 0)); var move4 = new CCMoveTo(2, new CCPoint(0, size.Height / 2)); layer1.RunAction(new CCRepeatForever(new CCSequence(move1, move2, move3, move4))); }
public LayerTestBlend() { CCLayerColor layer1 = new CCLayerColor(new CCColor4B(255, 255, 255, 80)); sister1 = new CCSprite(s_pPathSister1); sister2 = new CCSprite(s_pPathSister2); AddChild(sister1); AddChild(sister2); AddChild(layer1, 100, kTagLayer); Schedule(newBlend, 1.0f); }
public LabelTTFA8Test() { var layer = new CCLayerColor(new CCColor4B(128, 128, 128, 255)); AddChild(layer, -10); // CCLabelBMFont label1 = new CCLabelTtf("Testing A8 Format", "MarkerFelt", 38); AddChild(label1); label1.Color = CCColor3B.Red; var fadeOut = new CCFadeOut (2); var fadeIn = new CCFadeIn (2); label1.RepeatForever(fadeIn, fadeOut); }
public MainLayer() { var listener = new CCEventListenerTouchAllAtOnce(); listener.OnTouchesEnded = onTouchesEnded; AddEventListener(listener); CCSprite sprite = new CCSprite(ClickAndMoveTest.s_pPathGrossini); CCLayer layer = new CCLayerColor(new CCColor4B(255, 255, 0, 255)); AddChild(layer, -1); AddChild(sprite, 0, ClickAndMoveTest.kTagSprite); sprite.Position = new CCPoint(20, 150); sprite.RunAction(new CCJumpTo (4, new CCPoint(300, 48), 100, 4)); layer.RepeatForever(new CCFadeIn(1), new CCFadeOut(1)); }
public override void OnEnter() { base.OnEnter(); var listener = new CCEventListenerTouchAllAtOnce(); listener.OnTouchesBegan = onTouchesBegan; listener.OnTouchesMoved = onTouchesMoved; listener.OnTouchesEnded = onTouchesEnded; AddEventListener(listener); CCSize s = Layer.VisibleBoundsWorldspace.Size; CCLayerColor layer = new CCLayerColor(new CCColor4B(0xFF, 0x00, 0x00, 0x80)); layer.IgnoreAnchorPointForPosition = false; layer.Position = s.Center; AddChild(layer, 1, kTagLayer); }
public RenderTextureIssue937() { /* * 1 2 * A: A1 A2 * * B: B1 B2 * * A1: premulti sprite * A2: premulti render * * B1: non-premulti sprite * B2: non-premulti render */ CCLayerColor background = new CCLayerColor(new CCColor4B(200, 200, 200, 255)); AddChild(background); spritePremulti = new CCSprite("Images/fire"); spriteNonpremulti = new CCSprite("Images/fire"); }
protected override void InitialiseScenes() { base.InitialiseScenes(); fadeLayer = new CCLayerColor(Color); fadeLayer.Visible = false; InSceneNodeContainer.Visible = false; AddChild(fadeLayer, 20, SceneFade); var a = (CCFiniteTimeAction) new CCSequence ( new CCShow(), new CCFadeIn (Duration / 2), new CCCallFunc((HideOutShowIn)), new CCFadeOut (Duration / 2) ); fadeLayer.RunAction(a); }
public Bug914Layer() { // always call "super" init // Apple recommends to re-assign "self" with the "super" return value // Register Touch Event var touchListener = new CCEventListenerTouchAllAtOnce(); touchListener.OnTouchesBegan = onTouchesBegan; touchListener.OnTouchesMoved = onTouchesMoved; AddEventListener(touchListener); // ask director the the window size CCSize size = Layer.VisibleBoundsWorldspace.Size; CCLayerColor layer; for (int i = 0; i < 5; i++) { layer = new CCLayerColor(new CCColor4B((byte)(i*20), (byte)(i*20), (byte)(i*20),255)); layer.ContentSize = new CCSize(i * 100, i * 100); layer.Position = new CCPoint(size.Width / 2, size.Height / 2); layer.AnchorPoint = new CCPoint(0.5f, 0.5f); layer.IgnoreAnchorPointForPosition = true; AddChild(layer, -1 - i); } // create and initialize a Label var label = new CCLabel("Hello World", "Marker Felt", 64, CCLabelFormat.SpriteFont); CCMenuItem item1 = new CCMenuItemFont("restart", restart); CCMenu menu = new CCMenu(item1); menu.AlignItemsVertically(); menu.Position = new CCPoint(size.Width / 2, 100); AddChild(menu); // position the label on the center of the screen label.Position = new CCPoint(size.Width / 2, size.Height / 2); // add the label as a child to this Layer AddChild(label); }
public override void ApplicationDidFinishLaunching(CCApplication app, CCWindow window) { app.PreferMultiSampling = false; app.ContentRootDirectory = "Content"; app.ContentSearchPaths.Add("hd"); CCScene scene = new CCScene(window); CCLayerColor layer = new CCLayerColor(); var label = new CCLabel("Tap Screen To Play!","MarkerFelt-22" , 22) { Position = layer.VisibleBoundsWorldspace.Center, Color = CCColor3B.Black, HorizontalAlignment = CCTextAlignment.Center, VerticalAlignment = CCVerticalTextAlignment.Center, AnchorPoint = CCPoint.AnchorLowerLeft, Dimensions = layer.ContentSize }; layer.AddChild(label); scene.AddChild(layer); window.RunWithScene(scene); }
public override void OnEnter() { base.OnEnter(); float x, y; CCSize size = Layer.VisibleBoundsWorldspace.Size; x = size.Width; y = size.Height; CCNode blue = new CCLayerColor(new CCColor4B(0, 0, 255, 255)); CCNode red = new CCLayerColor(new CCColor4B(255, 0, 0, 255)); CCNode green = new CCLayerColor(new CCColor4B(0, 255, 0, 255)); CCNode white = new CCLayerColor(new CCColor4B(255, 255, 255, 255)); blue.Scale = (0.5f); blue.Position = (new CCPoint(-x / 4, -y / 4)); blue.AddChild(new SpriteLayer()); red.Scale = (0.5f); red.Position = (new CCPoint(x / 4, -y / 4)); green.Scale = (0.5f); green.Position = (new CCPoint(-x / 4, y / 4)); green.AddChild(new TestLayer()); white.Scale = (0.5f); white.Position = (new CCPoint(x / 4, y / 4)); AddChild(blue, -1); AddChild(white); AddChild(green); AddChild(red); blue.RunAction(rot); red.RunAction(rot); green.RunAction(rot); white.RunAction(rot); }
public LabelTTFTest() { var blockSize = new CCSize(200, 160); var s = Layer.VisibleBoundsWorldspace.Size; var colorLayer = new CCLayerColor(new CCColor4B(100, 100, 100, 255)); colorLayer.AnchorPoint = CCPoint.Zero; colorLayer.Position = new CCPoint((s.Width - blockSize.Width) / 2, (s.Height - blockSize.Height) / 2); AddChild(colorLayer); CCMenuItemFont.FontSize = 32; CCMenuItemFont.FontName = "MarkerFelt"; var menu = new CCMenu( new CCMenuItemFont("Left", setAlignmentLeft), new CCMenuItemFont("Center", setAlignmentCenter), new CCMenuItemFont("Right", setAlignmentRight) ); menu.AlignItemsVertically(4); menu.Position = new CCPoint(50, s.Height / 2 - 20); AddChild(menu); menu = new CCMenu( new CCMenuItemFont("Top", setAlignmentTop), new CCMenuItemFont("Middle", setAlignmentMiddle), new CCMenuItemFont("Bottom", setAlignmentBottom) ); menu.AlignItemsVertically(4); menu.Position = new CCPoint(s.Width - 50, s.Height / 2 - 20); AddChild(menu); m_plabel = null; m_eHorizAlign = CCTextAlignment.Left; m_eVertAlign = CCVerticalTextAlignment.Top; updateAlignment(); }
public ParticleDemo() { toggleParticleMovMenuItem = new CCMenuItemToggle(ToggleCallback, new CCMenuItemFont("Free Movement"), new CCMenuItemFont("Relative Movement"), new CCMenuItemFont("Grouped Movement")); particleMenu = new CCMenu(toggleParticleMovMenuItem); AddChild(particleMenu, 100); particleCounter = new CCLabelAtlas("0000", "Images/fps_Images", 16, 64, '.'); AddChild(particleCounter, 100, ParticleTestScene.TagLabelAtlas); Background = new CCSprite(TestResource.s_back3); AddChild(Background, 5); // Add event listeners var listener = new CCEventListenerTouchAllAtOnce(); listener.OnTouchesBegan = OnTouchesBegan; listener.OnTouchesMoved = OnTouchesMoved; listener.OnTouchesEnded = OnTouchesEnded; AddEventListener(listener); coloredBackground = new CCLayerColor(new CCColor4B(127, 127, 127, 255)); AddChild(coloredBackground, 4); }
public override void OnEnter() { base.OnEnter(); CCLayerColor background = new CCLayerColor(new CCColor4B(255,0,0,255)); AddChild(background, -10); }
public TMXUncompressedTest() { CCLayerColor color = new CCLayerColor(new CCColor4B(64, 64, 64, 255)); AddChild(color, -1); CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/iso-test2-uncompressed"); AddChild(map, 0, kTagTileMap); CCSize s = map.ContentSize; // move map to the center of the screen CCSize ms = map.MapSize; CCSize ts = map.TileSize; map.RunAction(new CCMoveTo (1.0f, new CCPoint(-ms.Width * ts.Width / 2, -ms.Height * ts.Height / 2))); /* // testing release map CCArray* pChildrenArray = map.getChildren(); CCTMXLayer layer; object* pObject = NULL; CCARRAY_FOREACH(pChildrenArray, pObject) { layer = (CCTMXLayer) pObject; if (!layer) break; layer.releaseMap(); } */ }
public override void OnEnter() { base.OnEnter(); var s = Layer.VisibleBoundsWorldspace.Size; var layer1 = new CCLayerColor(new CCColor4B(192, 0, 0, 255)); layer1.IsColorCascaded = false; layer1.Position = new CCPoint(0, s.Height / 2); var sister1 = new CCSprite("Images/grossinis_sister1.png"); var sister2 = new CCSprite("Images/grossinis_sister2.png"); var label = new CCLabelBMFont("Test", "fonts/bitmapFontTest.fnt"); // by default a CCLabelBMFont has IsColorModifiedByOpacity on by default if the // texture atlas is PreMultipliedAlpha. Label as used by Cocos2d-x by default has // this set to false. Maybe this is a bug in Cocos2d-x? label.IsColorModifiedByOpacity = false; layer1.AddChild(sister1); layer1.AddChild(sister2); layer1.AddChild(label); this.AddChild(layer1, 0, kTagLayer); sister1.Position = new CCPoint(s.Width * 1 / 3, 0); sister2.Position = new CCPoint(s.Width * 2 / 3, 0); label.Position = new CCPoint(s.Width / 2, 0); // Define our delay time var delay = new CCDelayTime (1); layer1.RepeatForever( new CCFadeTo(4, 0), new CCFadeTo(4, 255), delay ); // We only have to define them once. var fadeTo11 = new CCFadeTo (2, 0); var fadeTo12 = new CCFadeTo (2, 255); sister1.RepeatForever( fadeTo11, fadeTo12, fadeTo11, fadeTo12, delay ); // Enable cascading in scene SetEnableRecursiveCascading(this, true); }
public SystemFontTest() { size = Layer.VisibleBoundsWorldspace.Size; CCMenuItemImage item1 = new CCMenuItemImage(TestResource.s_pPathB1, TestResource.s_pPathB2, backCallback); CCMenuItemImage item2 = new CCMenuItemImage(TestResource.s_pPathR1, TestResource.s_pPathR2, restartCallback); CCMenuItemImage item3 = new CCMenuItemImage(TestResource.s_pPathF1, TestResource.s_pPathF2, nextCallback); CCMenu menu = new CCMenu(item1, item2, item3); menu.Position = CCPoint.Zero; item1.Position = new CCPoint(size.Width / 2 - item2.ContentSize.Width * 2, item2.ContentSize.Height / 2); item2.Position = new CCPoint(size.Width / 2, item2.ContentSize.Height / 2); item3.Position = new CCPoint(size.Width / 2 + item2.ContentSize.Width * 2, item2.ContentSize.Height / 2); AddChild(menu, 1); blockSize = new CCSize(size.Width / 3, 200); var leftColor = new CCLayerColor(new CCColor4B(100, 100, 100, 255)); var centerColor = new CCLayerColor(new CCColor4B(200, 100, 100, 255)); var rightColor = new CCLayerColor(new CCColor4B(100, 100, 200, 255)); leftColor.IgnoreAnchorPointForPosition = false; centerColor.IgnoreAnchorPointForPosition = false; rightColor.IgnoreAnchorPointForPosition = false; leftColor.AnchorPoint = CCPoint.AnchorMiddleLeft; centerColor.AnchorPoint = CCPoint.AnchorMiddleLeft; rightColor.AnchorPoint = CCPoint.AnchorMiddleLeft; leftColor.Position = new CCPoint(0, size.Height / 2); centerColor.Position = new CCPoint(blockSize.Width, size.Height / 2); rightColor.Position = new CCPoint(blockSize.Width * 2, size.Height / 2); AddChild(leftColor, -1); AddChild(rightColor, -1); AddChild(centerColor, -1); showFont(SystemFontTestScene.restartAction()); }
public TMXUncompressedTest() : base("TileMaps/iso-test2-uncompressed") { CCLayerColor color = new CCLayerColor(new CCColor4B(64, 64, 64, 255)); AddChild(color, -1); // move map to the center of the screen var ms = tileMap.MapDimensions; var ts = tileMap.TileTexelSize; tileLayersContainer.RunAction(new CCMoveTo (1.0f, new CCPoint(-ms.Column * ts.Width / 2, -ms.Row * ts.Height / 2))); }
public TMXIsoTest1() : base("TileMaps/iso-test11") { CCLayerColor color = new CCLayerColor(new CCColor4B(64, 64, 64, 255)); AddChild(color, -1); tileMap.AnchorPoint = CCPoint.AnchorMiddle; }
public TMXHexTest() : base("TileMaps/hexa-test1") { CCLayerColor color = new CCLayerColor(new CCColor4B(64, 64, 64, 255)); AddChild(color, -1); drawNode = new CCDrawNode(); tileLayersContainer.AddChild(drawNode); var touchListener = new CCEventListenerTouchOneByOne(); touchListener.OnTouchBegan = OnTouchBegan; AddEventListener(touchListener); }
public override void OnEnter () { base.OnEnter (); CCRect visibleBounds = VisibleBoundsWorldspace; var origin = Layer.VisibleBoundsWorldspace.Origin; var size = Layer.VisibleBoundsWorldspace.Size; var sprite1 = new TouchableSprite (); var texture = CCTextureCache.SharedTextureCache.AddImage("Images/CyanSquare.png"); sprite1.Texture = texture; sprite1.Position = origin + new CCPoint (size.Width / 2, size.Height / 2) + new CCPoint (-80, 80); AddChild(sprite1, -10); var sprite2 = new TouchableSprite (); texture = CCTextureCache.SharedTextureCache.AddImage("Images/MagentaSquare.png"); sprite2.Texture = texture; sprite2.Position = origin + new CCPoint (size.Width / 2, size.Height / 2); AddChild(sprite2, -20); var sprite3 = new TouchableSprite (); texture = CCTextureCache.SharedTextureCache.AddImage("Images/YellowSquare.png"); sprite3.Texture = texture; sprite3.Position = CCPoint.Zero; sprite2.AddChild(sprite3, -1); CCMenuItemFont.FontSize = 20; CCMenuItemFont.FontName = "arial"; var popup = new CCMenuItemFont("Popup", (sender) => { this.PauseListeners(true); var colorLayer = new CCLayerColor(new CCColor4B(0, 0, 255, 100)); AddChild(colorLayer, 99999); var closeItem = new CCMenuItemFont("close", (closeSender) => { colorLayer.RemoveFromParent(); this.ResumeListeners(true); }); closeItem.Position = visibleBounds.Center; var closeMenu = new CCMenu(closeItem); closeMenu.AnchorPoint = CCPoint.AnchorLowerLeft; closeMenu.Position = CCPoint.Zero; colorLayer.AddChild(closeMenu); }); popup.AnchorPoint = CCPoint.AnchorMiddleRight; popup.Position = new CCPoint(visibleBounds.Origin.X + visibleBounds.Size.Width, visibleBounds.Origin.Y + visibleBounds.Size.Height / 2); var menu = new CCMenu(popup); menu.AnchorPoint = CCPoint.AnchorLowerLeft; menu.Position = CCPoint.Zero; AddChild(menu); }
public override void OnEnter() { base.OnEnter(); var s = Layer.VisibleBoundsWorldspace.Size; var layer1 = new CCLayerColor(new CCColor4B(192, 0, 0, 255)); layer1.IsColorCascaded = false; layer1.Position = new CCPoint(0, s.Height / 2); var sister1 = new CCSprite("Images/grossinis_sister1.png"); var sister2 = new CCSprite("Images/grossinis_sister2.png"); var label = new CCLabelBMFont("Test", "fonts/bitmapFontTest.fnt"); layer1.AddChild(sister1); layer1.AddChild(sister2); layer1.AddChild(label); this.AddChild(layer1, 0, kTagLayer); sister1.Position = new CCPoint(s.Width * 1 / 3, 0); sister2.Position = new CCPoint(s.Width * 2 / 3, 0); label.Position = new CCPoint(s.Width / 2, 0); // Define our delay time var delay = new CCDelayTime (1); layer1.RepeatForever ( new CCTintTo(6, 255, 0, 255), new CCTintTo(6, 255, 255, 255), delay ); sister1.RepeatForever ( new CCTintTo(2, 255, 255, 0), new CCTintTo(2, 255, 255, 255), new CCTintTo(2, 0, 255, 255), new CCTintTo(2, 255, 255, 255), new CCTintTo(2, 255, 0, 255), new CCTintTo(2, 255, 255, 255), delay ); }