Move tool stuff to tool.{h,cpp}
[oweals/minetest.git] / src / guiMainMenu.cpp
index 2d5bd151acadd87fcb84f0f436e076fb2a1f90b1..43ec85c8a94f68682007314d120a3c00b4ec4f4c 100644 (file)
@@ -22,7 +22,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "debug.h"
 #include "serialization.h"
 #include <string>
-
+#include <IGUICheckBox.h>
+#include <IGUIEditBox.h>
+#include <IGUIButton.h>
+#include <IGUIStaticText.h>
+#include <IGUIFont.h>
 
 
 #include "gettext.h"
@@ -76,6 +80,8 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
        bool enable_damage;
        bool fancy_trees;
        bool smooth_lighting;
+       bool clouds_3d;
+       bool opaque_water;
        
        // Client options
        {
@@ -113,6 +119,20 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
                else
                        smooth_lighting = m_data->smooth_lighting;
        }
+       {
+               gui::IGUIElement *e = getElementFromId(GUI_ID_3D_CLOUDS_CB);
+               if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
+                       clouds_3d = ((gui::IGUICheckBox*)e)->isChecked();
+               else
+                       clouds_3d = m_data->clouds_3d;
+       }
+       {
+               gui::IGUIElement *e = getElementFromId(GUI_ID_OPAQUE_WATER_CB);
+               if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
+                       opaque_water = ((gui::IGUICheckBox*)e)->isChecked();
+               else
+                       opaque_water = m_data->opaque_water;
+       }
        
        // Server options
        {
@@ -196,6 +216,8 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
                gui::IGUIEditBox *e =
                Environment->addEditBox(L"", rect, true, this, 264);
                e->setPasswordBox(true);
+               if(text_name != L"" && text_address != L"")
+                       Environment->setFocus(e);
 
        }
        changeCtype("");
@@ -212,7 +234,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
                rect += topleft_client + v2s32(160, 100);
                gui::IGUIElement *e = 
                Environment->addEditBox(text_address.c_str(), rect, true, this, GUI_ID_ADDRESS_INPUT);
-               if(text_name != L"")
+               if(text_name != L"" && text_address == L"")
                        Environment->setFocus(e);
        }
        {
@@ -236,10 +258,22 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
        }
        {
                core::rect<s32> rect(0, 0, 250, 30);
-               rect += topleft_client + v2s32(35, 150+30);
+               rect += topleft_client + v2s32(35, 150+20);
                Environment->addCheckBox(smooth_lighting, rect, this, GUI_ID_SMOOTH_LIGHTING_CB,
                                wgettext("Smooth Lighting"));
        }
+       {
+               core::rect<s32> rect(0, 0, 250, 30);
+               rect += topleft_client + v2s32(35, 150+40);
+               Environment->addCheckBox(clouds_3d, rect, this, GUI_ID_3D_CLOUDS_CB,
+                               wgettext("3D Clouds"));
+       }
+       {
+               core::rect<s32> rect(0, 0, 250, 30);
+               rect += topleft_client + v2s32(35, 150+60);
+               Environment->addCheckBox(opaque_water, rect, this, GUI_ID_OPAQUE_WATER_CB,
+                               wgettext("Opaque water"));
+       }
        // Start game button
        {
                core::rect<s32> rect(0, 0, 180, 30);
@@ -356,15 +390,25 @@ void GUIMainMenu::acceptInput()
                if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
                        m_data->enable_damage = ((gui::IGUICheckBox*)e)->isChecked();
        }
+       {
+               gui::IGUIElement *e = getElementFromId(GUI_ID_FANCYTREE_CB);
+               if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
+                       m_data->fancy_trees = ((gui::IGUICheckBox*)e)->isChecked();
+       }
        {
                gui::IGUIElement *e = getElementFromId(GUI_ID_SMOOTH_LIGHTING_CB);
                if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
                        m_data->smooth_lighting = ((gui::IGUICheckBox*)e)->isChecked();
        }
        {
-               gui::IGUIElement *e = getElementFromId(GUI_ID_FANCYTREE_CB);
+               gui::IGUIElement *e = getElementFromId(GUI_ID_3D_CLOUDS_CB);
                if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
-                       m_data->fancy_trees = ((gui::IGUICheckBox*)e)->isChecked();
+                       m_data->clouds_3d = ((gui::IGUICheckBox*)e)->isChecked();
+       }
+       {
+               gui::IGUIElement *e = getElementFromId(GUI_ID_OPAQUE_WATER_CB);
+               if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
+                       m_data->opaque_water = ((gui::IGUICheckBox*)e)->isChecked();
        }
        
        m_accepted = true;