Esempio n. 1
0
        public virtual CCTableViewCell TableCellAtIndex(CCTableView table, int idx)
        {
            string str  = idx.ToString();
            var    cell = table.DequeueCell();

            if (cell == null)
            {
                cell = new CustomTableViewCell();
                var sprite = new CCSprite("Images/Icon");
                sprite.AnchorPoint = CCPoint.Zero;
                sprite.Position    = new CCPoint(0, 0);
                cell.AddChild(sprite);

                var label = new CCLabelTtf(str, "Helvetica", 20.0f);
                label.Position    = CCPoint.Zero;
                label.AnchorPoint = CCPoint.Zero;
                label.Tag         = 123;
                cell.AddChild(label);
            }
            else
            {
                var label = (CCLabelTtf)cell.GetChildByTag(123);
                label.Text = (str);
            }


            return(cell);
        }
Esempio n. 2
0
        public GameScene(CCWindow mainWindow) : base(mainWindow)
        {
            mainLayer = new CCLayer();
            AddChild(mainLayer);

            paddleSprite           = new CCSprite("paddle");
            paddleSprite.PositionX = 100;
            paddleSprite.PositionY = 100;
            mainLayer.AddChild(paddleSprite);

            ballSprite           = new CCSprite("ball");
            ballSprite.PositionX = 320;
            ballSprite.PositionY = 600;
            mainLayer.AddChild(ballSprite);

            scoreLabel             = new CCLabelTtf("Score: 0", "arial", 22);
            scoreLabel.PositionX   = mainLayer.VisibleBoundsWorldspace.MinX + 20;
            scoreLabel.PositionY   = mainLayer.VisibleBoundsWorldspace.MaxY - 20;
            scoreLabel.AnchorPoint = CCPoint.AnchorUpperLeft;

            mainLayer.AddChild(scoreLabel);

            Schedule(RunGameLogic);

            touchListener = new CCEventListenerTouchAllAtOnce();
            touchListener.OnTouchesMoved = HandleTouchesMoved;
            AddEventListener(touchListener, this);
        }
Esempio n. 3
0
        public GameOverLayer(int score)
        {
            var touchListener = new CCEventListenerTouchAllAtOnce();

            touchListener.OnTouchesEnded = (touches, ccevent) => CCDirector.SharedDirector.ReplaceScene(GameLayer.Scene);

            EventDispatcher.AddEventListener(touchListener, this);

            string scoreMessage = String.Format("Game Over. You collected {0} bananas!", score);

            var scoreLabel = new CCLabelTtf(scoreMessage, "MarkerFelt", 22)
            {
                Position            = new CCPoint(CCDirector.SharedDirector.WinSize.Center.X, CCDirector.SharedDirector.WinSize.Center.Y + 50),
                Color               = new CCColor3B(CCColor4B.Yellow),
                HorizontalAlignment = CCTextAlignment.Center,
                VerticalAlignment   = CCVerticalTextAlignment.Center,
                Dimensions          = ContentSize
            };

            AddChild(scoreLabel);

            var playAgainLabel = new CCLabelTtf("Tap to Play Again", "MarkerFelt", 22)
            {
                Position            = CCDirector.SharedDirector.WinSize.Center,
                Color               = new CCColor3B(CCColor4B.Green),
                HorizontalAlignment = CCTextAlignment.Center,
                VerticalAlignment   = CCVerticalTextAlignment.Center,
                Dimensions          = ContentSize
            };

            AddChild(playAgainLabel);

            Color   = new CCColor3B(CCColor4B.Black);
            Opacity = 255;
        }
Esempio n. 4
0
        private bool InitOrientationTest()
        {
            bool bRet = false;

            do
            {
                CCSize s = Layer.VisibleBoundsWorldspace.Size;

                CCLabelTtf label = new CCLabelTtf(title(), "Arial", 26);
                AddChild(label, 1);
                label.Position = new CCPoint(s.Width / 2, s.Height - 50);

                string sSubtitle = subtitle();
                if (sSubtitle.Length > 0)
                {
                    CCLabelTtf l = new CCLabelTtf(sSubtitle, "Arial", 16);
                    AddChild(l, 1);
                    l.Position = new CCPoint(s.Width / 2, s.Height - 80);
                }

                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  = new CCPoint();
                item1.Position = new CCPoint(s.Width / 2 - 100, 30);
                item2.Position = new CCPoint(s.Width / 2, 30);
                item3.Position = new CCPoint(s.Width / 2 + 100, 30);

                bRet = true;
            } while (false);

            return(bRet);
        }
