public LabelAtlasColorTest()
        {
            CCLabelAtlas label1 = new CCLabelAtlas("123 Test", "fonts/tuffy_bold_italic-charmap", 48, 64, ' ');

            AddChild(label1, 0, (int)TagSprite.kTagSprite1);
            label1.Position = new CCPoint(10, 100);
            label1.Opacity  = 200;

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

            AddChild(label2, 0, (int)TagSprite.kTagSprite2);
            label2.Position = new CCPoint(10, 200);
            label2.Color    = ccRED;

            CCActionInterval   fade    = new CCFadeOut(1.0f);
            CCFiniteTimeAction fade_in = fade.Reverse();
            CCFiniteTimeAction seq     = CCSequence.FromActions(fade, fade_in);
            CCAction           repeat  = new CCRepeatForever((CCActionInterval)seq);

            label2.RunAction(repeat);

            m_time = 0;

            Schedule(step); //:@selector(step:)];
        }
示例#2
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s      = CCDirector.SharedDirector.WinSize;
            var layer1 = new CCLayerColor(new CCColor4B(255, 255, 0, 80), 100, s.Height - 50);

            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), 100, s.Height - 50);

            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);
        }
示例#3
0
        public Atlas3()
        {
            m_time = 0;

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

            AddChild(col, -10);

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

            // testing anchors
            label1.AnchorPoint = new CCPoint(0, 0);
            AddChild(label1, 0, (int)TagSprite.kTagBitmapAtlas1);
            CCActionInterval   fade    = new CCFadeOut(1.0f);
            CCFiniteTimeAction fade_in = fade.Reverse();
            CCFiniteTimeAction seq     = new CCSequence(fade, fade_in);
            CCAction           repeat  = new CCRepeatForever((CCActionInterval)seq);

            label1.RunAction(repeat);


            // VERY IMPORTANT
            // color and opacity work OK because bitmapFontAltas2 loads a BMP image (not a PNG image)
            // If you want to use both opacity and color, it is recommended to use NON premultiplied images like BMP images
            // Of course, you can also tell XCode not to compress PNG images, but I think it doesn't work as expected
            CCLabelBMFont label2 = new CCLabelBMFont("Test", "fonts/bitmapFontTest2.fnt");

            // testing anchors
            label2.AnchorPoint = new CCPoint(0.5f, 0.5f);
            label2.Color       = ccRED;
            AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);
            label2.RunAction((CCAction)(repeat.Copy()));

            CCLabelBMFont label3 = new CCLabelBMFont("Test", "fonts/bitmapFontTest2.fnt");

            // testing anchors
            label3.AnchorPoint = new CCPoint(1, 1);
            AddChild(label3, 0, (int)TagSprite.kTagBitmapAtlas3);


            CCSize s = CCDirector.SharedDirector.WinSize;

            label1.Position = new CCPoint();
            label2.Position = new CCPoint(s.Width / 2, s.Height / 2);
            label3.Position = new CCPoint(s.Width, s.Height);

            base.Schedule(step);//:@selector(step:)];
        }
