public LabelAtlasColorTest() { CCLabelAtlas label1 = CCLabelAtlas.labelWithString("123 Test", "fonts/tuffy_bold_italic-charmap.png", 48, 64, ' '); addChild(label1, 0, (int)TagSprite.kTagSprite1); label1.position = new CCPoint(10, 100); label1.Opacity = 200; CCLabelAtlas label2 = CCLabelAtlas.labelWithString("0123456789", "fonts/tuffy_bold_italic-charmap.png", 48, 64, ' '); addChild(label2, 0, (int)TagSprite.kTagSprite2); label2.position = new CCPoint(10, 200); //label2.setColor( ccRED ); label2.Color = ccRED; CCActionInterval fade = CCFadeOut.actionWithDuration(1.0f); //CCActionInterval fade_in = fade.reverse(); CCActionInterval fade_in = null; CCFiniteTimeAction seq = CCSequence.actions(fade, fade_in, null); CCAction repeat = CCRepeatForever.actionWithAction((CCActionInterval)seq); label2.runAction(repeat); m_time = 0; //schedule( schedule_selector(LabelAtlasColorTest.step) ); //:@selector(step:)]; }
public LabelsEmpty() { CCSize s = CCDirector.sharedDirector().getWinSize(); // CCLabelBMFont CCLabelBMFont label1 = CCLabelBMFont.labelWithString("", "fonts/bitmapFontTest3.fnt"); 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/tuffy_bold_italic-charmap.png", 48, 64, ' '); addChild(label3, 0, (int)TagSprite.kTagBitmapAtlas3); label3.position = new CCPoint(s.width / 2, 0 + 100); base.schedule(updateStrings, 1.0f); setEmpty = false; }
/// <summary> /// creates the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element and the starting char of the atlas /// </summary> public static CCLabelAtlas labelWithString(string label, string charMapFile, int itemWidth, int itemHeight, char startCharMap) { CCLabelAtlas pRet = new CCLabelAtlas(); if (pRet != null && pRet.initWithString(label, charMapFile, itemWidth, itemHeight, startCharMap)) { return pRet; } return null; }
public static CCLabelAtlas labelWithString(string label, string charMapFile, int itemWidth, int itemHeight, char startCharMap) { CCLabelAtlas cCLabelAtla = new CCLabelAtlas(); if (cCLabelAtla != null && cCLabelAtla.initWithString(label, charMapFile, itemWidth, itemHeight, startCharMap)) { return(cCLabelAtla); } return(null); }
public LabelAtlasHD() { CCSize s = CCDirector.SharedDirector.WinSize; // CCLabelBMFont CCLabelAtlas label1 = new CCLabelAtlas("TESTING RETINA DISPLAY", "fonts/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); }
public LabelAtlasHD() { CCSize s = CCDirector.sharedDirector().getWinSize(); // CCLabelBMFont CCLabelAtlas label1 = CCLabelAtlas.labelWithString("TESTING RETINA DISPLAY", "fonts/larabie-16.png", 10, 20, 'A'); label1.anchorPoint = new CCPoint(0.5f, 0.5f); addChild(label1); label1.position = new CCPoint(s.width / 2, s.height / 2); }
public LabelAtlasTest() { m_time = 0; 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.Opacity = 32; Schedule(step); }
public virtual void step(float dt) { m_time += dt; //char string[12] = {0}; string stepstring; //sprintf(string, "%2.2f Test", m_time); stepstring = string.Format("{0,2:f2} Test", m_time); //std::string string = std::string::stringWithFormat("%2.2f Test", m_time); CCLabelAtlas label1 = (CCLabelAtlas)getChildByTag((int)TagSprite.kTagSprite1); label1.setString(stepstring); CCLabelAtlas label2 = (CCLabelAtlas)getChildByTag((int)TagSprite.kTagSprite2); //sprintf(string, "%d", (int)m_time); stepstring = m_time.ToString(); label2.setString(stepstring); }
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:)]; }
public void updateStrings(float dt) { CCLabelBMFont label1 = (CCLabelBMFont)getChildByTag((int)TagSprite.kTagBitmapAtlas1); CCLabelTTF label2 = (CCLabelTTF)getChildByTag((int)TagSprite.kTagBitmapAtlas2); CCLabelAtlas label3 = (CCLabelAtlas)getChildByTag((int)TagSprite.kTagBitmapAtlas3); if (!setEmpty) { label1.setString("not empty"); label2.setString("not empty"); label3.setString("hi"); setEmpty = true; } else { label1.setString(""); label2.setString(""); label3.setString(""); setEmpty = false; } }
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; }
public static CCLabelAtlas Create(string label, string charMapFile, int itemWidth, int itemHeight, char startCharMap) { var pRet = new CCLabelAtlas(); pRet.InitWithString(label, charMapFile, itemWidth, itemHeight, startCharMap); return pRet; }
public static CCLabelAtlas Create(string label, string fntFile) { var pRet = new CCLabelAtlas(); pRet.InitWithString(label, fntFile); return pRet; }
public ParticleDemo() { InitWithColor(CCTypes.CreateColor(127, 127, 127, 255)); m_emitter = null; TouchEnabled = true; CCSize s = CCDirector.SharedDirector.WinSize; CCLabelTTF label = new CCLabelTTF(title(), "arial", 28); AddChild(label, 100, 1000); label.Position = new CCPoint(s.Width / 2, s.Height - 50); CCLabelTTF tapScreen = new CCLabelTTF(subtitle(), "arial", 20); tapScreen.Position = new CCPoint(s.Width / 2, s.Height - 80); AddChild(tapScreen, 100); 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); CCMenuItemToggle item4 = new CCMenuItemToggle(toggleCallback, new CCMenuItemFont("Free Movement"), new CCMenuItemFont("Relative Movement"), new CCMenuItemFont("Grouped Movement")); CCMenu menu = new CCMenu(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; try { labelAtlas = new CCLabelAtlas("0000", "Images/fps_Images", 16, 24, '.'); } catch (Exception) { labelAtlas = new CCLabelAtlas("0000", "Images/fps_Images", 16, 24, '.'); } AddChild(labelAtlas, 100, ParticleTestScene.kTagLabelAtlas); labelAtlas.Position = new CCPoint(s.Width - 66, 50); // moving background m_background = new CCSprite(TestResource.s_back3); AddChild(m_background, 5); m_background.Position = new CCPoint(s.Width / 2, s.Height - 180); CCActionInterval move = new CCMoveBy (4, new CCPoint(300, 0)); CCFiniteTimeAction move_back = move.Reverse(); CCFiniteTimeAction seq = CCSequence.FromActions(move, move_back); m_background.RunAction(new CCRepeatForever ((CCActionInterval) seq)); Schedule(step); }
public virtual void initWithSubTest(int asubtest, int particles) { //srandom(0); subtestNumber = asubtest; CCSize s = CCDirector.SharedDirector.WinSize; lastRenderedCount = 0; quantityParticles = particles; CCMenuItemFont.FontSize = 64; 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", "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 = new CCLabelAtlas("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 = 38; CCMenu pSubMenu = new CCMenu(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 = new CCMenuItemFont(str, 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 = 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); updateQuantityLabel(); createParticleSystem(); Schedule(step); }
public MenuLayer1() { CCMenuItemFont.FontSize = 30; CCMenuItemFont.FontName = "arial"; base.TouchEnabled = true; // Font Item CCSprite spriteNormal = new CCSprite(s_MenuItem, new CCRect(0, 23 * 2, 115, 23)); CCSprite spriteSelected = new CCSprite(s_MenuItem, new CCRect(0, 23 * 1, 115, 23)); CCSprite spriteDisabled = new CCSprite(s_MenuItem, new CCRect(0, 23 * 0, 115, 23)); CCMenuItemSprite item1 = new CCMenuItemSprite(spriteNormal, spriteSelected, spriteDisabled, this.menuCallback); // Image Item CCMenuItem item2 = new CCMenuItemImage(s_SendScore, s_PressSendScore, this.menuCallback2); // Label Item (LabelAtlas) CCLabelAtlas labelAtlas = new CCLabelAtlas("0123456789", "Images/fps_Images", 16, 24, '.'); CCMenuItemLabel item3 = new CCMenuItemLabel(labelAtlas, this.menuCallbackDisabled); item3.DisabledColor = new CCColor3B(32, 32, 64); item3.Color = new CCColor3B(200, 200, 255); // Font Item CCMenuItemFont item4 = new CCMenuItemFont("I toggle enable items", this.menuCallbackEnable); item4.FontSizeObj = 20; item4.FontNameObj = "arial"; // Label Item (CCLabelBMFont) CCLabelBMFont label = new CCLabelBMFont("configuration", "fonts/bitmapFontTest3.fnt"); CCMenuItemLabel item5 = new CCMenuItemLabel(label, this.menuCallbackConfig); // Testing issue #500 item5.Scale = 0.8f; // Events CCMenuItemFont.FontName = "arial"; CCMenuItemFont item6 = new CCMenuItemFont("Priority Test", menuCallbackPriorityTest); // Font Item CCMenuItemFont item7 = new CCMenuItemFont("Quit", this.onQuit); CCActionInterval color_action = new CCTintBy (0.5f, 0, -255, -255); CCActionInterval color_back = (CCActionInterval)color_action.Reverse(); CCFiniteTimeAction seq = CCSequence.FromActions(color_action, color_back); item7.RunAction(new CCRepeatForever ((CCActionInterval)seq)); CCMenu menu = new CCMenu(item1, item2, item3, item4, item5, item6, item7); menu.AlignItemsVertically(); // elastic effect CCSize s = CCDirector.SharedDirector.WinSize; int i = 0; CCNode child; var pArray = menu.Children; object 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(new CCEaseElasticOut(new CCMoveBy (2, new CCPoint(dstPoint.X - offset, 0)), 0.35f)); i++; } } m_disabledItem = item3; m_disabledItem.Enabled = false; AddChild(menu); }