Ejemplo n.º 1
0
        public AtlasBitmapColor()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            CCLabelBMFont label = null;

            label       = new CCLabelBMFont("Blue", "fonts/bitmapFontTest5.fnt");
            label.Color = ccBLUE;
            AddChild(label);
            label.Position    = new CCPoint(s.Width / 2, s.Height / 4);
            label.AnchorPoint = new CCPoint(0.5f, 0.5f);

            label = new CCLabelBMFont("Red", "fonts/bitmapFontTest5.fnt");
            AddChild(label);
            label.Position    = new CCPoint(s.Width / 2, 2 * s.Height / 4);
            label.AnchorPoint = new CCPoint(0.5f, 0.5f);
            label.Color       = ccRED;

            label = new CCLabelBMFont("G", "fonts/bitmapFontTest5.fnt");
            AddChild(label);
            label.Position    = new CCPoint(s.Width / 2, 3 * s.Height / 4);
            label.AnchorPoint = new CCPoint(0.5f, 0.5f);
            label.Color       = ccGREEN;
            label.Label       = ("Green");
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public BitmapFontMultiLine()
        {
            CCSize s;

            // Left
            label1             = new CCLabelBMFont("Multi line\nLeft", "fonts/bitmapFontTest3.fnt");
            label1.AnchorPoint = new CCPoint(0, 0);
            AddChild(label1, 0, (int)TagSprite.kTagBitmapAtlas1);

            s = label1.ContentSize;

            //CCLOG("content size: %.2fx%.2f", s.width, s.height);
            CCLog.Log("content size: {0,0:2f}x{1,0:2f}", s.Width, s.Height);


            // Center
            label2             = new CCLabelBMFont("Multi line\nCenter", "fonts/bitmapFontTest3.fnt");
            label2.AnchorPoint = new CCPoint(0.5f, 0.5f);
            AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);

            s = label2.ContentSize;
            //CCLOG("content size: %.2fx%.2f", s.width, s.height);
            CCLog.Log("content size: {0,0:2f}x{1,0:2f}", s.Width, s.Height);

            // right
            label3             = new CCLabelBMFont("Multi line\nRight\nThree lines Three", "fonts/bitmapFontTest3.fnt");
            label3.AnchorPoint = new CCPoint(1, 1);
            AddChild(label3, 0, (int)TagSprite.kTagBitmapAtlas3);

            s = label3.ContentSize;
            //CCLOG("content size: %.2fx%.2f", s.width, s.height);
        }
Ejemplo n.º 4
0
        public GameLayer()
        {
            gameSuspended = true;
            var batchnode = GetChild((int)Tags.SpriteManager) as CCSpriteBatchNode;

            InitPlatforms();

            var bird = new CCSprite(batchnode.Texture, new CGRect(608, 16, 44, 32));

            batchnode.Add(bird, 4, (int)Tags.Bird);

            CCSprite bonus;

            for (int i = 0; i < (int)Bonus.NumBonuses; i++)
            {
                bonus = new CCSprite(batchnode.Texture, new CGRect(608 + i * 32, 256, 25, 25));
                batchnode.Add(bonus, 4, (int)Tags.BomusStart + i);
                bonus.Visible = false;
            }

            var scoreLabel = new CCLabelBMFont("0", "Fonts/bitmapFont.fnt")
            {
                Position = new CGPoint(160, 430)
            };

            Add(scoreLabel, 5, (int)Tags.ScoreLabel);
        }
Ejemplo n.º 5
0
        public LabelsEmpty()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            // CCLabelBMFont
            CCLabelBMFont label1 = new CCLabelBMFont("", "fonts/bitmapFontTest3.fnt");

            AddChild(label1, 0, (int)TagSprite.kTagBitmapAtlas1);
            label1.Position = new CCPoint(s.Width / 2, s.Height - 100);

            // CCLabelTTF
            CCLabelTTF label2 = new CCLabelTTF("", "arial", 24);

            AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);
            label2.Position = new CCPoint(s.Width / 2, s.Height / 2);

            // CCLabelAtlas
            CCLabelAtlas label3 = new CCLabelAtlas("", "fonts/tuffy_bold_italic-charmap", 48, 64, ' ');

            AddChild(label3, 0, (int)TagSprite.kTagBitmapAtlas3);
            label3.Position = new CCPoint(s.Width / 2, 0 + 100);

            base.Schedule(updateStrings, 1.0f);

            setEmpty = false;
        }