Esempio n. 5
0
        public LabelSFOldNew()
        {
            // CCLabel SpriteFont
            label1 = new CCLabel("SpriteFont Label Test", "arial", 48, CCLabelFormat.SpriteFont);

            AddChild(label1);

            label2             = new CCLabelTtf("SpriteFont Label Test", "arial", 48);
            label2.Color       = CCColor3B.Red;
            label2.AnchorPoint = CCPoint.AnchorMiddle;

            AddChild(label2);

            drawNode = new CCDrawNode();
            AddChild(drawNode);

            var touchListener = new CCEventListenerTouchAllAtOnce();

            touchListener.OnTouchesEnded = (touches, touchEvent) =>
            {
                var location = touches[0].Location;

                if (label1.BoundingBoxTransformedToWorld.ContainsPoint(location))
                {
                    CCLog.Log("Hit");
                }
            };
            AddEventListener(touchListener);
        }
Esempio n. 6
0
        public void showFont(string pFont)
        {
            float fontSize = 26;

            RemoveChildByTag(kTagLabel1, true);
            RemoveChildByTag(kTagLabel2, true);
            RemoveChildByTag(kTagLabel3, true);
            RemoveChildByTag(kTagLabel4, true);

            var top  = new CCLabelTtf(pFont, "Arial", 24);
            var left = new CCLabelTtf("alignment left", pFont, fontSize,
                                      blockSize, CCTextAlignment.Left,
                                      FontTestScene.verticalAlignment[FontTestScene.verticalAlignIdx]);
            var center = new CCLabelTtf("alignment center", pFont, fontSize,
                                        blockSize, CCTextAlignment.Center,
                                        FontTestScene.verticalAlignment[FontTestScene.verticalAlignIdx]);
            var right = new CCLabelTtf("alignment right", pFont, fontSize,
                                       blockSize, CCTextAlignment.Right,
                                       FontTestScene.verticalAlignment[FontTestScene.verticalAlignIdx]);

            top.AnchorPoint    = CCPoint.AnchorMiddleTop;
            left.AnchorPoint   = CCPoint.AnchorMiddleLeft;
            center.AnchorPoint = CCPoint.AnchorMiddleLeft;
            right.AnchorPoint  = CCPoint.AnchorMiddleLeft;

            top.Position    = TitleLabel.Position - new CCPoint(0, 20);
            left.Position   = new CCPoint(0, visibleRect.Height / 2);
            center.Position = new CCPoint(blockSize.Width, visibleRect.Height / 2);
            right.Position  = new CCPoint(blockSize.Width * 2, visibleRect.Height / 2);

            AddChild(left, 0, kTagLabel1);
            AddChild(right, 0, kTagLabel2);
            AddChild(center, 0, kTagLabel3);
            AddChild(top, 0, kTagLabel4);
        }
Esempio n. 7
0
 public virtual void setSceneTitleLabel(CCLabelTtf var)
 {
     if (m_pSceneTitleLabel != var)
     {
         m_pSceneTitleLabel = var;
     }
 }
