aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-03-15 18:15:12 +0200
committerPerttu Ahola <celeron55@gmail.com>2012-03-15 18:15:12 +0200
commit60add387e3f71f739b76268c74e8ded3f3b4584d (patch)
tree5d1a5854ff2adb11c0cf0b830cad83eaa5d84077
parentca0fd4173cb18dd54219a1e8f05ec412e4d707ec (diff)
downloadminetest-60add387e3f71f739b76268c74e8ded3f3b4584d.tar.gz
minetest-60add387e3f71f739b76268c74e8ded3f3b4584d.tar.bz2
minetest-60add387e3f71f739b76268c74e8ded3f3b4584d.zip
Create main menu tab "Settings" for client settings
-rw-r--r--src/guiMainMenu.cpp159
-rw-r--r--src/main.cpp5
2 files changed, 65 insertions, 99 deletions
diff --git a/src/guiMainMenu.cpp b/src/guiMainMenu.cpp
index 553d20018..6eefd82ba 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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<s32> 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 3e4686134..d08f88417 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."<<std::endl;
+ return 1;
+ }
+
// Gamespec
std::string world_gameid = getWorldGameId(world_path, is_legacy_world);
SubgameSpec gamespec = findSubgame(world_gameid);