Ejemplo n.º 6
0
        public LabelFNTOldNew()
        {
            // CCLabel Bitmap Font
            label1       = new CCLabel("Bitmap Font Label Test", "fonts/arial-unicode-26.fnt");
            label1.Scale = 2;
            label1.Color = CCColor3B.White;

            AddChild(label1);

            label2       = new CCLabelBMFont("Bitmap Font Label Test", "fonts/arial-unicode-26.fnt");
            label2.Scale = 2;
            label2.Color = CCColor3B.Red;

            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);
        }
Ejemplo n.º 7
0
        public LabelsEmpty()
        {
            CCSize s = CCDirector.sharedDirector().getWinSize();

            // CCLabelBMFont
            CCLabelBMFont label1 = CCLabelBMFont.labelWithString("", "fonts/fnt/bitmapFontTest3");

            addChild(label1, 0, (int)TagSprite.kTagBitmapAtlas1);
            label1.position = new CCPoint(s.width / 2, s.height - 100);

            // CCLabelTTF
            CCLabelTTF label2 = CCLabelTTF.labelWithString("", "Arial", 24);

            addChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);
            label2.position = new CCPoint(s.width / 2, s.height / 2);

            // CCLabelAtlas
            CCLabelAtlas label3 = CCLabelAtlas.labelWithString("", "fonts/fnt/images/tuffy_bold_italic-charmap", 48, 64, ' ');

            addChild(label3, 0, (int)TagSprite.kTagBitmapAtlas3);
            label3.position = new CCPoint(s.width / 2, 0 + 100);

            base.schedule(updateStrings, 1.0f);

            setEmpty = false;
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
        public AtlasBitmapColor()
        {
            CCSize s = CCDirector.sharedDirector().getWinSize();

            CCLabelBMFont label = null;

            label       = CCLabelBMFont.labelWithString("Blue", "fonts/fnt/bitmapFontTest5");
            label.Color = ccBLUE;
            addChild(label);
            label.position    = new CCPoint(s.width / 2, s.height / 4);
            label.anchorPoint = new CCPoint(0.5f, 0.5f);

            label = CCLabelBMFont.labelWithString("Red", "fonts/fnt/bitmapFontTest5");
            addChild(label);
            label.position    = new CCPoint(s.width / 2, 2 * s.height / 4);
            label.anchorPoint = new CCPoint(0.5f, 0.5f);
            label.Color       = ccRED;

            label = CCLabelBMFont.labelWithString("G", "fonts/fnt/bitmapFontTest5");
            addChild(label);
            label.position    = new CCPoint(s.width / 2, 3 * s.height / 4);
            label.anchorPoint = new CCPoint(0.5f, 0.5f);
            label.Color       = ccGREEN;
            label.setString("Green");
        }
Ejemplo n.º 10
0
        public BMFontUnicode()
        {
            var           data    = CCFileUtils.GetFileData("fonts/strings.plist");
            PlistDocument doc     = new PlistDocument(data);
            var           strings = doc.Root as PlistDictionary;

            string chinese  = strings["chinese1"].AsString;
            string japanese = strings["japanese"].AsString;
            string spanish  = strings["spanish"].AsString;

            CCSize s = CCDirector.SharedDirector.WinSize;

            CCLabelBMFont label1 = new CCLabelBMFont(spanish, "fonts/arial-unicode-26.fnt", 200, CCTextAlignment.Left);

            AddChild(label1);
            label1.Position = new CCPoint(s.Width / 2, s.Height / 4 * 3);

            CCLabelBMFont label2 = new CCLabelBMFont(chinese, "fonts/arial-unicode-26.fnt");

            AddChild(label2);
            label2.Position = new CCPoint(s.Width / 2, s.Height / 4 * 2);

            CCLabelBMFont label3 = new CCLabelBMFont(japanese, "fonts/arial-unicode-26.fnt");

            AddChild(label3);
            label3.Position = new CCPoint(s.Width / 2, s.Height / 4 * 1);
        }
Ejemplo n.º 11
0
        public Atlas5()
        {
            label = new CCLabelBMFont("abcdefg", "fonts/bitmapFontTest4.fnt");
            AddChild(label);

            label.AnchorPoint = CCPoint.AnchorMiddle;
        }
