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

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

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

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

            CCActionInterval   fade    = CCFadeOut.actionWithDuration(1.0f);
            CCFiniteTimeAction fade_in = fade.reverse();
            CCFiniteTimeAction seq     = CCSequence.actions(fade, fade_in);
            CCAction           repeat  = CCRepeatForever.actionWithAction((CCActionInterval)seq);

            label2.runAction(repeat);

            m_time = 0;

            schedule(step); //:@selector(step:)];
        }
Esempio n. 2
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;
        }
Esempio n. 3
0
        public ParticleDemo()
        {
            initWithColor(ccTypes.ccc4(127, 127, 127, 255));

            m_emitter = null;

            isTouchEnabled = true;

            CCSize     s     = CCDirector.sharedDirector().getWinSize();
            CCLabelTTF label = CCLabelTTF.labelWithString(title(), "Arial", 28);

            addChild(label, 100, 1000);
            label.position = new CCPoint(s.width / 2, s.height - 50);

            CCLabelTTF tapScreen = CCLabelTTF.labelWithString("(Tap the Screen)", "Arial", 20);

            tapScreen.position = new CCPoint(s.width / 2, s.height - 80);
            addChild(tapScreen, 100);

            CCMenuItemImage item1 = CCMenuItemImage.itemFromNormalImage(TestResource.s_pPathB1, TestResource.s_pPathB2, this, new SEL_MenuHandler(backCallback));
            CCMenuItemImage item2 = CCMenuItemImage.itemFromNormalImage(TestResource.s_pPathR1, TestResource.s_pPathR2, this, new SEL_MenuHandler(restartCallback));
            CCMenuItemImage item3 = CCMenuItemImage.itemFromNormalImage(TestResource.s_pPathF1, TestResource.s_pPathF2, this, new SEL_MenuHandler(nextCallback));

            CCMenuItemToggle item4 = CCMenuItemToggle.itemWithTarget(this,
                                                                     new SEL_MenuHandler(toggleCallback),
                                                                     CCMenuItemFont.itemFromString("Free Movement"),
                                                                     CCMenuItemFont.itemFromString("Relative Movement"),
                                                                     CCMenuItemFont.itemFromString("Grouped Movement"));

            CCMenu menu = CCMenu.menuWithItems(item1, item2, item3, item4);

            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);
            item4.position    = new CCPoint(0, 100);
            item4.anchorPoint = new CCPoint(0, 0);

            addChild(menu, 100);

            CCLabelAtlas labelAtlas = CCLabelAtlas.labelWithString("0000", "fonts/fnt/images/fps_images", 16, 24, '.');

            addChild(labelAtlas, 100, ParticleTestScene.kTagLabelAtlas);
            labelAtlas.position = new CCPoint(s.width - 66, 50);

            // moving background
            m_background = CCSprite.spriteWithFile(TestResource.s_back3);
            addChild(m_background, 5);
            m_background.position = new CCPoint(s.width / 2 - 120, s.height - 240);

            CCActionInterval   move      = CCMoveBy.actionWithDuration(4, new CCPoint(300, 0));
            CCFiniteTimeAction move_back = move.reverse();
            CCFiniteTimeAction seq       = CCSequence.actions(move, move_back);

            m_background.runAction(CCRepeatForever.actionWithAction((CCActionInterval)seq));


            schedule(new SEL_SCHEDULE(step));
        }
Esempio n. 4
0
        public LabelAtlasHD()
        {
            CCSize s = CCDirector.sharedDirector().getWinSize();

            // CCLabelBMFont
            CCLabelAtlas label1 = CCLabelAtlas.labelWithString("TESTING RETINA DISPLAY", "fonts/fnt/images/larabie-16", 10, 20, 'A');

            label1.anchorPoint = new CCPoint(0.5f, 0.5f);

            addChild(label1);
            label1.position = new CCPoint(s.width / 2, s.height / 2);
        }
