From: Perttu Ahola Date: Thu, 15 Mar 2012 16:15:12 +0000 (+0200) Subject: Create main menu tab "Settings" for client settings X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=60add387e3f71f739b76268c74e8ded3f3b4584d;p=zefram%2Fminetest%2Fminetest_engine.git Create main menu tab "Settings" for client settings --- diff --git a/src/guiMainMenu.cpp b/src/guiMainMenu.cpp index 553d2001..6eefd82b 100644 --- a/src/guiMainMenu.cpp +++ b/src/guiMainMenu.cpp @@ -93,6 +93,7 @@ enum TAB_SINGLEPLAYER=0, TAB_MULTIPLAYER, TAB_ADVANCED, + TAB_SETTINGS, TAB_CREDITS }; @@ -212,6 +213,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) e->addTab(L"Singleplayer"); e->addTab(L"Multiplayer"); e->addTab(L"Advanced"); + e->addTab(L"Settings"); e->addTab(L"Credits"); e->setActiveTab(m_data->selected_tab); } @@ -305,49 +307,16 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) u32 option_w = 150; { core::rect rect(0, 0, option_w, 30); - rect += m_topleft_client + v2s32(option_x, option_y); - Environment->addCheckBox(m_data->fancy_trees, rect, this, - GUI_ID_FANCYTREE_CB, wgettext("Fancy trees")); - } - { - core::rect rect(0, 0, option_w, 30); - rect += m_topleft_client + v2s32(option_x, option_y+20); - Environment->addCheckBox(m_data->smooth_lighting, rect, this, - GUI_ID_SMOOTH_LIGHTING_CB, wgettext("Smooth Lighting")); - } - { - core::rect rect(0, 0, option_w, 30); - rect += m_topleft_client + v2s32(option_x, option_y+20*2); - Environment->addCheckBox(m_data->clouds_3d, rect, this, - GUI_ID_3D_CLOUDS_CB, wgettext("3D Clouds")); - } - { - core::rect rect(0, 0, option_w, 30); - rect += m_topleft_client + v2s32(option_x, option_y+20*3); - Environment->addCheckBox(m_data->opaque_water, rect, this, - GUI_ID_OPAQUE_WATER_CB, wgettext("Opaque water")); - } - { - core::rect rect(0, 0, option_w, 30); - rect += m_topleft_client + v2s32(option_x, option_y+20*4); + rect += m_topleft_client + v2s32(option_x, option_y+20*0); Environment->addCheckBox(m_data->creative_mode, rect, this, GUI_ID_CREATIVE_CB, wgettext("Creative Mode")); } { core::rect rect(0, 0, option_w, 30); - rect += m_topleft_client + v2s32(option_x, option_y+20*5); + rect += m_topleft_client + v2s32(option_x, option_y+20*1); Environment->addCheckBox(m_data->enable_damage, rect, this, GUI_ID_DAMAGE_CB, wgettext("Enable Damage")); } - // Key change button - { - core::rect rect(0, 0, 120, 30); - /*rect += m_topleft_client + v2s32(m_size_client.X-120-30, - m_size_client.Y-30-20);*/ - rect += m_topleft_client + v2s32(option_x, option_y+20*6+20); - Environment->addButton(rect, this, - GUI_ID_CHANGE_KEYS_BUTTON, wgettext("Change keys")); - } changeCtype("C"); } else if(m_data->selected_tab == TAB_MULTIPLAYER) @@ -413,38 +382,6 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) this, GUI_ID_PORT_INPUT); } changeCtype(""); - { - core::rect rect(0, 0, 250, 30); - rect += m_topleft_client + v2s32(35+30, 150); - Environment->addCheckBox(m_data->fancy_trees, rect, this, GUI_ID_FANCYTREE_CB, - wgettext("Fancy trees")); - } - { - core::rect rect(0, 0, 250, 30); - rect += m_topleft_client + v2s32(35+30, 150+20); - Environment->addCheckBox(m_data->smooth_lighting, rect, this, GUI_ID_SMOOTH_LIGHTING_CB, - wgettext("Smooth Lighting")); - } - { - core::rect rect(0, 0, 250, 30); - rect += m_topleft_client + v2s32(35+30, 150+40); - Environment->addCheckBox(m_data->clouds_3d, rect, this, GUI_ID_3D_CLOUDS_CB, - wgettext("3D Clouds")); - } - { - core::rect rect(0, 0, 250, 30); - rect += m_topleft_client + v2s32(35+30, 150+60); - Environment->addCheckBox(m_data->opaque_water, rect, this, GUI_ID_OPAQUE_WATER_CB, - wgettext("Opaque water")); - } - // Key change button - { - core::rect rect(0, 0, 120, 30); - rect += m_topleft_client + v2s32(m_size_client.X-180-30-120-20, - m_size_client.Y-30-20); - Environment->addButton(rect, this, GUI_ID_CHANGE_KEYS_BUTTON, - wgettext("Change keys")); - } // Start game button { core::rect rect(0, 0, 180, 30); @@ -524,38 +461,6 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) Environment->addStaticText(wgettext("Leave address blank to start a local server."), rect, false, true, this, -1); } - { - core::rect rect(0, 0, 250, 30); - rect += m_topleft_client + v2s32(35+30, 150); - Environment->addCheckBox(m_data->fancy_trees, rect, this, GUI_ID_FANCYTREE_CB, - wgettext("Fancy trees")); - } - { - core::rect rect(0, 0, 250, 30); - rect += m_topleft_client + v2s32(35+30, 150+20); - Environment->addCheckBox(m_data->smooth_lighting, rect, this, GUI_ID_SMOOTH_LIGHTING_CB, - wgettext("Smooth Lighting")); - } - { - core::rect rect(0, 0, 250, 30); - rect += m_topleft_client + v2s32(35+30, 150+40); - Environment->addCheckBox(m_data->clouds_3d, rect, this, GUI_ID_3D_CLOUDS_CB, - wgettext("3D Clouds")); - } - { - core::rect rect(0, 0, 250, 30); - rect += m_topleft_client + v2s32(35+30, 150+60); - Environment->addCheckBox(m_data->opaque_water, rect, this, GUI_ID_OPAQUE_WATER_CB, - wgettext("Opaque water")); - } - // Key change button - { - core::rect rect(0, 0, 120, 30); - rect += m_topleft_client + v2s32(m_size_client.X-180-30-120-20, - m_size_client.Y-30-20); - Environment->addButton(rect, this, GUI_ID_CHANGE_KEYS_BUTTON, - wgettext("Change keys")); - } // Start game button { core::rect rect(0, 0, 180, 30); @@ -618,6 +523,54 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) } changeCtype("C"); } + else if(m_data->selected_tab == TAB_SETTINGS) + { + { + core::rect rect(0, 0, 20, 300); + rect += m_topleft_client + v2s32(15, 50); + const wchar_t *text = L"S\nE\nT\nT\nI\nN\nG\nS"; + //gui::IGUIStaticText *t = + Environment->addStaticText(text, rect, false, true, this, -1); + //t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); + } + s32 option_x = 70; + s32 option_y = 50; + u32 option_w = 150; + { + core::rect rect(0, 0, option_w, 30); + rect += m_topleft_client + v2s32(option_x, option_y); + Environment->addCheckBox(m_data->fancy_trees, rect, this, + GUI_ID_FANCYTREE_CB, wgettext("Fancy trees")); + } + { + core::rect rect(0, 0, option_w, 30); + rect += m_topleft_client + v2s32(option_x, option_y+20); + Environment->addCheckBox(m_data->smooth_lighting, rect, this, + GUI_ID_SMOOTH_LIGHTING_CB, wgettext("Smooth Lighting")); + } + { + core::rect rect(0, 0, option_w, 30); + rect += m_topleft_client + v2s32(option_x, option_y+20*2); + Environment->addCheckBox(m_data->clouds_3d, rect, this, + GUI_ID_3D_CLOUDS_CB, wgettext("3D Clouds")); + } + { + core::rect rect(0, 0, option_w, 30); + rect += m_topleft_client + v2s32(option_x, option_y+20*3); + Environment->addCheckBox(m_data->opaque_water, rect, this, + GUI_ID_OPAQUE_WATER_CB, wgettext("Opaque water")); + } + // Key change button + { + core::rect rect(0, 0, 120, 30); + /*rect += m_topleft_client + v2s32(m_size_client.X-120-30, + m_size_client.Y-30-20);*/ + rect += m_topleft_client + v2s32(option_x, option_y+120); + Environment->addButton(rect, this, + GUI_ID_CHANGE_KEYS_BUTTON, wgettext("Change keys")); + } + changeCtype("C"); + } else if(m_data->selected_tab == TAB_CREDITS) { // CREDITS @@ -686,6 +639,14 @@ void GUIMainMenu::drawMenu() driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect); } } + else if(getTab() == TAB_SETTINGS) + { + { + core::rect rect(0, 0, m_size_client.X, m_size_client.Y); + rect += AbsoluteRect.UpperLeftCorner + m_topleft_client; + driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect); + } + } else if(getTab() == TAB_CREDITS) { { diff --git a/src/main.cpp b/src/main.cpp index 3e468613..d08f8841 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1043,6 +1043,11 @@ int main(int argc, char *argv[]) } } + if(world_path == ""){ + errorstream<<"No world path specified or found."<