Ejemplo n.º 12
0
        public IntervalLayer()
        {
            m_time0 = m_time1 = m_time2 = m_time3 = m_time4 = 0.0f;

            CCSize s = CCDirector.sharedDirector().getWinSize();

            // sun
            //CCParticleSystem sun = CCParticleSun.node();
            //sun.Texture = CCTextureCache.sharedTextureCache().addImage("Images/fire");
            //sun.position = (new CCPoint(s.width - 32, s.height - 32));

            ////sun.setTotalParticles(130);
            //sun.Life = (0.6f);
            //this.addChild(sun);

            // timers
            m_label0 = CCLabelBMFont.labelWithString("0", "fonts/fnt/bitmapFontTest4");
            m_label1 = CCLabelBMFont.labelWithString("0", "fonts/fnt/bitmapFontTest4");
            m_label2 = CCLabelBMFont.labelWithString("0", "fonts/fnt/bitmapFontTest4");
            m_label3 = CCLabelBMFont.labelWithString("0", "fonts/fnt/bitmapFontTest4");
            m_label4 = CCLabelBMFont.labelWithString("0", "fonts/fnt/bitmapFontTest4");

            base.scheduleUpdate();
            schedule(step1);
            schedule(step2, 0);
            schedule(step3, 1.0f);
            schedule(step4, 2.0f);

            m_label1.position = new CCPoint(s.width * 2 / 6, s.height / 2);
            m_label2.position = new CCPoint(s.width * 3 / 6, s.height / 2);
            m_label3.position = new CCPoint(s.width * 4 / 6, s.height / 2);
            m_label4.position = new CCPoint(s.width * 5 / 6, s.height / 2);

            addChild(m_label0);
            addChild(m_label1);
            addChild(m_label2);
            addChild(m_label3);
            addChild(m_label4);

            // Sprite
            CCSprite sprite = CCSprite.spriteWithFile(s_pPathGrossini);

            sprite.position = new CCPoint(40, 50);

            CCJumpBy jump = CCJumpBy.actionWithDuration(3, new CCPoint(s.width - 80, 0), 50, 4);

            addChild(sprite);
            sprite.runAction(CCRepeatForever.actionWithAction(
                                 (CCActionInterval)(CCSequence.actions(jump, jump.reverse()))
                                 )
                             );
            // pause button
            CCMenuItem item1 = CCMenuItemFont.itemFromString("Pause", this, onPause);
            CCMenu     menu  = CCMenu.menuWithItems(item1);

            menu.position = new CCPoint(s.width / 2, s.height - 50);

            addChild(menu);
        }
Ejemplo n.º 13
0
 public BMFontInit()
 {
     bmFont = new CCLabelBMFont();
     //CCLabelBMFont* bmFont = [CCLabelBMFont create:@"Foo" fntFile:@"arial-unicode-26"];
     bmFont.FntFile = "fonts/helvetica-32.fnt";
     bmFont.Text    = ("It is working!");
     AddChild(bmFont);
 }
Ejemplo n.º 14
0
        public LabelBMFontChinese()
        {
            CCSize size   = CCDirector.SharedDirector.WinSize;
            var    pLable = new CCLabelBMFont("中国", "fonts/bitmapFontChinese.fnt");

            pLable.Position = new CCPoint(size.Width / 2, size.Height / 2);
            AddChild(pLable);
        }
Ejemplo n.º 15
0
        public Issue1343()
        {
            bmFont = new CCLabelBMFont();
            bmFont.FntFile = "fonts/font-issue1343.fnt";
            bmFont.Text = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz.,'");
            AddChild(bmFont);
            bmFont.Scale = 0.3f;

        }
Ejemplo n.º 16
0
        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)));
        }
Ejemplo n.º 17
0
        public BMFontOneAtlas()
        {
            label1 = new CCLabelBMFont("This is Helvetica", "fonts/helvetica-32.fnt", CCLabelBMFont.AutomaticWidth,
                                       CCTextAlignment.Left, CCPoint.Zero);
            AddChild(label1);

            label2 = new CCLabelBMFont("And this is Geneva", "fonts/geneva-32.fnt", CCLabelBMFont.AutomaticWidth,
                                       CCTextAlignment.Left, new CCPoint(0, 128));
            AddChild(label2);
        }