示例#4
0
        public override void OnEnter()
        {
            base.OnEnter();

            centerSprites(2);

            m_tamara.Opacity = 0;
            var action1     = new CCFadeIn(1.0f);
            var action1Back = action1.Reverse();

            var action2     = new CCFadeOut(1.0f);
            var action2Back = action2.Reverse();

            m_tamara.RunAction(CCSequence.FromActions(action1, action1Back));
            m_kathia.RunAction(CCSequence.FromActions(action2, action2Back));
        }
        public LabelSystemFontColorAndOpacity()
        {
            m_time = 0;

            Color   = new CCColor3B(128, 128, 128);
            Opacity = 255;

            label1 = new CCLabel("Label FadeOut/FadeIn", "fonts/Marker Felt.ttf", 40, CCLabelFormat.SystemFont)
            {
                Color = CCColor3B.Orange,
                // testing anchors
                AnchorPoint = CCPoint.AnchorLowerLeft
            };

            AddChild(label1, 0, (int)TagSprite.kTagBitmapAtlas1);

            var fade    = new CCFadeOut(1.0f);
            var fade_in = fade.Reverse();

            label1.RepeatForever(fade, fade_in);

            label2 = new CCLabel("Label TintTo", "fonts/MorrisRoman-Black.ttf", 40, CCLabelFormat.SystemFont)
            {
                Color = CCColor3B.Red,
                // testing anchors
                AnchorPoint = CCPoint.AnchorMiddle
            };

            AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);

            label2.RepeatForever(new CCTintTo(1, 255, 0, 0), new CCTintTo(1, 0, 255, 0), new CCTintTo(1, 0, 0, 255));

            label3 = new CCLabel("Label\nPlain\nBlue", "Helvetica", 40, CCLabelFormat.SystemFont)
            {
                Color   = CCColor3B.Blue,
                Opacity = 128,
                // testing anchors
                AnchorPoint = CCPoint.AnchorUpperRight
            };

            AddChild(label3, 0, (int)TagSprite.kTagBitmapAtlas3);

            //base.Schedule(step);
        }
        protected override void AddedToScene()
        {
            base.AddedToScene();

            var visibleRect = VisibleBoundsWorldspace;

            loading.Position = visibleRect.Center;

            LoadLabel((fntFNT) =>
            {
                label1 = new CCLabel(fntFNT, "Label1", CCSize.Zero, CCLabelFormat.BitMapFont);
                AddChild(label1, 0, (int)TagSprite.kTagBitmapAtlas1);
                //// testing anchors
                label1.AnchorPoint = CCPoint.AnchorLowerLeft;
                label1.Position    = visibleRect.LeftBottom();

                var fade    = new CCFadeOut(1.0f);
                var fade_in = fade.Reverse();
                label1.RepeatForever(fade, fade_in);

                // VERY IMPORTANT
                // color and opacity work OK because bitmapFontAltas2 loads a BMP image (not a PNG image)
                // If you want to use both opacity and color, it is recommended to use NON premultiplied images like BMP images
                // Of course, you can also tell XCode not to compress PNG images, but I think it doesn't work as expected
                label2 = new CCLabel(fntFNT, "Label2", CCSize.Zero, CCLabelFormat.BitMapFont);
                // testing anchors
                label2.AnchorPoint = CCPoint.AnchorMiddle;
                label2.Color       = CCColor3B.Red;
                label2.Position    = visibleRect.Center();
                AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);

                label2.RepeatForever(new CCTintTo(1, 255, 0, 0), new CCTintTo(1, 0, 255, 0), new CCTintTo(1, 0, 0, 255));

                label3 = new CCLabel(fntFNT, "Label3", CCSize.Zero, CCLabelFormat.BitMapFont);
                // testing anchors
                label3.AnchorPoint = CCPoint.AnchorUpperRight;
                label3.Position    = visibleRect.RightTop();
                AddChild(label3, 0, (int)TagSprite.kTagBitmapAtlas3);

                loading.Visible = false;
            }
                      );
        }
        public LabelFNTColorAndOpacity()
        {
            m_time = 0;

            Color   = new CCColor3B(128, 128, 128);
            Opacity = 255;

            label1 = new CCLabel("Label1", "fonts/bitmapFontTest2.fnt");

            // testing anchors
            label1.AnchorPoint = CCPoint.AnchorLowerLeft;
            AddChild(label1, 0, (int)TagSprite.kTagBitmapAtlas1);

            var fade    = new CCFadeOut(1.0f);
            var fade_in = fade.Reverse();

            label1.RepeatForever(fade, fade_in);


            // VERY IMPORTANT
            // color and opacity work OK because bitmapFontAltas2 loads a BMP image (not a PNG image)
            // If you want to use both opacity and color, it is recommended to use NON premultiplied images like BMP images
            // Of course, you can also tell XCode not to compress PNG images, but I think it doesn't work as expected
            label2 = new CCLabel("Label2", "fonts/bitmapFontTest2.fnt");
            // testing anchors
            label2.AnchorPoint = CCPoint.AnchorMiddle;
            label2.Color       = CCColor3B.Red;
            AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);

            label2.RepeatForever(new CCTintTo(1, 255, 0, 0), new CCTintTo(1, 0, 255, 0), new CCTintTo(1, 0, 0, 255));

            label3 = new CCLabel("Label3", "fonts/bitmapFontTest2.fnt");
            // testing anchors
            label3.AnchorPoint = CCPoint.AnchorUpperRight;
            AddChild(label3, 0, (int)TagSprite.kTagBitmapAtlas3);

            base.Schedule(step);
        }