public void testNCallback(CCObject pSender) { subtestNumber = ((CCNode)pSender).tag; ParticleMenuLayer pMenu = (ParticleMenuLayer)getChildByTag(PerformanceParticleTest.kTagMenuLayer); pMenu.restartCallback(pSender); }
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); }
public virtual void initWithSubTest(int asubtest, int particles) { //srandom(0); subtestNumber = asubtest; CCSize s = Layer.VisibleBoundsWorldspace.Size; lastRenderedCount = 0; quantityParticles = particles; 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); CCLabel infoLabel = new CCLabel("0 nodes", "Marker Felt", 30, CCLabelFormat.SpriteFont); 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", 12, 32, '.'); 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; CCMenuItemFont.FontName = "arial"; 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); CCLabel label = new CCLabel(title(), "arial", 38, CCLabelFormat.SpriteFont); 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 virtual void initWithSubTest(int asubtest, int particles) { //srandom(0); subtestNumber = asubtest; CCSize s = Layer.VisibleBoundsWorldspace.Size; lastRenderedCount = 0; quantityParticles = particles; 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", "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", 12, 32, '.'); 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; CCMenuItemFont.FontName = "arial"; 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); }