Esempio n. 8
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            CCLabelTtf label = new CCLabelTtf(title(), "arial", 40);

            label.AnchorPoint = new CCPoint(0.5f, 0.5f);
            AddChild(label, 1);
            label.Position = (new CCPoint(s.Width / 2, s.Height - 50));

            CCMenuItemImage item1 = new CCMenuItemImage(s_pPathB1, s_pPathB2, backCallback);
            CCMenuItemImage item2 = new CCMenuItemImage(s_pPathR1, s_pPathR2, restartCallback);
            CCMenuItemImage item3 = new CCMenuItemImage(s_pPathF1, s_pPathF2, nextCallback);

            CCMenu menu = new CCMenu(item1, item2, item3);

            float padding          = 10.0f;
            float halfRestartWidth = item2.ContentSize.Width / 2.0f;

            menu.Position = (new CCPoint(0, 0));

            // Anchor point of menu items is 0.5, 0.5 by default
            item1.Position = (new CCPoint(s.Width / 2 - item1.ContentSize.Width / 2.0f - halfRestartWidth - padding, item2.ContentSize.Height + padding));
            item2.Position = (new CCPoint(s.Width / 2, item2.ContentSize.Height + padding));
            item3.Position = (new CCPoint(s.Width / 2 + item3.ContentSize.Width / 2.0f + halfRestartWidth + padding, item2.ContentSize.Height + padding));

            AddChild(menu, TestScene.MENU_LEVEL);
        }
Esempio n. 9
0
        public IntroLayer()
        {
            // create and initialize a Label
            label             = new CCLabelTtf("0", "MarkerFelt", 22);
            label.AnchorPoint = CCPoint.AnchorMiddleTop;
            label.PositionY   = VisibleBoundsWorldspace.MaxY - 20;

            // add the label as a child to this Layer
            AddChild(label);

            paddleSprite           = new CCSprite("paddle");
            paddleSprite.PositionX = 100;
            paddleSprite.PositionY = 100;

            AddChild(paddleSprite);

            ballSprite           = new CCSprite("ball");
            ballSprite.PositionX = 320;
            ballSprite.PositionY = 640;

            AddChild(ballSprite);

            // setup our color for the background
            Color   = new CCColor3B(CCColor4B.Blue);
            Opacity = 255;
        }
Esempio n. 10
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            Box2DView view = Box2DView.viewWithEntryID(m_entryID);

            AddChild(view, 0, kTagBox2DNode);
            view.Scale       = 8;
            view.AnchorPoint = new CCPoint(0, 0);
            view.Position    = new CCPoint(s.Width / 2, s.Height / 4);

            //#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
            //    CCLabelBMFont* label = new CCLabelBMFont(view.title().c_str(),  "fonts/arial16.fnt");
            //#else
            CCLabelTtf label = new CCLabelTtf(view.title(), "arial", 18);

            //#endif
            AddChild(label, 1);
            label.Position = new CCPoint(s.Width / 2, s.Height - 30);

            CCMenuItemImage item1 = new CCMenuItemImage("Images/b1", "Images/b2", backCallback);
            CCMenuItemImage item2 = new CCMenuItemImage("Images/r1", "Images/r2", restartCallback);
            CCMenuItemImage item3 = new CCMenuItemImage("Images/f1", "Images/f2", nextCallback);

            CCMenu menu = new CCMenu(item1, item2, item3);

            menu.Position  = CCPoint.Zero;
            item1.Position = new CCPoint(s.Width / 2 - 100, 30);
            item2.Position = new CCPoint(s.Width / 2, 30);
            item3.Position = new CCPoint(s.Width / 2 + 100, 30);

            AddChild(menu, 1);
        }
Esempio n. 11
0
        public override void OnEnter()
        {
            //
            // This test MUST be done in 'onEnter' and not on 'init'
            // otherwise the paused action will be resumed at 'onEnter' time
            //
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            CCLabelTtf l = new CCLabelTtf("After 5 seconds grossini should move", "arial", 16);

            AddChild(l);
            l.Position = (new CCPoint(s.Width / 2, 245));


            //
            // Also, this test MUST be done, after [super onEnter]
            //
            CCSprite grossini = new CCSprite(s_pPathGrossini);

            AddChild(grossini, 0, kTagGrossini);
            grossini.Position = (new CCPoint(200, 200));

            CCAction action = new CCMoveBy(1, new CCPoint(150, 0));

            grossini.AddAction(action, true);

            Schedule(unpause, 3);
        }