Ejemplo n.º 18
0
        public LabelBMFontHD()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            // CCLabelBMFont
            CCLabelBMFont label1 = new CCLabelBMFont("TESTING RETINA DISPLAY", "fonts/konqa32.fnt");

            AddChild(label1);
            label1.Position = new CCPoint(s.Width / 2, s.Height / 2);
        }
Ejemplo n.º 19
0
        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);
        }
Ejemplo n.º 20
0
        public LabelBMFontHD()
        {
            CCSize s = CCDirector.sharedDirector().getWinSize();

            // CCLabelBMFont
            CCLabelBMFont label1 = CCLabelBMFont.labelWithString("TESTING RETINA DISPLAY", "fonts/fnt/konqa32");

            addChild(label1);
            label1.position = new CCPoint(s.width / 2, s.height / 2);
        }
Ejemplo n.º 21
0
        public Atlas4()
        {
            m_time = 0;

            // Upper Label
            CCLabelBMFont label = CCLabelBMFont.labelWithString("Bitmap Font Atlas", "fonts/fnt/bitmapFontTest");

            addChild(label);

            CCSize s = CCDirector.sharedDirector().getWinSize();

            label.position    = new CCPoint(s.width / 2, s.height / 2);
            label.anchorPoint = new CCPoint(0.5f, 0.5f);


            CCSprite BChar = (CCSprite)label.getChildByTag(0);
            CCSprite FChar = (CCSprite)label.getChildByTag(7);
            CCSprite AChar = (CCSprite)label.getChildByTag(12);


            CCActionInterval rotate    = CCRotateBy.actionWithDuration(2, 360);
            CCAction         rot_4ever = CCRepeatForever.actionWithAction(rotate);

            CCActionInterval   scale       = CCScaleBy.actionWithDuration(2, 1.5f);
            CCFiniteTimeAction scale_back  = scale.reverse();
            CCFiniteTimeAction scale_seq   = CCSequence.actions(scale, scale_back);
            CCAction           scale_4ever = CCRepeatForever.actionWithAction((CCActionInterval)scale_seq);

            CCActionInterval jump       = CCJumpBy.actionWithDuration(0.5f, new CCPoint(), 60, 1);
            CCAction         jump_4ever = CCRepeatForever.actionWithAction(jump);

            CCActionInterval   fade_out   = CCFadeOut.actionWithDuration(1);
            CCActionInterval   fade_in    = CCFadeIn.actionWithDuration(1);
            CCFiniteTimeAction seq        = CCSequence.actions(fade_out, fade_in);
            CCAction           fade_4ever = CCRepeatForever.actionWithAction((CCActionInterval)seq);

            BChar.runAction(rot_4ever);
            BChar.runAction(scale_4ever);
            FChar.runAction(jump_4ever);
            AChar.runAction(fade_4ever);


            // Bottom Label
            CCLabelBMFont label2 = CCLabelBMFont.labelWithString("00.0", "fonts/fnt/bitmapFontTest");

            addChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);
            label2.position = new CCPoint(s.width / 2.0f, 80);

            CCSprite lastChar = (CCSprite)label2.getChildByTag(3);

            lastChar.runAction((CCAction)(rot_4ever.copy()));

            //schedule( schedule_selector(Atlas4::step), 0.1f);
            base.schedule(step, 0.1f);
        }
