Add checkboxes for shaders and on-demand item visual generation
authorobneq <obbneq@gmail.com>
Sat, 1 Dec 2012 22:08:35 +0000 (00:08 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Sat, 1 Dec 2012 22:52:35 +0000 (00:52 +0200)
src/guiMainMenu.cpp
src/guiMainMenu.h
src/main.cpp

index 0bdb44e5d80b5959a77ba1456f1252785597d027..c711577b037600b939f777a945ce9044710e857c 100644 (file)
@@ -102,6 +102,8 @@ enum
        GUI_ID_ANISOTROPIC_CB,
        GUI_ID_BILINEAR_CB,
        GUI_ID_TRILINEAR_CB,
+       GUI_ID_SHADERS_CB,
+       GUI_ID_PRELOAD_ITEM_VISUALS_CB,
        GUI_ID_DAMAGE_CB,
        GUI_ID_CREATIVE_CB,
        GUI_ID_JOIN_GAME_BUTTON,
@@ -616,6 +618,21 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
                                       GUI_ID_TRILINEAR_CB, wgettext("Tri-Linear Filtering"));
                }
 
+               // shader/on demand image loading settings
+               {
+                       core::rect<s32> rect(0, 0, option_w+20, 30);
+                       rect += m_topleft_client + v2s32(option_x+175*2, option_y);
+                       Environment->addCheckBox(m_data->enable_shaders, rect, this,
+                                       GUI_ID_SHADERS_CB, wgettext("Shaders"));
+               }
+
+               {
+                       core::rect<s32> rect(0, 0, option_w+20+20, 30);
+                       rect += m_topleft_client + v2s32(option_x+175*2, option_y+20);
+                       Environment->addCheckBox(m_data->preload_item_visuals, rect, this,
+                                       GUI_ID_PRELOAD_ITEM_VISUALS_CB, wgettext("Preload item visuals"));
+               }
+
                // Key change button
                {
                        core::rect<s32> rect(0, 0, 120, 30);
@@ -820,6 +837,18 @@ void GUIMainMenu::readInput(MainMenuData *dst)
                        dst->trilinear_filter = ((gui::IGUICheckBox*)e)->isChecked();
        }
 
+       {
+               gui::IGUIElement *e = getElementFromId(GUI_ID_SHADERS_CB);
+               if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
+                       dst->enable_shaders = ((gui::IGUICheckBox*)e)->isChecked() ? 2 : 0;
+       }
+
+       {
+               gui::IGUIElement *e = getElementFromId(GUI_ID_PRELOAD_ITEM_VISUALS_CB);
+               if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
+                       dst->preload_item_visuals = ((gui::IGUICheckBox*)e)->isChecked();
+       }
+
        {
                gui::IGUIElement *e = getElementFromId(GUI_ID_WORLD_LISTBOX);
                if(e != NULL && e->getType() == gui::EGUIET_LIST_BOX)
index abfc6bdb494141d4582fb1a7ecab9c5c3cfe2098..604202461dad6f02c0bca168cc67f077d052cdb3 100644 (file)
@@ -45,6 +45,8 @@ struct MainMenuData
        bool anisotropic_filter;
        bool bilinear_filter;
        bool trilinear_filter;
+       int enable_shaders;
+       bool preload_item_visuals;
        // Server options
        bool creative_mode;
        bool enable_damage;
index dcc47cd6b8cae56a75f5148bd9ed1be0040e8e4e..73757cbecd56fd4b72d5c98fe10af4663323346e 100644 (file)
@@ -1440,6 +1440,8 @@ int main(int argc, char *argv[])
                                menudata.anisotropic_filter = g_settings->getBool("anisotropic_filter");
                                menudata.bilinear_filter = g_settings->getBool("bilinear_filter");
                                menudata.trilinear_filter = g_settings->getBool("trilinear_filter");
+                               menudata.enable_shaders = g_settings->getS32("enable_shaders");
+                               menudata.preload_item_visuals = g_settings->getBool("preload_item_visuals");
                                driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, menudata.mip_map);
                                menudata.creative_mode = g_settings->getBool("creative_mode");
                                menudata.enable_damage = g_settings->getBool("enable_damage");
@@ -1560,6 +1562,9 @@ int main(int argc, char *argv[])
                                g_settings->set("bilinear_filter", itos(menudata.bilinear_filter));
                                g_settings->set("trilinear_filter", itos(menudata.trilinear_filter));
 
+                               g_settings->setS32("enable_shaders", menudata.enable_shaders);
+                               g_settings->set("preload_item_visuals", itos(menudata.preload_item_visuals));
+
                                g_settings->set("creative_mode", itos(menudata.creative_mode));
                                g_settings->set("enable_damage", itos(menudata.enable_damage));
                                g_settings->set("name", playername);