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.AlignItemsVerticallyWithPadding(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 = CCDirector.SharedDirector.WinSize; CCMenuItemFont.FontName = "arial"; CCMenuItemFont.FontSize = 24; 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 CocosDenshionTest() { m_pItmeMenu = null; m_tBeginPos = new CCPoint(0,0); m_nSoundId = 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" }; // add menu items for tests m_pItmeMenu = new CCMenu(null); CCSize s = CCDirector.SharedDirector.WinSize; m_nTestCount = testItems.Count<string>(); for (int i = 0; i < m_nTestCount; ++i) { CCLabelTTF label = new CCLabelTTF(testItems[i], "arial", 24); CCMenuItemLabel pMenuItem = CCMenuItemLabel.Create(label, new SEL_MenuHandler(menuCallback)); m_pItmeMenu.AddChild(pMenuItem, i + 10000); pMenuItem.Position = new CCPoint( s.Width / 2, (s.Height - (i + 1) * LINE_SPACE) ); } m_pItmeMenu.ContentSize = new CCSize(s.Width, (m_nTestCount + 1) * LINE_SPACE); m_pItmeMenu.Position = new CCPoint(0,0); AddChild(m_pItmeMenu); this.TouchEnabled = true; // preload background music and effect SimpleAudioEngine.SharedEngine.PreloadBackgroundMusic(CCFileUtils.FullPathFromRelativePath(MUSIC_FILE)); SimpleAudioEngine.SharedEngine.PreloadEffect(CCFileUtils.FullPathFromRelativePath(EFFECT_FILE)); // set default volume SimpleAudioEngine.SharedEngine.EffectsVolume = 0.5f; SimpleAudioEngine.SharedEngine.BackgroundMusicVolume = 0.5f; }
public override void OnEnter() { base.OnEnter(); CCSize s = CCDirector.SharedDirector.WinSize; CCMenu pMenu = new CCMenu(null); pMenu.Position = new CCPoint(0, 0); CCMenuItemFont.FontName = "arial"; CCMenuItemFont.FontSize = 24; 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 override void OnEnter() { base.OnEnter(); var s = CCDirector.SharedDirector.WinSize; var pMenu = new CCMenu(); pMenu.Position = CCPoint.Zero; CCMenuItemFont.FontName = "arial"; CCMenuItemFont.FontSize = 24; 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 = CCDirector.SharedDirector.WinSize; m_pItmeMenu = new CCMenu(null); CCMenuItemFont.FontName = "arial"; CCMenuItemFont.FontSize = 24; for (int i = 0; i < BugsTestScene.MAX_COUNT; ++i) { CCMenuItemFont pItem = CCMenuItemFont.Create(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); TouchEnabled = true; }
public TestController() { // add close menu var pCloseItem = new CCMenuItemImage(TestResource.s_pPathClose, TestResource.s_pPathClose, closeCallback); var pMenu = new CCMenu(pCloseItem); var s = CCDirector.SharedDirector.WinSize; #if !XBOX && !OUYA TouchEnabled = true; #else GamePadEnabled = true; KeypadEnabled = true; #endif #if WINDOWS || MONOMAC GamePadEnabled = true; #endif pMenu.Position = new CCPoint(0.0f, 0.0f); pCloseItem.Position = new CCPoint(s.Width - 30, s.Height - 30); #if !PSM && !WINDOWS_PHONE #if NETFX_CORE CCLabelTTF versionLabel = new CCLabelTTF("v" + this.GetType().GetAssemblyName().Version.ToString(), "arial", 12); #else CCLabelTTF versionLabel = new CCLabelTTF("v" + this.GetType().Assembly.GetName().Version.ToString(), "arial", 12); #endif versionLabel.Position = new CCPoint(versionLabel.ContentSizeInPixels.Width/2f, s.Height - 18f); versionLabel.HorizontalAlignment = CCTextAlignment.CCTextAlignmentLeft; AddChild(versionLabel, 20000); #endif // add menu items for tests m_pItemMenu = new CCMenu(); for (int i = 0; i < (int)(TestCases.TESTS_COUNT); ++i) { var label = new CCLabelTTF(Tests.g_aTestNames[i], "arial", 24); var pMenuItem = CCMenuItemLabel.Create(label, menuCallback); pMenuItem.UserData = i; m_pItemMenu.AddChild(pMenuItem, 10000); #if XBOX || OUYA pMenuItem.Position = new CCPoint(s.Width / 2, -(i + 1) * LINE_SPACE); #else pMenuItem.Position = new CCPoint(s.Width / 2, (s.Height - (i + 1) * LINE_SPACE)); #endif _Items.Add(pMenuItem); } m_pItemMenu.ContentSize = new CCSize(s.Width, ((int)TestCases.TESTS_COUNT + 1) * LINE_SPACE); #if XBOX || OUYA CCSprite sprite = new CCSprite("Images/aButton"); AddChild(sprite, 10001); _menuIndicator = sprite; // Center the menu on the first item so that it is // in the center of the screen _HomePosition = new CCPoint(0f, s.Height / 2f + LINE_SPACE / 2f); _LastPosition = new CCPoint(0f, _HomePosition.Y - (_Items.Count - 1) * LINE_SPACE); #else _HomePosition = s_tCurPos; #endif m_pItemMenu.Position = _HomePosition; AddChild(m_pItemMenu); AddChild(pMenu, 1); _GamePadDPadDelegate = new CCGamePadDPadDelegate(MyOnGamePadDPadUpdate); _GamePadButtonDelegate = new CCGamePadButtonDelegate(MyOnGamePadButtonUpdate); // set the first one to have the selection highlight _CurrentItemIndex = 0; SelectMenuItem(); }
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 = CCMenuItemFont.Create(" - ", onDecrease); decrease.Color = new CCColor3B(0, 200, 20); CCMenuItemFont increase = CCMenuItemFont.Create(" + ", 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 = CCLabelAtlas.Create("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 = CCMenuItemFont.Create(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 void initWithSubTest(int asubtest, int nNodes) { //srandom(0); subtestNumber = asubtest; m_pSubTest = new SubTest(); m_pSubTest.initWithSubTest(asubtest, this); CCSize s = CCDirector.SharedDirector.WinSize; lastRenderedCount = 0; quantityNodes = 0; 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 - 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; 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); }