Esempio n. 12
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            // Title
            CCLabelTtf label = new CCLabelTtf(title(), "arial", 38);

            AddChild(label, 1);
            label.Position = new CCPoint(s.Width / 2, s.Height - 32);
            label.Color    = new CCColor3B(255, 255, 40);

            // Subtitle
            string strSubTitle = subtitle();

            if (strSubTitle.Length > 0)
            {
                CCLabelTtf l = new CCLabelTtf(strSubTitle, "Thonburi", 16);
                AddChild(l, 1);
                l.Position = new CCPoint(s.Width / 2, s.Height - 80);
            }

            performTests();
        }
Esempio n. 13
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            CCLabelTtf label = new CCLabelTtf(title(), "arial", 32);

            AddChild(label);
            label.Position = (new CCPoint(s.Width / 2, s.Height - 50));

            string subTitle = subtitle();

            if (!string.IsNullOrEmpty(subTitle))
            {
                CCLabelTtf l = new CCLabelTtf(subTitle, "arial", 16);
                AddChild(l, 1);
                l.Position = new CCPoint(s.Width / 2, s.Height - 80);
            }

            CCMenuItemImage item1 = new CCMenuItemImage("Images/b1", "Images/b2", backCallback);
            CCMenuItemImage item2 = new CCMenuItemImage("Images/r1", "Images/r2", restartCallback);
            CCMenuItemImage item3 = new CCMenuItemImage("Images/f1", "Images/f2", nextCallback);

            CCMenu menu = new CCMenu(item1, item2, item3);

            menu.Position  = new CCPoint(0, 0);
            item1.Position = new CCPoint(s.Width / 2 - 100, 30);
            item2.Position = new CCPoint(s.Width / 2, 30);
            item3.Position = new CCPoint(s.Width / 2 + 100, 30);

            AddChild(menu, 1);
        }
Esempio n. 14
0
 public virtual void setDisplayValueLabel(CCLabelTtf var)
 {
     if (m_pDisplayValueLabel != var)
     {
         m_pDisplayValueLabel = var;
     }
 }
Esempio n. 15
0
        public override void OnEnter()
        {
            base.OnEnter();

            var listener = new CCEventListenerTouchAllAtOnce();

            listener.OnTouchesEnded = onTouchesEnded;

            AddEventListener(listener);

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            // init physics
            initPhysics();
            // create reset button
            createResetButton();

            addNewSpriteAtPosition(new CCPoint(s.Width / 2, s.Height / 2));

            CCLabelTtf label = new CCLabelTtf("Tap screen", "MarkerFelt", 32);

            AddChild(label, 0);
            label.Color    = new CCColor3B(0, 0, 255);
            label.Position = new CCPoint(s.Width / 2, s.Height - 50);

            Schedule();
        }
Esempio n. 16
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            CCLabelTtf label = new CCLabelTtf(title(), "arial", 26);

            AddChild(label, 1);
            label.Position = (new CCPoint(s.Width / 2, s.Height - 50));

            string strSubTitle = subtitle();

            if (strSubTitle.Length > 0)
            {
                CCLabelTtf l = new CCLabelTtf(strSubTitle, "Thonburi", 16);
                AddChild(l, 1);
                l.Position = (new CCPoint(s.Width / 2, s.Height - 80));
            }

            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  = (new CCPoint(0, 0));
            item1.Position = (new CCPoint(s.Width / 2 - 100, 30));
            item2.Position = (new CCPoint(s.Width / 2, 30));
            item3.Position = (new CCPoint(s.Width / 2 + 100, 30));
            AddChild(menu, 1);
        }
Esempio n. 17
0
        public override void OnEnter()
        {
            base.OnEnter();

            var origin = Layer.VisibleBoundsWorldspace.Origin;
            var size   = Layer.VisibleBoundsWorldspace.Size;

            var statusLabel = new CCLabelTtf("No keyboard event received!", "arial", 20);

            statusLabel.Position = origin + size.Center;
            AddChild(statusLabel);

            // Create our Keyboard Listener
            var listener = new CCEventListenerKeyboard();

            // We will use Lambda expressions to attach the event process
            listener.OnKeyPressed = (keyboardEvent) => {
                var labelText = string.Format("Key {0} was pressed.", keyboardEvent.Keys);
                statusLabel.Text = labelText;
            };
            listener.OnKeyReleased = (keyboardEvent) => {
                var labelText = string.Format("Key {0} was released.", keyboardEvent.Keys);
                statusLabel.Text = labelText;
            };

            // Now we tell the event dispatcher that the status label is interested in keyboard events
            statusLabel.AddEventListener(listener);
        }
