Menu *MenuFactory::CreateChooseClassMenu(const sf::Vector2f &primaryDimensions) const { Menu *menu = new Menu(); MenuItem *item; item = new MenuItem(); item->SetText(AvatarClass::GetClassName(ClassType::Warrior)); menu->AddMenuItem(item); item = new MenuItem(); item->SetText(AvatarClass::GetClassName(ClassType::Rogue)); menu->AddMenuItem(item); item = new MenuItem(); item->SetText(AvatarClass::GetClassName(ClassType::Mage)); menu->AddMenuItem(item); item = new MenuItem(); item->SetText("Back"); menu->AddMenuItem(item); menu->SetPosition(75 + primaryDimensions.x, GameManager::GetInstance().GetResolution().y - menu->GetDimensions().y - 50); return menu; }
Menu *MenuFactory::CreateTempBattleMenu() const { Menu *menu = new Menu(); MenuItem *item; item = new MenuItem(); item->SetText("Choose Skill"); menu->AddMenuItem(item); item = new MenuItem(); item->SetText("Forfeit Match"); menu->AddMenuItem(item); menu->SetPosition(50, GameManager::GetInstance().GetResolution().y - menu->GetDimensions().y - 50); return menu; }
MenuItem* Menu::AddItem( const TextObject & strName, const TextObject & strIconName, const TextObject & strAccelerator ) { MenuItem* pItem = new MenuItem( this ); pItem->SetPadding( Padding( 2, 4, 4, 4 ) ); pItem->SetText( strName ); pItem->SetImage( strIconName ); pItem->SetAccelerator( strAccelerator ); OnAddItem( pItem ); return pItem; }
Menu *MenuFactory::CreateChooseAIDifficultyMenu(const sf::Vector2f &primaryDimensions) const { Menu *menu = new Menu(); MenuItem *item; for (auto &name : AIAvatar::DifficultyNames) { item = new MenuItem(); item->SetText(name); menu->AddMenuItem(item); } item = new MenuItem(); item->SetText("Back"); menu->AddMenuItem(item); menu->SetPosition(75 + primaryDimensions.x, GameManager::GetInstance().GetResolution().y - menu->GetDimensions().y - 50); return menu; }
Menu *MenuFactory::CreateMainMenu() const { Menu *menu = new Menu(); MenuItem *item; item = new MenuItem(); item->SetText("Start Game"); menu->AddMenuItem(item); item = new MenuItem(); item->SetText("Toggle Audio"); menu->AddMenuItem(item); item = new MenuItem(); item->SetText("Quit Game"); menu->AddMenuItem(item); menu->SetPosition(50, GameManager::GetInstance().GetResolution().y - menu->GetDimensions().y - 50); return menu; }
Menu *MenuFactory::CreateTempSkillsMenu(const sf::Vector2f &battleDimensions, const Skill *skillArray) const { Menu *menu = new Menu(); MenuItem *item; item = new MenuItem(); item->SetText(skillArray[0].name); menu->AddMenuItem(item); item = new MenuItem(); item->SetText(skillArray[1].name); menu->AddMenuItem(item); item = new MenuItem(); item->SetText(skillArray[2].name); menu->AddMenuItem(item); menu->SetPosition(75 + battleDimensions.x, GameManager::GetInstance().GetResolution().y - menu->GetDimensions().y - 50); return menu; }
/** * @brief * Adds a standard item with a text */ MenuItem *Menu::AddItem(const String &sText) { // Create item MenuItem *pItem = new MenuItem(*m_pGui); pItem->SetText(sText); // Add item AddItem(pItem); // Return item return pItem; }
MenuItem* Menu::AddItem(const std::string& name, const std::string& icon_name, const std::string& accelerator) { MenuItem* item = new MenuItem(this); item->SetPadding(Padding(2, 4, 4, 4)); item->SetText(name); item->SetImage(icon_name); item->SetAccelerator(accelerator); _OnAddItem(item); return item; }
MenuItem* Menu::AddItem( const Gwen::UnicodeString& strName, const UnicodeString& strIconName, Gwen::Event::Handler* pHandler, Gwen::Event::Handler::Function fn ) { MenuItem* pItem = new MenuItem( this ); pItem->SetText( strName ); pItem->SetImage( strIconName ); if ( fn && pHandler ) { pItem->onMenuItemSelected.Add( pHandler, fn ); } OnAddItem( pItem ); return pItem; }