PrimaryMenu::PrimaryMenu(Graphics &g, int x, int y, Font* font, SDL_Color fontclr) { _fontColor = fontclr; _font = font; _x = x; _y = y; _selection = 0; for (int i = 0; i < (sizeof(_options) / sizeof(*_options)); i++) { _buttons.push_back(MenuButton(g, *_font, _options[i], _fontColor, g.w / 2, g.h / 2 + (i * 30) + 10)); } for (int i = 0; i < (sizeof(_modeOptions) / sizeof(*_modeOptions)); i++) { _modeButtons.push_back(MenuButton(g, *_font, _modeOptions[i], _fontColor, g.w / 1.2, g.h / 2 + (i * 30) + 10)); } }
//--------------------------------------------------------------------- __fastcall TSynchronizeChecklistDialog::TSynchronizeChecklistDialog( TComponent * AOwner, TSynchronizeMode Mode, int Params, const UnicodeString LocalDirectory, const UnicodeString RemoteDirectory, TCustomCommandMenuEvent OnCustomCommandMenu) : TForm(AOwner) { FFormRestored = false; FMode = Mode; FParams = Params; FLocalDirectory = ExcludeTrailingBackslash(LocalDirectory); FRemoteDirectory = UnixExcludeTrailingBackslash(RemoteDirectory); FOnCustomCommandMenu = OnCustomCommandMenu; UseSystemSettings(this); UseDesktopFont(ListView); UseDesktopFont(StatusBar); FChecklist = NULL; FChangingItem = NULL; FChangingItemIgnore = false; FChangingItemMass = false; FGeneralHint = StatusBar->Hint; FOrigListViewWindowProc = ListView->WindowProc; ListView->WindowProc = ListViewWindowProc; FSystemImageList = SharedSystemImageList(false); ListView->SmallImages = FSystemImageList; // header images mut be assigned after the small images, so it cannot // be done via DFM ListView->HeaderImages = ArrowImages; CustomCommandsButton->Visible = (FOnCustomCommandMenu != NULL); MenuButton(CustomCommandsButton); }
MainMenu::MainMenu(Graphics &g) : _waitTime(680) { _font = Font(g, "media/fonts/journal.ttf", 48); _arrow = Splash(g, "media/menuarrow.png", 255); _scroll = Splash(g, "media/scroll2.png", 255); _splash = Splash(g, "media/Splash.png", 255); _mountain1 = Splash(g, "media/mountain1.png", 255); _mountain1.scrolling = true; _mountain2 = Splash(g, "media/mountain2.png", 255); _mountain2.scrolling = true; _mountain3 = Splash(g, "media/mountain3.png", 255); _mountain3.scrolling = true; _sky = Splash(g, "media/sky.png", 255); _fog = Splash(g, "media/fog.png", 215); _fog.scrolling = true; _mountain1.setVelocity(-0.85f, 0); _mountain2.setVelocity(-0.43f, 0); _mountain3.setVelocity(-0.11f, 0); _fog.setVelocity(-0.41f, 0); _logo = Splash(g, "media/Splashu.png", 255); _subMenus.push_back(new PrimaryMenu(g, 0, 0, &_font, _fontColor)); _subMenus.push_back(new Options(g, 0, 0, &_font, _fontColor)); _textSplash = MenuButton(g, _font, "THE ENDLESS EMPIRES", _fontColor, g.w / 2, 30); _music = Mix_LoadWAV("media/music/mystery.wav"); Mix_PlayChannel(1, _music, -1); if (_music == NULL) g.showMsgBox("Failed to load music!"); }
//--------------------------------------------------------------------------- void __fastcall CopyParamListButton(TButton * Button) { if (!SupportsSplitButton()) { MenuButton(Button); } }
bool MainMenu::AddAllButtons() { m_menuButtons["Play"] = MenuButton( 400, 100, 0, 0, 200, 70, MenuActions::StartTetris); m_menuButtons["Options"] = MenuButton ( 400, 200, 0, 100, 200, 70, MenuActions::Options); m_menuButtons["Credits"] = MenuButton(400, 300, 0, 200, 200, 70, MenuActions::Credits); m_menuButtons["Exit"] = MenuButton(400, 400, 0, 300, 200, 70, MenuActions::Exit); return true; }
void CSkinManager::RefreshAllSkins(bool bReload) { Combo()->Refresh(); MainFrame()->Refresh(); FavorBar()->Refresh(); MenuBar()->Refresh(); Tab()->Refresh(); Category()->Refresh(); Toolbar()->Refresh(); HelpButton()->Refresh(); LoadButton()->Refresh(); LoginButton()->Refresh(); SepButton()->Refresh(); SettingButton()->Refresh(); BigButton()->Refresh(); SSLLockButton()->Refresh(); StatusBar()->Refresh(); Tooltip()->Refresh(); MenuButton()->Refresh(); LogoButton()->Refresh(); Common()->Refresh(bReload); BackButton()->Refresh(); ForwardButton()->Refresh(); RefreshButton()->Refresh(); CoolMenuSkin()->Refresh(); }
void GameScreen::update(float delta) { if (GameManager::sharedGameManager()->isGameLive) { GameState(); GameManager::sharedGameManager()->SetSantaPos(_santa->getPositionX(), _santa->getPositionY()); //Checked Paused if (GameManager::sharedGameManager()->isPaused == true) { MenuButton(); } //Collide with Santa if (_platform->CheckDirtPlatformCol(_santa->getBoundingBox()))//Check santa collision with dirt platform { CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("Assets/Sounds/Jump.mp3"); GameManager::sharedGameManager()->SetJump(20); } if (_platform->CheckIcePlatformCol(_santa->getBoundingBox())) //Check santa collision with ice platform { CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("Assets/Sounds/Jump.mp3"); GameManager::sharedGameManager()->SetJump(10); } if (_powerUp->CheckPowerUpCol(_santa->getBoundingBox())) //Check santa collision with powerUp { CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("Assets/Sounds/Jump.mp3"); GameManager::sharedGameManager()->SetJump(40); } Vec2 currentPos = _santa->getPosition(); _santa->setPosition(currentPos.x, currentPos.y + GameManager::sharedGameManager()->GetJump()); //Change jump to fall if (GameManager::sharedGameManager()->GetJump() > -20) { GameManager::sharedGameManager()->DecrementJump(1); } //Santa Death if ((_santa->getPosition().y - _santa->getContentSize().height / 5) <= _winSizeH * -0.01f) { DeathsScreen(); } //Update Santa X Pos CCSize _winSize = CCDirector::sharedDirector()->getWinSize(); float maxX = _winSize.width - (_santa->getContentSize().width / 4); float minX =_santa->getContentSize().width / 2; float diff = (_santaPointsPerSecX * delta); float newX = _santa->getPosition().x + diff; newX = MIN(MAX(newX, minX), maxX); _santa->setPosition(Vec2(newX, _santa->getPosition().y)); } }
bool TetrisScreen::AddAllButtons() { m_menuButtons["StartTetris"] = MenuButton(400, 200, 0, 400, 200, 70, MenuActions::StartNewGame); // this does nothing unless game starts // when game starts then action of this button is changed m_menuButtons["Pause"] = MenuButton( 400, 300, 0, 500, 200, 70, MenuActions::Nothing); m_menuButtons["Exit"] = MenuButton(400, 400, 0, 300, 200, 70, MenuActions::Exit); m_menuButtons["Unmute"] = MenuButton(950, 650, 297, 0, 45,45, MenuActions::Unmute); m_menuButtons["Mute"] = MenuButton(950, 650 + 45, 297, 45, 45, 45, MenuActions::Mute); // this is not drawn at the start m_menuButtons["NewGame"] = MenuButton(400, 200, 0, 600, 200, 70, MenuActions::StartNewGame); m_menuButtons["NewGame"].setIsActive(false); // does nothing unless game starts m_menuButtons["Unpause"] = MenuButton(400, 300, 300, 100, 200, 70, MenuActions::Play); m_menuButtons["Unpause"].setIsActive(false); return true; }
void PopUpMenu::add_item(String p_text, const Method& p_method,int p_shortcut,bool p_shortcut_active) { MenuButton *mb = vbc->add( GUI_NEW(MenuButton(p_text)), 0 ); mb->set_id( id_count++ ); mb->pressed_signal.connect( p_method ); mb->set_shurtcut( p_shortcut, p_shortcut_active ); vbc->adjust_minimum_size(); mb->menubutton_pressed_signal.connect( this, &PopUpMenu::menu_button_selected ); }
void PopUpMenu::add_item(String p_text, int p_ID, void *p_userdata,int p_shortcut,bool p_shortcut_active) { MenuButton *mb = vbc->add( GUI_NEW(MenuButton(p_text)), 0 ); mb->set_id( p_ID ); mb->set_userdata( p_userdata ); mb->set_shurtcut( p_shortcut, p_shortcut_active ); id_count=p_ID+1; vbc->adjust_minimum_size(); mb->menubutton_pressed_signal.connect( this, &PopUpMenu::menu_button_selected ); }
void PopUpMenu::add_check_item(BitmapID p_icon, String p_text, const Method1<bool>& p_method, bool p_checked) { MenuButton *mb = vbc->add( GUI_NEW(MenuButton(p_text,p_icon,true)), 0 ); mb->set_id( id_count++ ); mb->toggled_signal.connect( p_method ); mb->set_checked(p_checked); vbc->adjust_minimum_size(); mb->menubutton_toggled_signal.connect( this, &PopUpMenu::menu_button_toggled ); }
void PopUpMenu::add_check_item(String p_text, bool p_checked,void *p_userdata) { MenuButton *mb = vbc->add( GUI_NEW(MenuButton(p_text,-1,true)), 0 ); mb->set_id( id_count++ ); mb->set_userdata( p_userdata ); mb->set_checked(p_checked); vbc->adjust_minimum_size(); mb->menubutton_toggled_signal.connect( this, &PopUpMenu::menu_button_toggled ); }
void PopUpMenu::add_check_item(BitmapID p_icon, String p_text, int p_ID, bool p_checked,void *p_userdata) { MenuButton *mb = vbc->add( GUI_NEW(MenuButton(p_text,p_icon,true)), 0 ); mb->set_id( p_ID ); mb->set_userdata( p_userdata ); mb->set_checked(p_checked); id_count=p_ID+1; vbc->adjust_minimum_size(); mb->menubutton_toggled_signal.connect( this, &PopUpMenu::menu_button_toggled ); }
void ProcessButton(byte bt){ switch (buttons[bt]) { case MENU_BUTTON: MenuButton(); break; case UP_BUTTON: UpButton(NowMenu); break; case DOWN_BUTTON: DownButton(NowMenu); break; case LIGHT_BUTTON: digitalWrite(LCD_LIGHT, !digitalRead(LCD_LIGHT)); break; } };
int main(int argc, char* argv[]) { app = Gtk::Application::create(argc, argv, "com.squgeim.typer"); try { builder = Gtk::Builder::create_from_file("glade.xml"); } catch(const Glib::FileError& ex) { std::cerr<<"FileError: "<<ex.what()<<std::endl; return -1; } catch(const Glib::MarkupError& ex) { std::cerr<<"MarkupError: "<<ex.what()<<std::endl; return -1; } catch(const Gtk::BuilderError& ex) { std::cerr<<"BuilderError: "<<ex.what()<<std::endl; return -1; } try { myWidget <Gtk::Window> mainwin("main"); MenuButton menu[4]; for(int i=0;i<4;i++) menu[i]=MenuButton(MenuButton::menubtns[i]); for(int i=0;i<4;i++) pages[i]=Page(Page::pgs[i]); pages[4]=Page("welcome"); myWidget <Gtk::Button> filestart("filestart"); filestart->signal_clicked().connect(sigc::ptr_fun(startfile)); app->run(*mainwin.rtr()); //app->run(*(mainwin->)); } catch(int) { std::cerr<<"The main window was not found in the xml."<<std::endl; return -1; } }
MainMenu::MainMenu(sf::RenderWindow &w, Controller* parentApp) :Controller(w), usernameTextBox(&font, sf::Vector2f(0, 0), sf::Vector2f(100, 50)), serverIpTextBox(&font, sf::Vector2f(0, 0), sf::Vector2f(100, 30), 2), portTextBox(&font, sf::Vector2f(0, 0), sf::Vector2f(100, 30), 2) { app = parentApp; if(!buttonTexture.loadFromFile(resourcePath() + "button.png")) { return; } if (!font.loadFromFile(resourcePath() + "sansation.ttf")) { return; } sf::Vector2u screenSize = window->getSize(); // Home pages.push_back(MenuPage()); pages[0].labels.push_back(sf::Text("Home Page", font, 100)); sf::FloatRect rect = pages[0].labels[0].getGlobalBounds(); pages[0].labels[0].setPosition(screenSize.x/2.0 - rect.width/2.0, screenSize.x/10.0); pages[0].buttons.push_back(MenuButton("Log In", &buttonTexture, &font)); pages[0].buttons[0].size = screenSize.x/3.0; pages[0].buttons[0].center(screenSize); pages[0].buttons[0].y += screenSize.x/15.0; pages[0].buttons.push_back(MenuButton("Single Player", &buttonTexture, &font)); pages[0].buttons[1].size = screenSize.x/3.0; pages[0].buttons[1].center(screenSize); // Login pages.push_back(MenuPage()); pages[1].labels.push_back(sf::Text("Log In", font, 100)); rect = pages[1].labels[0].getGlobalBounds(); pages[1].labels[0].setPosition(screenSize.x/2.0 - rect.width/2.0, screenSize.x/10.0); pages[1].buttons.push_back(MenuButton("Back", &buttonTexture, &font)); pages[1].buttons[0].size = screenSize.x/3.0; pages[1].buttons[0].x = 0; pages[1].buttons[0].y = 0; pages[1].buttons.push_back(MenuButton("Sign In", &buttonTexture, &font)); pages[1].buttons[1].size = screenSize.x/3.0; pages[1].buttons[1].center(screenSize); pages[1].buttons[1].y += screenSize.x/7.5; pages[1].labels.push_back(sf::Text("Username:"******"Server IP:", font, 50)); rect = pages[1].labels[2].getGlobalBounds(); pages[1].labels[2].setPosition(0.0, screenSize.y/2.0 - 30); serverIpTextBox.setSize(screenSize.x/2.0, screenSize.x/20.0); serverIpTextBox.center(screenSize); serverIpTextBox.maxCharacterLength = 20; pages[1].labels.push_back(sf::Text("Port #:", font, 50)); rect = pages[1].labels[3].getGlobalBounds(); pages[1].labels[3].setPosition(0.0, screenSize.y/2.0 + screenSize.x/15.0 - 30); portTextBox.setSize(screenSize.x/2.0, screenSize.x/20.0); portTextBox.center(screenSize); portTextBox.setPosition(portTextBox.getPosition().x, portTextBox.getPosition().y + screenSize.x/15.0); portTextBox.maxCharacterLength = 5; // Single Player pages.push_back(MenuPage()); pages[2].labels.push_back(sf::Text("Single Player", font, 100)); rect = pages[2].labels[0].getGlobalBounds(); pages[2].labels[0].setPosition(screenSize.x/2.0 - rect.width/2.0, screenSize.x/10.0); pages[2].buttons.push_back(MenuButton("Back", &buttonTexture, &font)); pages[2].buttons[0].size = screenSize.x/3.0; pages[2].buttons[0].x = 0; pages[2].buttons[0].y = 0; }
MenuButton SpriteManager::getButton(std::string t_name) { if (m_buttons.count(t_name)) return m_buttons[t_name]; return MenuButton(); }