utility.h: Change Buffer's interface to be more compatible with SharedBuffer's interf...
[oweals/minetest.git] / src / guiMainMenu.cpp
index fde71e4bc0d3b6c1d3a45eaca3286dcd51632822..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
        {
@@ -238,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);
@@ -358,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;