diff options
author | PilzAdam <pilzadam@minetest.net> | 2013-05-11 16:08:01 +0200 |
---|---|---|
committer | PilzAdam <pilzadam@minetest.net> | 2013-05-13 17:06:08 +0200 |
commit | efc9329033ece46f04c5aaee3e34c49eb482eaa3 (patch) | |
tree | 3553c28db051247a781e9b49bfe2a388c1fb2064 /src/guiMainMenu.cpp | |
parent | 2c09e8a84cac653b85bba3c85d781e24b5d6f4f8 (diff) | |
download | minetest-efc9329033ece46f04c5aaee3e34c49eb482eaa3.tar.gz minetest-efc9329033ece46f04c5aaee3e34c49eb482eaa3.tar.bz2 minetest-efc9329033ece46f04c5aaee3e34c49eb482eaa3.zip |
Only use game filter in singleplayer tab; use menu_{background, overlay, header, footer}.png for other tabs
Diffstat (limited to 'src/guiMainMenu.cpp')
-rw-r--r-- | src/guiMainMenu.cpp | 53 |
1 files changed, 22 insertions, 31 deletions
diff --git a/src/guiMainMenu.cpp b/src/guiMainMenu.cpp index 9966b9fa7..36685db84 100644 --- a/src/guiMainMenu.cpp +++ b/src/guiMainMenu.cpp @@ -166,15 +166,6 @@ enum GUI_ID_GAME_BUTTON_MAX = 150, }; -enum -{ - TAB_SINGLEPLAYER=0, - TAB_MULTIPLAYER, - TAB_ADVANCED, - TAB_SETTINGS, - TAB_CREDITS -}; - GUIMainMenu::GUIMainMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent, s32 id, IMenuManager *menumgr, @@ -258,7 +249,8 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) core::rect<s32> rect(0, 0, size.X, 40); rect += v2s32(4, 0); std::string t = "Minetest " VERSION_STRING; - if(m_data->selected_game_name != ""){ + if(m_data->selected_game_name != "" && + m_data->selected_tab == TAB_SINGLEPLAYER){ t += "/"; t += m_data->selected_game_name; } @@ -428,6 +420,26 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) delete[] text; } changeCtype("C"); + + /* Add game selection buttons */ + video::IVideoDriver* driver = Environment->getVideoDriver(); + for(size_t i=0; i<m_data->games.size(); i++){ + const SubgameSpec *spec = &m_data->games[i]; + v2s32 p(8 + i*(48+8), screensize.Y - (48+8)); + core::rect<s32> rect(0, 0, 48, 48); + rect += p; + video::ITexture *bgtexture = NULL; + if(spec->menuicon_path != "") + bgtexture = driver->getTexture(spec->menuicon_path.c_str()); + gui::IGUIButton *b = Environment->addButton(rect, this, + GUI_ID_GAME_BUTTON_FIRST+i, narrow_to_wide(wrap_rows(spec->id, 4)).c_str()); + if(bgtexture){ + b->setImage(bgtexture); + b->setText(L""); + b->setDrawBorder(false); + b->setUseAlphaChannel(true); + } + } } else if(m_data->selected_tab == TAB_MULTIPLAYER) { @@ -920,27 +932,6 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) } } - /* Add game selection buttons */ - - video::IVideoDriver* driver = Environment->getVideoDriver(); - for(size_t i=0; i<m_data->games.size(); i++){ - const SubgameSpec *spec = &m_data->games[i]; - v2s32 p(8 + i*(48+8), screensize.Y - (48+8)); - core::rect<s32> rect(0, 0, 48, 48); - rect += p; - video::ITexture *bgtexture = NULL; - if(spec->menuicon_path != "") - bgtexture = driver->getTexture(spec->menuicon_path.c_str()); - gui::IGUIButton *b = Environment->addButton(rect, this, - GUI_ID_GAME_BUTTON_FIRST+i, narrow_to_wide(wrap_rows(spec->id, 4)).c_str()); - if(bgtexture){ - b->setImage(bgtexture); - b->setText(L""); - b->setDrawBorder(false); - b->setUseAlphaChannel(true); - } - } - m_is_regenerating = false; } |