Ejemplo n.º 22
0
        public Atlas4()
        {
            m_time = 0;

            // Upper Label
            CCLabelBMFont label = new CCLabelBMFont("Bitmap Font Atlas", "fonts/bitmapFontTest.fnt");

            AddChild(label);

            CCSize s = CCDirector.SharedDirector.WinSize;

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


            CCSprite BChar = (CCSprite)label.GetChildByTag(0);
            CCSprite FChar = (CCSprite)label.GetChildByTag(7);
            CCSprite AChar = (CCSprite)label.GetChildByTag(12);


            CCActionInterval rotate    = new CCRotateBy(2, 360);
            CCAction         rot_4ever = new CCRepeatForever(rotate);

            CCActionInterval   scale       = new CCScaleBy(2, 1.5f);
            CCFiniteTimeAction scale_back  = scale.Reverse();
            CCFiniteTimeAction scale_seq   = new CCSequence(scale, scale_back);
            CCAction           scale_4ever = new CCRepeatForever((CCActionInterval)scale_seq);

            CCActionInterval jump       = new CCJumpBy(0.5f, new CCPoint(), 60, 1);
            CCAction         jump_4ever = new CCRepeatForever(jump);

            CCActionInterval   fade_out   = new CCFadeOut(1);
            CCActionInterval   fade_in    = new CCFadeIn(1);
            CCFiniteTimeAction seq        = new CCSequence(fade_out, fade_in);
            CCAction           fade_4ever = new CCRepeatForever((CCActionInterval)seq);

            BChar.RunAction(rot_4ever);
            BChar.RunAction(scale_4ever);
            FChar.RunAction(jump_4ever);
            AChar.RunAction(fade_4ever);


            // Bottom Label
            CCLabelBMFont label2 = new CCLabelBMFont("00.0", "fonts/bitmapFontTest.fnt");

            AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);
            label2.Position = new CCPoint(s.Width / 2.0f, 80);

            CCSprite lastChar = (CCSprite)label2.GetChildByTag(3);

            lastChar.RunAction((CCAction)(rot_4ever.Copy()));

            //schedule( schedule_selector(Atlas4::step), 0.1f);
            base.Schedule(step, 0.1f);
        }
Ejemplo n.º 23
0
        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);
        }
Ejemplo n.º 24
0
        public Atlas5()
        {
            CCLabelBMFont label = CCLabelBMFont.labelWithString("abcdefg", "fonts/fnt/bitmapFontTest4");

            addChild(label);

            CCSize s = CCDirector.sharedDirector().getWinSize();

            label.position    = new CCPoint(s.width / 2, s.height / 2);
            label.anchorPoint = new CCPoint(0.5f, 0.5f);
        }
Ejemplo n.º 25
0
        public MainSceneLayer()
        {
            SetupBackground();
            var starParticles = new CCParticleSystemQuad(@"Particles\bg-stars.plist");

            starParticles.SourcePosition = new CCPoint(CCDirector.SharedDirector.WinSize.Width / 2, CCDirector.SharedDirector.WinSize.Height / 2);
            starParticles.PosVar         = new CCPoint(CCDirector.SharedDirector.WinSize.Width / 2, CCDirector.SharedDirector.WinSize.Height / 2);
            AddChild(starParticles);

            CCMenuItemImage buttonPlay  = new CCMenuItemImage(@"MainScene\btn-play.png", @"MainScene\btn-play-down.png", OnPlayPressed);
            CCMenuItemImage buttonAbout = new CCMenuItemImage(@"MainScene\btn-about.png", @"MainScene\btn-about-down.png", OnAboutPressed);
            var             buttonLevel = new CCMenuItemImage(@"MainScene\btn-levels.png", @"MainScene\btn-levels-down.png", OnChooseLevelPressed);

            var scale = 1f;

#if WINDOWS_PHONE || ANDROID
            scale = 0.6f;
#endif
            buttonAbout.Scale   = buttonPlay.Scale = scale;
            buttonAbout.Opacity = buttonPlay.Opacity = 0;
            buttonLevel.Scale   = scale;
            buttonLevel.Opacity = 0;


            _buttonsMenu = new CCMenu(buttonPlay, buttonLevel, buttonAbout);
            _buttonsMenu.AlignItemsVerticallyWithPadding(20);

            buttonAbout.Scale = buttonPlay.Scale = buttonLevel.Scale = 0.01f;

            _logo             = new CCSprite(@"MainScene\logo.png");
            _logo.AnchorPoint = new CCPoint(0, 1);
            _logo.Scale       = 0.05f;
            _logo.Opacity     = 0;
            _logo.Position    = new CCPoint(24, CCDirector.SharedDirector.WinSize.Height - 24);
            AddChild(_logo);
            AddChild(_buttonsMenu);


            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile("crystals.plist");
            Scheduler.ScheduleUpdateForTarget(this, 1, false);
            var scoreLabel = new CCLabelBMFont(LastScore.ToString(), @"Fonts\scorefont.fnt");
            scoreLabel.Position    = new CCPoint(CCDirector.SharedDirector.WinSize.Width / 2, 50);
            scoreLabel.AnchorPoint = new CCPoint(0.5f, 0f);

            var scoreLabelDescription = new CCLabelBMFont("ПОСЛЕДНИЙ СЧЕТ", @"Fonts\Foo64.fnt");
            scoreLabelDescription.Position    = new CCPoint(CCDirector.SharedDirector.WinSize.Width / 2, 55);
            scoreLabelDescription.AnchorPoint = new CCPoint(0.5f, 1f);
#if !ANDROID
            //CCSimpleAudioEngine.SharedEngine.PlayBackgroundMusic(@"Sounds\loop");
#endif

            AddChild(scoreLabelDescription);
            AddChild(scoreLabel);
        }