Esempio n. 5
0
        public LabelAtlasTest()
        {
            m_time = 0;

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

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

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

            addChild(label2, 0, (int)TagSprite.kTagSprite2);
            label2.position = new CCPoint(10, 200);
            label2.Opacity  = 32;

            schedule(step);
        }
        public virtual void initWithSubTest(int asubtest, int particles)
        {
            //srandom(0);

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

            lastRenderedCount = 0;
            quantityParticles = particles;

            CCMenuItemFont.FontSize = 65;
            CCMenuItemFont decrease = CCMenuItemFont.itemFromString(" - ", this, onDecrease);

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

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

            CCMenu menu = CCMenu.menuWithItems(decrease, increase);

            menu.alignItemsHorizontally();
            menu.position = new CCPoint(s.width / 2, s.height / 2 + 15);
            addChild(menu, 1);

            CCLabelTTF infoLabel = CCLabelTTF.labelWithString("0 nodes", "Marker Felt", 30);

            infoLabel.Color    = new ccColor3B(0, 200, 20);
            infoLabel.position = new CCPoint(s.width / 2, s.height - 90);
            addChild(infoLabel, 1, PerformanceParticleTest.kTagInfoLayer);

            // particles on stage
            CCLabelAtlas labelAtlas = CCLabelAtlas.labelWithString("0000", "Images/fps_images", 16, 24, '.');

            addChild(labelAtlas, 0, PerformanceParticleTest.kTagLabelAtlas);
            labelAtlas.position = new CCPoint(s.width - 66, 50);

            // Next Prev Test
            ParticleMenuLayer pMenu = new ParticleMenuLayer(true, PerformanceParticleTest.TEST_COUNT, PerformanceParticleTest.s_nParCurIdx);

            addChild(pMenu, 1, PerformanceParticleTest.kTagMenuLayer);

            // Sub Tests
            CCMenuItemFont.FontSize = 40;
            CCMenu pSubMenu = CCMenu.menuWithItems(null);

            for (int i = 1; i <= 6; ++i)
            {
                //char str[10] = {0};
                string str;
                //sprintf(str, "%d ", i);
                str = string.Format("{0:G}", i);
                CCMenuItemFont itemFont = CCMenuItemFont.itemFromString(str, this, testNCallback);
                itemFont.tag = i;
                pSubMenu.addChild(itemFont, 10);

                if (i <= 3)
                {
                    itemFont.Color = new ccColor3B(200, 20, 20);
                }
                else
                {
                    itemFont.Color = new ccColor3B(0, 200, 20);
                }
            }
            pSubMenu.alignItemsHorizontally();
            pSubMenu.position = new CCPoint(s.width / 2, 80);
            addChild(pSubMenu, 2);

            CCLabelTTF label = CCLabelTTF.labelWithString(title(), "Arial", 40);

            addChild(label, 1);
            label.position = new CCPoint(s.width / 2, s.height - 32);
            label.Color    = new ccColor3B(255, 255, 40);

            updateQuantityLabel();
            createParticleSystem();

            schedule(step);
        }
Esempio n. 7
0
        public MenuLayer1()
        {
            CCMenuItemFont.FontSize = 30;
            CCMenuItemFont.FontName = "Arial";
            base.isTouchEnabled     = true;
            // Font Item

            CCSprite spriteNormal   = CCSprite.spriteWithFile(s_MenuItem, new CCRect(0, 23 * 2, 115, 23));
            CCSprite spriteSelected = CCSprite.spriteWithFile(s_MenuItem, new CCRect(0, 23 * 1, 115, 23));
            CCSprite spriteDisabled = CCSprite.spriteWithFile(s_MenuItem, new CCRect(0, 23 * 0, 115, 23));

            CCMenuItemSprite item1 = CCMenuItemSprite.itemFromNormalSprite(spriteNormal, spriteSelected, spriteDisabled, this, this.menuCallback);

            // Image Item
            CCMenuItem item2 = CCMenuItemImage.itemFromNormalImage(s_SendScore, s_PressSendScore, this, this.menuCallback2);

            // Label Item (LabelAtlas)
            CCLabelAtlas    labelAtlas = CCLabelAtlas.labelWithString("0123456789", "Images/fps_images", 16, 24, '.');
            CCMenuItemLabel item3      = CCMenuItemLabel.itemWithLabel(labelAtlas, this, this.menuCallbackDisabled);

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

            // Font Item
            CCMenuItemFont item4 = CCMenuItemFont.itemFromString("I toggle enable items", this, this.menuCallbackEnable);

            item4.FontSizeObj = 20;
            item4.FontNameObj = "Arial";

            // Label Item (CCLabelBMFont)
            CCLabelBMFont   label = CCLabelBMFont.labelWithString("configuration", "fonts/fnt/bitmapFontTest3");
            CCMenuItemLabel item5 = CCMenuItemLabel.itemWithLabel(label, this, this.menuCallbackConfig);


            // Testing issue #500
            item5.scale = 0.8f;

            // Font Item
            CCMenuItemFont item6 = CCMenuItemFont.itemFromString("Quit", this, this.onQuit);

            CCActionInterval   color_action = CCTintBy.actionWithDuration(0.5f, 0, -255, -255);
            CCActionInterval   color_back   = (CCActionInterval)color_action.reverse();
            CCFiniteTimeAction seq          = CCSequence.actions(color_action, color_back);

            item6.runAction(CCRepeatForever.actionWithAction((CCActionInterval)seq));

            CCMenu menu = CCMenu.menuWithItems(item1, item2, item3, item4, item5, item6);

            menu.alignItemsVertically();

            // elastic effect
            CCSize        s = CCDirector.sharedDirector().getWinSize();
            int           i = 0;
            CCNode        child;
            List <CCNode> pArray  = menu.children;
            CCObject      pObject = null;

            if (pArray.Count > 0)
            {
                for (int j = 0; j < pArray.Count; j++)
                {
                    pObject = pArray[j];
                    if (pObject == null)
                    {
                        break;
                    }
                    child = (CCNode)pObject;
                    CCPoint dstPoint = child.position;
                    int     offset   = (int)(s.width / 2 + 50);
                    if (i % 2 == 0)
                    {
                        offset = -offset;
                    }

                    child.position = new CCPoint(dstPoint.x + offset, dstPoint.y);
                    child.runAction(CCEaseElasticOut.actionWithAction(CCMoveBy.actionWithDuration(2, new CCPoint(dstPoint.x - offset, 0)), 0.35f));
                    i++;
                }
            }
            m_disabledItem         = item3;
            m_disabledItem.Enabled = false;

            addChild(menu);
        }