Esempio n. 18
0
        protected override void AddedToScene()
        {
            base.AddedToScene();

            Scene.SceneResolutionPolicy = CCSceneResolutionPolicy.ShowAll;

            var scoreLabel = new CCLabelTtf(scoreMessage, "arial", 24)
            {
                Position            = new CCPoint(VisibleBoundsWorldspace.Size.Center.X, VisibleBoundsWorldspace.Size.Center.Y + 50),
                Color               = new CCColor3B(CCColor4B.Yellow),
                HorizontalAlignment = CCTextAlignment.Center,
                VerticalAlignment   = CCVerticalTextAlignment.Center,
                AnchorPoint         = CCPoint.AnchorMiddle
            };

            AddChild(scoreLabel);

            var playAgainLabel = new CCLabelTtf("Tap to Play Again and give your monkey an another chance :)", "arial", 24)
            {
                Position            = VisibleBoundsWorldspace.Size.Center,
                Color               = new CCColor3B(CCColor4B.Green),
                HorizontalAlignment = CCTextAlignment.Center,
                VerticalAlignment   = CCVerticalTextAlignment.Center,
                AnchorPoint         = CCPoint.AnchorMiddle,
            };

            AddChild(playAgainLabel);

            AddMonkey();
        }
Esempio n. 19
0
        protected override void AddedToScene()
        {
            base.AddedToScene();

            Scene.SceneResolutionPolicy = CCSceneResolutionPolicy.ShowAll;


            var label = new CCLabelTtf($"GAME OVER\n\nSCORE:\n{Score}", "arial", 40)
            {
                Color = CCColor3B.Orange,
                HorizontalAlignment = CCTextAlignment.Center,
                VerticalAlignment   = CCVerticalTextAlignment.Center,
                AnchorPoint         = CCPoint.AnchorMiddle,
                PositionX           = VisibleBoundsWorldspace.Center.X,
                PositionY           = VisibleBoundsWorldspace.Center.Y + 200,
            };

            AddChild(label);

            OkButton = new Button("OK")
            {
                Position = VisibleBoundsWorldspace.Center,
            };

            OkButton.Triggered += OnStartAgain;
            AddChild(OkButton);
        }
Esempio n. 20
0
        public override void OnEnter()
        {
            base.OnEnter();


            QUERY_START = new cpVect(320, 240);

            font          = GetDefaultFontTtf("TEST");
            font.Position = new CCPoint((float)windowSize.Width * .5f, 10);
            InformationLayer.AddChild(font);
            font.Scale = .5f;

            space.SetIterations(5);

            {             // add a fat segment
                var    mass = 1;
                var    length = 100;
                cpVect a = new cpVect(-length / 2, 0), b = new cpVect(length / 2, 0);

                var body = space.AddBody(new cpBody(mass, cp.MomentForSegment(mass, a, b, 0.0f)));
                body.SetPosition(new cpVect(0.0f, 100.0f));

                space.AddShape(new cpSegmentShape(body, a, b, 20));
            }

            {             // add a static segment
                space.AddShape(new cpSegmentShape(space.GetStaticBody(), new cpVect(0, 300), new cpVect(300, 0), 0));
            }

            {             // add a pentagon
                float mass      = 1;
                int   NUM_VERTS = 5;

                cpVect[] verts = new cpVect[NUM_VERTS];
                for (int i = 0; i < NUM_VERTS; i++)
                {
                    float angle = -2 * cp.M_PI * i / (NUM_VERTS);
                    verts[i] = cpVect.cpv(30 * cp.cpfcos(angle), 30 * cp.cpfsin(angle));
                }


                var body = space.AddBody(new cpBody(mass, cp.MomentForPoly(mass, NUM_VERTS, verts, cpVect.Zero, 0.0f)));
                body.SetPosition(new cpVect(50.0f, 30.0f));

                space.AddShape(new cpPolyShape(body, NUM_VERTS, verts, cpTransform.Identity, 10f));
            }

            {             // add a circle
                var mass = 1;
                var r    = 20;

                var body = space.AddBody(new cpBody(mass, cp.MomentForCircle(mass, 0, r, new cpVect(0, 0))));
                body.SetPosition(new cpVect(100.0f, 100.0f));

                space.AddShape(new cpCircleShape(body, r, cpVect.Zero));
            }

            Schedule();
        }
