public MenuLayerPriorityTest() { // Testing empty menu m_pMenu1 = new CCMenu(); m_pMenu2 = new CCMenu(); // Menu 1 CCMenuItemFont item1 = new CCMenuItemFont("Return to Main Menu", menuCallback); CCMenuItemFont item2 = new CCMenuItemFont("Disable menu for 5 seconds", disableMenuCallback); m_pMenu1.AddChild(item1); m_pMenu1.AddChild(item2); m_pMenu1.AlignItemsVertically(2); AddChild(m_pMenu1); // Menu 2 m_bPriority = true; //CCMenuItemFont.setFontSize(48); item1 = new CCMenuItemFont("Toggle priority", togglePriorityCallback); item1.Scale = 1.5f; item1.Color = new CCColor3B(0, 0, 255); m_pMenu2.AddChild(item1); AddChild(m_pMenu2); }
public override void OnEnter() { base.OnEnter(); var s = Layer.VisibleBoundsWorldspace.Size; CCMenuItemFont.FontSize = 24; CCMenuItemFont.FontName = "arial"; var pMainItem = new CCMenuItemFont("Back", toMainLayer); pMainItem.Position = new CCPoint(s.Width - 50, 25); var pMenu = new CCMenu(pMainItem); pMenu.Position = new CCPoint(0, 0); if (m_bControlMenuVisible) { var item1 = new CCMenuItemImage("Images/b1", "Images/b2", backCallback); var item2 = new CCMenuItemImage("Images/r1", "Images/r2", restartCallback); var item3 = new CCMenuItemImage("Images/f1", "Images/f2", nextCallback); 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); pMenu.AddChild(item1, PerformanceTestScene.kItemTagBasic); pMenu.AddChild(item2, PerformanceTestScene.kItemTagBasic); pMenu.AddChild(item3, PerformanceTestScene.kItemTagBasic); } AddChild(pMenu); }
public override void OnEnter() { base.OnEnter(); // Testing empty menu menu1 = new CCMenu(); menu2 = new CCMenu(); // Menu 1 var item1 = new CCMenuItemFont("Return to Main Menu", menuCallback); var item2 = new CCMenuItemFont("Disable menu for 5 seconds", disableMenuCallback); menu1.AddChild(item1); menu1.AddChild(item2); menu1.AlignItemsVertically(2); AddChild(menu1); // Menu 2 priority = true; //CCMenuItemFont.setFontSize(48); item1 = new CCMenuItemFont("Toggle priority", togglePriorityCallback); item1.Scale = 1.5f; item1.Color = new CCColor3B(0, 0, 255); menu2.AddChild(item1); AddChild(menu2); }
public CocosDenshionTest() { testMenu = null; beginPos = new CCPoint(0,0); soundId = 0; string[] testItems = { "Play background music", "Stop background music", "Pause background music", "Resume background music", "Rewind background music", "Is background music playing", "Play effect", "Play effect repeatly", "Stop effect", "Unload effect", "Add background music volume", "Sub background music volume", "Add effects volume", "Sub effects volume" }; testMenu = new CCMenu(null); testMenuItems = new List<CCMenuItem>(); for(int i=0; i < testItems.Count(); ++i) { CCLabelTtf label = new CCLabelTtf(testItems[i], "arial", 24); CCMenuItemLabelTTF menuItem = new CCMenuItemLabelTTF(label, MenuCallback); testMenu.AddChild(menuItem, i + 10000); testMenuItems.Add(menuItem); } AddChild(testMenu); // preload background music and effect CCSimpleAudioEngine.SharedEngine.PreloadBackgroundMusic(CCFileUtils.FullPathFromRelativePath(MUSIC_FILE)); CCSimpleAudioEngine.SharedEngine.PreloadEffect(CCFileUtils.FullPathFromRelativePath(EFFECT_FILE)); // set default volume CCSimpleAudioEngine.SharedEngine.EffectsVolume = 0.5f; CCSimpleAudioEngine.SharedEngine.BackgroundMusicVolume = 0.5f; Camera = AppDelegate.SharedCamera; }
public TestController() { // Add close menu closeMenuItem = new CCMenuItemImage(TestResource.s_pPathClose, TestResource.s_pPathClose, CloseCallback); closeMenu = new CCMenu(closeMenuItem); CCMenuItemFont.FontName = "MarkerFelt"; CCMenuItemFont.FontSize = 22; #if !PSM && !WINDOWS_PHONE #if NETFX_CORE versionLabel = new CCLabel("v" + this.GetType().GetAssemblyName().Version.ToString(), "arial", 30); #else versionLabel = new CCLabel("v" + this.GetType().Assembly.GetName().Version.ToString(), "fonts/arial", 24, CCLabelFormat.SpriteFont); #endif AddChild(versionLabel, 20000); #endif // Add test list menu testListMenu = new CCMenu(); var i = 0; foreach (var test in testCases.Keys) { var label = new CCLabel(test, "fonts/arial", 24, CCLabelFormat.SpriteFont); var menuItem = new CCMenuItemLabel(label, MenuCallback); testListMenu.AddChild(menuItem, i++ + MENU_ITEM_Z_ORDER); testListMenuItems.Add(menuItem); } LINE_SPACE = (int)(testListMenuItems[0].ContentSize.Height * 1.5f); #if XBOX || OUYA CCSprite sprite = new CCSprite("Images/aButton"); AddChild(sprite, 10001); menuIndicator = sprite; #endif AddChild(testListMenu); AddChild(closeMenu, 1); }
public override void OnEnter() { base.OnEnter(); var s = Layer.VisibleBoundsWorldspace.Size; var pMenu = new CCMenu(); pMenu.Position = CCPoint.Zero; CCMenuItemFont.FontSize = 24; CCMenuItemFont.FontName = "arial"; for (int i = 0; i < ExtensionsTestScene.TEST_MAX_COUNT; ++i) { var pItem = new CCMenuItemFont(ExtensionsTestScene.testsName[i], menuCallback); pItem.Position = new CCPoint(s.Width / 2, s.Height - (i + 1) * ExtensionsTestScene.LINE_SPACE); pMenu.AddChild(pItem, ExtensionsTestScene.kItemTagBasic + i); } AddChild(pMenu); }
public override void OnEnter() { base.OnEnter(); CCSize s = Layer.VisibleBoundsWorldspace.Size; CCMenu pMenu = new CCMenu(null); pMenu.Position = new CCPoint(0, 0); CCMenuItemFont.FontSize = 18; CCMenuItemFont.FontName = "arial"; for (int i = 0; i < PerformanceTestScene.MAX_COUNT; ++i) { CCMenuItemFont pItem = new CCMenuItemFont(PerformanceTestScene.testsName[i], menuCallback); pItem.Position = new CCPoint(s.Width / 2, s.Height - (i + 1) * PerformanceTestScene.LINE_SPACE); pMenu.AddChild(pItem, PerformanceTestScene.kItemTagBasic + i); } AddChild(pMenu); }
public TestController() { // Add close menu closeMenuItem = new CCMenuItemImage(TestResource.s_pPathClose, TestResource.s_pPathClose, CloseCallback); closeMenu = new CCMenu(closeMenuItem); CCMenuItemFont.FontName = "MarkerFelt"; CCMenuItemFont.FontSize = 22; #if !PSM && !WINDOWS_PHONE #if NETFX_CORE versionLabel = new CCLabelTtf("v" + this.GetType().GetAssemblyName().Version.ToString(), "arial", 30); #else versionLabel = new CCLabelTtf("v" + this.GetType().Assembly.GetName().Version.ToString(), "arial", 30); #endif AddChild(versionLabel, 20000); #endif // Add test list menu testListMenu = new CCMenu(); for (int i = 0; i < (int)(TestCases.TESTS_COUNT); ++i) { CCLabelTtf label = new CCLabelTtf(Tests.g_aTestNames[i], "arial", 50); CCMenuItem menuItem = new CCMenuItemLabelTTF(label, MenuCallback); testListMenu.AddChild(menuItem, i + MENU_ITEM_Z_ORDER); testListMenuItems.Add(menuItem); } #if XBOX || OUYA CCSprite sprite = new CCSprite("Images/aButton"); AddChild(sprite, 10001); menuIndicator = sprite; #endif AddChild(testListMenu); AddChild(closeMenu, 1); }
public override void OnEnter() { base.OnEnter(); CCSize s = Layer.VisibleBoundsWorldspace.Size; m_pItmeMenu = new CCMenu(null); for (int i = 0; i < BugsTestScene.MAX_COUNT; ++i) { CCMenuItemFont pItem = new CCMenuItemFont(BugsTestScene.testsName[i], menuCallback); pItem.Position = new CCPoint(s.Width / 2, s.Height - (i + 1) * BugsTestScene.LINE_SPACE); m_pItmeMenu.AddChild(pItem, BugsTestScene.kItemTagBasic + i); } m_pItmeMenu.Position = BugsTestScene.s_tCurPos; AddChild(m_pItmeMenu); // Register Touch Event var touchListener = new CCEventListenerTouchAllAtOnce(); touchListener.OnTouchesBegan = onTouchesBegan; touchListener.OnTouchesMoved = onTouchesMoved; AddEventListener(touchListener); }
public void initWithSubTest(int asubtest, int nNodes) { //srandom(0); subtestNumber = asubtest; m_pSubTest = new SubTest(); m_pSubTest.initWithSubTest(asubtest, this); CCSize s = Layer.VisibleBoundsWorldspace.Size; lastRenderedCount = 0; quantityNodes = 0; 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 - 65); 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, PerformanceSpriteTest.kTagInfoLayer); // add menu SpriteMenuLayer pMenu = new SpriteMenuLayer(true, PerformanceSpriteTest.TEST_COUNT, PerformanceSpriteTest.s_nSpriteCurCase); AddChild(pMenu, 1, PerformanceSpriteTest.kTagMenuLayer); // Sub Tests CCMenuItemFont.FontSize = 32; CCMenuItemFont.FontName = "arial"; CCMenu pSubMenu = new CCMenu(null); for (int i = 1; i <= 9; ++i) { //char str[10] = {0}; var str = string.Format("{0}", 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 if (i <= 6) itemFont.Color = new CCColor3B(0, 200, 20); else itemFont.Color = new CCColor3B(0, 20, 200); } pSubMenu.AlignItemsHorizontally(); pSubMenu.Position = new CCPoint(s.Width / 2, 80); AddChild(pSubMenu, 2); // add title label 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); while (quantityNodes < nNodes) onIncrease(this); }
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); }