Ejemplo n.º 26
0
        public Atlas5()
        {
            CCLabelBMFont label = new CCLabelBMFont("abcdefg", "fonts/bitmapFontTest4.fnt");

            AddChild(label);

            CCSize s = CCDirector.SharedDirector.WinSize;

            label.Position    = new CCPoint(s.Width / 2, s.Height / 2);
            label.AnchorPoint = new CCPoint(0.5f, 0.5f);
        }
Ejemplo n.º 27
0
        public BMFontInit()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            var bmFont = new CCLabelBMFont();

            //CCLabelBMFont* bmFont = [CCLabelBMFont create:@"Foo" fntFile:@"arial-unicode-26"];
            bmFont.FntFile = "fonts/helvetica-32.fnt";
            bmFont.Label   = ("It is working!");
            AddChild(bmFont);
            bmFont.Position = new CCPoint(s.Width / 2, s.Height / 4 * 2);
        }
Ejemplo n.º 28
0
        public Issue1343()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            var bmFont = new CCLabelBMFont();

            bmFont.FntFile = "fonts/font-issue1343.fnt";
            bmFont.Label   = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz.,'");
            AddChild(bmFont);
            bmFont.Scale = 0.3f;

            bmFont.Position = new CCPoint(s.Width / 2, s.Height / 4 * 2);
        }
Ejemplo n.º 29
0
        public LabelGlyphDesigner()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            CCLayerColor layer = new CCLayerColor(new CCColor4B(128, 128, 128, 255));

            AddChild(layer, -10);

            // CCLabelBMFont
            CCLabelBMFont label1 = new CCLabelBMFont("Testing Glyph Designer", "fonts/futura-48.fnt");

            AddChild(label1);
            label1.Position = new CCPoint(s.Width / 2, s.Height / 2);
        }
Ejemplo n.º 30
0
        public Atlas6()
        {
            label1 = new CCLabelBMFont("FaFeFiFoFu", "fonts/bitmapFontTest5.fnt");
            AddChild(label1);
            label1.AnchorPoint = CCPoint.AnchorMiddle;

            label2 = new CCLabelBMFont("fafefifofu", "fonts/bitmapFontTest5.fnt");
            AddChild(label2);
            label2.AnchorPoint = CCPoint.AnchorMiddle;

            label3 = new CCLabelBMFont("aeiou", "fonts/bitmapFontTest5.fnt");
            AddChild(label3);
            label3.AnchorPoint = CCPoint.AnchorMiddle;
        }
Ejemplo n.º 31
0
        public Layer3()
        {
            CCMenuItemFont.DefaultFontName = "Marker Felt";
            CCMenuItemFont.DefaultFontSize = 28;

            CCLabelBMFont label = new CCLabelBMFont("Enable AtlasItem", "bitmapFontTest3.fnt");
            CCMenuItemLabel item1 = new CCMenuItemLabel(label, this, new MonoMac.ObjCRuntime.Selector("menuCallback2:"));
            CCMenuItemFont item2 = new CCMenuItemFont("--- Go Back ---", this, new MonoMac.ObjCRuntime.Selector("menuCallback:"));

            CCSprite spriteNormal = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 2, 115, 23));
            CCSprite spriteSelected = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 1, 115, 23));
            CCSprite spriteDisabled = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 0, 115, 23));

            CCMenuItemSprite item3 = new CCMenuItemSprite (spriteNormal, spriteSelected, spriteDisabled, this, new MonoMac.ObjCRuntime.Selector("menuCallback3:"));
            disabledItem = item3;
            disabledItem.Enabled = false;

            NSArray arrayOfItems = NSArray.FromObjects(item1, item2, item3);
            CCMenu menu = new CCMenu(arrayOfItems);

            CGSize s = CCDirector.SharedDirector().WinSize ();

            item1.Position = new CCPoint(s.Width/2 - 150, s.Height/2);
            item2.Position = new CCPoint(s.Width/2 - 200, s.Height/2);
            item3.Position = new CCPoint(s.Width/2, s.Height/2 - 100);

            var jump = new CCJumpBy(3, new CCPoint(400,0), 50, 4);
            item2.RunAction (new CCRepeatForever ((CCActionInterval)CCSequence.Actions (jump, jump.Reverse ())));
            var spin1 = new CCRotateBy (3, 360);
            var spin2 = (CCRotateBy)spin1.Copy ();
            var spin3 = (CCRotateBy)spin1.Copy ();

            item1.RunAction (new CCRepeatForever (spin1));
            item2.RunAction (new CCRepeatForever (spin2));
            item3.RunAction (new CCRepeatForever (spin3));

            this.AddChild (menu);
            menu.Position = new CCPoint(0, 0);
        }