Esempio n. 21
0
 public TTFFontInit()
 {
     font          = new CCLabelTtf();
     font.FontName = "MarkerFelt";
     font.FontSize = 38;
     font.Text     = ("It is working!");
     AddChild(font);
 }
Esempio n. 22
0
        public static CCLabelTtf PCLLabel(string message)
        {
            var label = new CCLabelTtf(message, "MarkerFelt", 22);

            label.Color    = CCColor3B.White;
            label.Position = CCDrawManager.VisibleSize.Center;
            return(label);
        }
Esempio n. 23
0
        public Bug624Layer2()
        {
            CCSize     size  = Layer.VisibleBoundsWorldspace.Size;
            CCLabelTtf label = new CCLabelTtf("Layer2", "MarkerFelt", 36);

            label.Position = new CCPoint(size.Width / 2, size.Height / 2);
            AddChild(label);
            Schedule(switchLayer, 5.0f);
        }
Esempio n. 24
0
        protected override void AddedToScene()
        {
            base.AddedToScene();

            //Init Game Elements
            _player1Score = 0;
            _player2Score = 0;


            //get screen size
            _screenSize = Window.WindowSizeInPixels;             //CCDirector::sharedDirector()->getWinSize();

            //1. add court image
            GameSprite court = new GameSprite("court");                                          // CCSprite::create("court.png");

            court.SetPosition(new CCPoint(_screenSize.Width * 0.5f, _screenSize.Height * 0.5f)); //->setPosition(ccp());

            AddChild(court);

            //2. add players
            _player1 = new GameSprite("mallet");             //GameSprite::gameSpriteWithFile("mallet.png");
            _player1.SetPosition(new CCPoint(_screenSize.Width * 0.5f, _player1.RotationX * 2f));

            AddChild(_player1, 0, kPlayer1Tag);

            _player2 = new GameSprite("mallet");
            _player2.SetPosition(new CCPoint(_screenSize.Width * 0.5f, _screenSize.Height - _player1.RotationX * 2));
            AddChild(_player2, 0, kPlayer2Tag);

            _players = new GameSprite[] { _player1, _player2 };            // CCArray::create(_player1, _player2, NULL);

            //3. add puck
            _ball = new GameSprite("puck");
            _ball.SetPosition(new CCPoint(_screenSize.Width * 0.5f, _screenSize.Height * 0.5f - 2f * _ball.RotationX));
            AddChild(_ball);

            //4. add score display
            _player1ScoreLabel          = new CCLabelTtf("0", "MarkerFelt", 22);
            _player1ScoreLabel.Position = new CCPoint(_screenSize.Width - 60f, _screenSize.Height * 0.5f - 80f);
            _player1ScoreLabel.Rotation = 90;
            AddChild(_player1ScoreLabel);

            _player2ScoreLabel          = new CCLabelTtf("0", "MarkerFelt", 22);
            _player2ScoreLabel.Position = new CCPoint(_screenSize.Width - 60f, _screenSize.Height * 0.5f + 80f);
            _player2ScoreLabel.Rotation = 90;
            AddChild(_player2ScoreLabel);

            //listen for touches
            CCEventListenerTouchAllAtOnce tListener = new CCEventListenerTouchAllAtOnce();

            tListener.OnTouchesBegan = TouchesBegan;
            tListener.OnTouchesEnded = TouchesEnded;
            tListener.OnTouchesMoved = TouchesMoved;
            AddEventListener(tListener, this);

            Schedule(Update);
        }