Ejemplo n.º 32
0
        public MenuTest()
        {
            CCDirector director = CCDirector.SharedDirector ();
            SizeF size = director.WinSize ();
            CCMenu menu = null;

            CCSprite spriteNormal = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 2, 115, 23));
            CCSprite spriteSelected = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 1, 115, 23));
            CCSprite spriteDisabled = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 0, 115, 23));
            CCMenuItemSprite item1 = new CCMenuItemSprite (spriteNormal, spriteSelected, spriteDisabled,
                delegate (NSObject sender) {
                CCScene scene1 = new CCScene ();
                scene1.AddChild (Layer2.Node());
                CCDirector.SharedDirector ().ReplaceScene (scene1);
            });

            CCMenuItemImage item2 = new CCMenuItemImage ("SendScoreButton.png", "SendScoreButtonPressed.png", null, cb);

            CCLabelAtlas labelAtlas = new CCLabelAtlas ("0123456789", "fps_images.png", 12, 32, '.');
            CCMenuItemLabel item3 = new CCMenuItemLabel(labelAtlas,
                delegate (NSObject sender) {
                CCDirector.SharedDirector ().EventDispatcher.AddMouseDelegate (this, -128-1);
                this.Schedule (new MonoMac.ObjCRuntime.Selector ("allowTouches"), 5.0f);
            });

            item3.DisabledColor = new ccColor3B (32, 32, 64);
            item3.Color = new ccColor3B (200, 200, 255);
            disabledItem = item3;

            CCMenuItemFont item4 = new CCMenuItemFont ("I toggle enabled items",
                delegate {
                disabledItem.Enabled = !disabledItem.Enabled;
            }
            );
            item4.FontSize = 20;
            item4.FontName = "Marker Felt";

            CCLabelBMFont label = new CCLabelBMFont ("configuration", "bitmapFontTest3.fnt");
            CCMenuItemLabel item5 = new CCMenuItemLabel (label,
                delegate {
                CCScene scene = new CCScene ();
                scene.AddChild (new Layer4 ());
                CCDirector.SharedDirector ().ReplaceScene (scene);
            });
            item5.Scale = 0.8f;

            CCMenuItemFont.DefaultFontName = "Marker Felt";
            CCMenuItemFont item6 = new CCMenuItemFont ("Priority Test",
                delegate (NSObject sender) {
                CCScene scene = new CCScene();
                scene.AddChild (new LayerPriorityTest());
                CCDirector.SharedDirector ().PushScene (scene);
            });

            CCMenuItemFont.DefaultFontName = "Courier New";
            CCMenuItemFont.DefaultFontSize = 30;
            CCMenuItemFont item7 = new CCMenuItemFont ("Quit",
                delegate {
                director.View.Window.Close ();
            });

            CCTintBy color_action = new CCTintBy(0.5f, 0, -255, -255);
            var color_back = color_action.Reverse ();
            var seq = new CCSequence (color_action, color_back);
            item7.RunAction (new CCRepeatForever (seq));

            menu = new CCMenu (item1, item2, item3, item4, item5, item6, item7);
            menu.AlignItemsVertically ();

            for (uint i = 0; i < menu.Children.Count(); i++) {
                CCNode child = (CCNode)menu.Children.ObjectAtIndex(i);
                PointF dstPoint = child.Position;
                int offset = (int)(size.Width/2) + 50;
                if (i % 2 == 0)
                    offset = -offset;
                child.Position = new PointF(dstPoint.X + offset, dstPoint.Y);
                child.RunAction(new CCEaseElasticOut(
                    new CCMoveBy(2, new PointF(dstPoint.X - offset, 0)), 0.35f));
            }

            menu.Position = new PointF(size.Width/2, size.Height/2);
            this.AddChild(menu);
        }