Esempio n. 25
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize     size  = Layer.VisibleBoundsWorldspace.Size;
            CCLabelTtf label = new CCLabelTtf("cocos2d", "arial", 64);

            label.Position    = size.Center;
            label.AnchorPoint = CCPoint.AnchorMiddle;
            AddChild(label);
        }
Esempio n. 26
0
        public void updateQuantityLabel()
        {
            if (quantityOfNodes != lastRenderedCount)
            {
                CCLabelTtf infoLabel = (CCLabelTtf)GetChildByTag(PerformanceNodeChildrenTest.kTagInfoLayer);
                infoLabel.Text = (string.Format("{0} nodes", quantityOfNodes));

                lastRenderedCount = quantityOfNodes;
            }
        }
Esempio n. 27
0
        private void label(string p)
        {
            CCLabelTtf tmp = GetDefaultFontTtf(p);

            tmp.Position = boxOffset.ToCCPoint();
            tmp.Scale    = 0.5f;
            tmp.Position = new CCPoint(tmp.PositionX + 70, tmp.PositionY + 100);

            AddChild(tmp);
        }
Esempio n. 28
0
        public virtual void initWithQuantityOfNodes(int nNodes)
        {
            //srand(time());
            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            // Title
            CCLabelTtf label = new CCLabelTtf(title(), "arial", 32);

            AddChild(label, 1);
            label.Position = new CCPoint(s.Width / 2, s.Height - 32);
            label.Color    = new CCColor3B(255, 255, 40);

            // Subtitle
            string strSubTitle = subtitle();

            if (strSubTitle.Length > 0)
            {
                CCLabelTtf l = new CCLabelTtf(strSubTitle, "arial", 16);
                AddChild(l, 1);
                l.Position = new CCPoint(s.Width / 2, s.Height - 80);
            }

            lastRenderedCount      = 0;
            currentQuantityOfNodes = 0;
            quantityOfNodes        = nNodes;

            CCMenuItemFont.FontSize = 64;
            CCMenuItemFont.FontName = "arial";

            CCMenuItemFont decrease = new CCMenuItemFont(" - ", onDecrease);

            decrease.Color = new CCColor3B(0, 200, 20);
            CCMenuItemFont increase = new CCMenuItemFont(" + ", onIncrease);

            increase.Color = new CCColor3B(0, 200, 20);

            CCMenu menu = new CCMenu(decrease, increase);

            menu.AlignItemsHorizontally();
            menu.Position = new CCPoint(s.Width / 2, s.Height / 2 + 15);
            AddChild(menu, 1);

            CCLabelTtf infoLabel = new CCLabelTtf("0 nodes", "arial", 30);

            infoLabel.Color    = new CCColor3B(0, 200, 20);
            infoLabel.Position = new CCPoint(s.Width / 2, s.Height / 2 - 15);
            AddChild(infoLabel, 1, PerformanceNodeChildrenTest.kTagInfoLayer);

            NodeChildrenMenuLayer pMenu = new NodeChildrenMenuLayer(true, PerformanceNodeChildrenTest.TEST_COUNT, PerformanceNodeChildrenTest.s_nCurCase);

            AddChild(pMenu);

            updateQuantityLabel();
            updateQuantityOfNodes();
        }
Esempio n. 29
0
        public void updateNodes()
        {
            if (quantityNodes != lastRenderedCount)
            {
                CCLabelTtf infoLabel = (CCLabelTtf)GetChildByTag(PerformanceSpriteTest.kTagInfoLayer);
                var        str       = string.Format("{0} nodes", quantityNodes);
                infoLabel.Text = (str);

                lastRenderedCount = quantityNodes;
            }
        }
Esempio n. 30
0
        public LabelTTFMultiline()
        {
            // CCLabelBMFont
            center = new CCLabelTtf("word wrap \"testing\" (bla0) bla1 'bla2' [bla3] (bla4) {bla5} {bla6} [bla7] (bla8) [bla9] 'bla0' \"bla1\"",
                                    "Paint Boy", 32,
                                    CCSize.Zero,
                                    CCTextAlignment.Center);


            AddChild(center);
        }