Ejemplo n.º 33
0
        public Layer4()
        {
            CCMenuItemFont.DefaultFontName = "American Typewriter";
            CCMenuItemFont.DefaultFontSize = 18;

            CCMenuItemFont title1 = CCMenuItemFont.ItemWithString ("Sound");
            title1.Enabled = false;

            CCMenuItemFont.DefaultFontName = "Marker Felt";
            CCMenuItemFont.DefaultFontSize = 34;

            NSArray ar = NSArray.FromObjects (CCMenuItemFont.ItemWithString ("On"), CCMenuItemFont.ItemWithString ("Off"));
            CCMenuItemToggle item1 = new CCMenuItemToggle (ar, menuCallback);

            CCMenuItemFont.DefaultFontName = "American Typewriter";
            CCMenuItemFont.DefaultFontSize = 18;
            CCMenuItemFont title2 = CCMenuItemFont.ItemWithString ("Music");
            title2.Enabled = false;
            CCMenuItemFont.DefaultFontName = "Marker Felt";
            CCMenuItemFont.DefaultFontSize = 34;
            NSArray ar1 = NSArray.FromObjects (CCMenuItemFont.ItemWithString ("On"), CCMenuItemFont.ItemWithString ("Off"));
            CCMenuItemToggle item2 = new CCMenuItemToggle (ar1, menuCallback);

            CCMenuItemFont.DefaultFontName = "American Typewriter";
            CCMenuItemFont.DefaultFontSize = 18;
            CCMenuItemFont title3 = CCMenuItemFont.ItemWithString ("Quality");
            title3.Enabled = false;
            CCMenuItemFont.DefaultFontName = "Marker Felt";
            CCMenuItemFont.DefaultFontSize = 34;
            NSArray ar2 = NSArray.FromNSObjects (CCMenuItemFont.ItemWithString ("High"), CCMenuItemFont.ItemWithString ("Low"));
            CCMenuItemToggle item3 = new CCMenuItemToggle (ar2, menuCallback);

            CCMenuItemFont.DefaultFontName = "American Typewriter";
            CCMenuItemFont.DefaultFontSize = 18;
            CCMenuItemFont title4 = CCMenuItemFont.ItemWithString ("Orientation");
            title4.Enabled = false;
            CCMenuItemFont.DefaultFontName = "Marker Felt";
            CCMenuItemFont.DefaultFontSize = 34;
            NSArray ar3 = NSArray.FromNSObjects (CCMenuItemFont.ItemWithString ("Off"));
            CCMenuItemToggle item4 = new CCMenuItemToggle (ar3, menuCallback);

            NSObject[] more_items = new NSObject[3];
            more_items[0] = CCMenuItemFont.ItemWithString ("33%");
            more_items[1] = CCMenuItemFont.ItemWithString ("66%");
            more_items[2] = CCMenuItemFont.ItemWithString ("100%");

            item4.SubItems.AddObjects (more_items);

            // you can change the one of the items by doing this
            item4.SelectedIndex = 2;

            CCMenuItemFont.DefaultFontName = "Marker Felt";
            CCMenuItemFont.DefaultFontSize = 34;

            CCLabelBMFont label = new CCLabelBMFont("go back", "bitmapFontTest3.fnt");
            CCMenuItemLabel back = new CCMenuItemLabel (label, backCallback);

            CCMenu menu = new CCMenu(
                title1, title2,
                item1, item2,
                title3, title4,
                item3, item4,
                back);

            menu.AlignItemsInColumns (NSNumber.FromUInt32(2),
                                      NSNumber.FromUInt32(2),
                                      NSNumber.FromUInt32(2),
                                      NSNumber.FromUInt32(2),
                                      NSNumber.FromUInt32 (1));
            this.AddChild (menu);
            CGSize s = CCDirector.SharedDirector ().WinSize ();
            menu.Position = new System.Drawing.PointF(s.Width / 2, s.Height / 2);
        }