void GUISettingsMenu::regenerateGui(v2u32 screensize) { bool fancy_trees; bool smooth_lighting; bool clouds_3d; bool opaque_water; bool fullscreen; bool particles; bool mipmap; bool bilinear; bool trilinear; bool anisotropic; bool hotbar; bool wield_index; f32 volume; m_screensize = screensize; { gui::IGUIElement *e = getElementFromId(GUI_ID_FANCYTREE_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) fancy_trees = ((gui::IGUICheckBox*)e)->isChecked(); else fancy_trees = m_data.fancy_trees; } { gui::IGUIElement *e = getElementFromId(GUI_ID_SMOOTH_LIGHTING_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) smooth_lighting = ((gui::IGUICheckBox*)e)->isChecked(); 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; } { gui::IGUIElement *e = getElementFromId(GUI_ID_FULLSCREEN_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) fullscreen = ((gui::IGUICheckBox*)e)->isChecked(); else fullscreen = m_data.fullscreen; } { gui::IGUIElement *e = getElementFromId(GUI_ID_PARTICLES_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) particles = ((gui::IGUICheckBox*)e)->isChecked(); else particles = m_data.particles; } { gui::IGUIElement *e = getElementFromId(GUI_ID_MIPMAP_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) mipmap = ((gui::IGUICheckBox*)e)->isChecked(); else mipmap = m_data.mip_map; } { gui::IGUIElement *e = getElementFromId(GUI_ID_BILINEAR_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) bilinear = ((gui::IGUICheckBox*)e)->isChecked(); else bilinear = m_data.bilinear_filter; } { gui::IGUIElement *e = getElementFromId(GUI_ID_TRILINEAR_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) trilinear = ((gui::IGUICheckBox*)e)->isChecked(); else trilinear = m_data.trilinear_filter; } { gui::IGUIElement *e = getElementFromId(GUI_ID_ANISOTROPIC_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) anisotropic = ((gui::IGUICheckBox*)e)->isChecked(); else anisotropic = m_data.anisotropic_filter; } { gui::IGUIElement *e = getElementFromId(GUI_ID_HOTBAR_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) hotbar = ((gui::IGUICheckBox*)e)->isChecked(); else hotbar = m_data.hotbar; } { gui::IGUIElement *e = getElementFromId(GUI_ID_WIELDINDEX_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) wield_index = ((gui::IGUICheckBox*)e)->isChecked(); else wield_index = m_data.wield_index; } { gui::IGUIElement *e = getElementFromId(GUI_ID_VOLUME_SB); if(e != NULL && e->getType() == gui::EGUIET_SCROLL_BAR) volume = (float)((gui::IGUIScrollBar*)e)->getPos(); else volume = m_data.volume; } /* Remove stuff */ removeChildren(); /* Calculate new sizes and positions */ v2s32 size(800, 500); core::rect<s32> rect( screensize.X/2 - size.X/2, screensize.Y/2 - size.Y/2, screensize.X/2 + size.X/2, screensize.Y/2 + size.Y/2 ); DesiredRect = rect; recalculateAbsolutePosition(false); // Main Menu button { core::rect<s32> rect(0, 0, 200, 40); rect += v2s32(25, 200); Environment->addButton(rect, this, GUI_ID_TAB_MAINMENU, wgettext("Main Menu")); } // Controls Settings button { core::rect<s32> rect(0, 0, 180, 40); rect += v2s32(35, 260); Environment->addButton(rect, this, GUI_ID_TAB_SETTINGS_CONTROLS, wgettext("Controls")); } // Graphics Settings button { core::rect<s32> rect(0, 0, 180, 40); rect += v2s32(35, 305); Environment->addButton(rect, this, GUI_ID_TAB_SETTINGS_GRAPHICS, wgettext("Graphics")); } // Video Settings button { core::rect<s32> rect(0, 0, 180, 40); rect += v2s32(35, 350); Environment->addButton(rect, this, GUI_ID_TAB_SETTINGS_VIDEO, wgettext("Video")); } // Sound Settings button { core::rect<s32> rect(0, 0, 180, 40); rect += v2s32(35, 395); Environment->addButton(rect, this, GUI_ID_TAB_SETTINGS_SOUND, wgettext("Sound")); } v2s32 topleft_content(250, 0); if (m_data.selected_tab == TAB_SETTINGS_CONTROLS) { { core::rect<s32> rect(0, 0, 550, 20); rect += topleft_content + v2s32(0, 20); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Controls"), rect, false, true, this, -1); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); } v2s32 offset(0, 40); for (int i=0; i<VLKC_MAX; i++) { if (keynames[i] == NULL) continue; { core::rect < s32 > rect(0, 0, 150, 20); rect += topleft_content + offset; gui::IGUIStaticText *t = Environment->addStaticText(keynames[i], rect, false, true, this, -1); t->setTextAlignment(gui::EGUIA_LOWERRIGHT, gui::EGUIA_UPPERLEFT); } { core::rect < s32 > rect(0, 0, 110, 30); rect += topleft_content + offset + v2s32(155, -5); Environment->addButton(rect, this, GUI_ID_KEYSETTINGS_BASE+i, keys[i].guiName().c_str()); } offset += v2s32(0, 33); if (offset.Y > 450) { offset.Y = 40; offset.X = 275; } } }else if (m_data.selected_tab == TAB_SETTINGS_GRAPHICS) { { core::rect<s32> rect(0, 0, 550, 20); rect += topleft_content + v2s32(0, 20); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Graphics"), rect, false, true, this, -1); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); } { core::rect<s32> rect(0, 0, 200, 30); rect += topleft_content + v2s32(80, 60); Environment->addCheckBox(fancy_trees, rect, this, GUI_ID_FANCYTREE_CB, wgettext("Fancy trees")); } { core::rect<s32> rect(0, 0, 200, 30); rect += topleft_content + v2s32(80, 90); Environment->addCheckBox(smooth_lighting, rect, this, GUI_ID_SMOOTH_LIGHTING_CB, wgettext("Smooth Lighting")); } { core::rect<s32> rect(0, 0, 200, 30); rect += topleft_content + v2s32(80, 120); Environment->addCheckBox(clouds_3d, rect, this, GUI_ID_3D_CLOUDS_CB, wgettext("3D Clouds")); } { core::rect<s32> rect(0, 0, 200, 30); rect += topleft_content + v2s32(80, 150); Environment->addCheckBox(opaque_water, rect, this, GUI_ID_OPAQUE_WATER_CB, wgettext("Opaque water")); } { core::rect<s32> rect(0, 0, 200, 30); rect += topleft_content + v2s32(290, 60); Environment->addCheckBox(hotbar, rect, this, GUI_ID_HOTBAR_CB, wgettext("Classic HUD")); } { core::rect<s32> rect(0, 0, 200, 30); rect += topleft_content + v2s32(290, 90); gui::IGUICheckBox *c = Environment->addCheckBox(wield_index, rect, this, GUI_ID_WIELDINDEX_CB, wgettext("Wieldring Index")); c->setEnabled(!hotbar); } if (m_is_ingame) { core::rect<s32> rect(0, 0, 550, 20); rect += topleft_content + v2s32(0, 200); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Some settings cannot be changed in-game."), rect, false, true, this, -1); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); } }else if (m_data.selected_tab == TAB_SETTINGS_VIDEO) { { core::rect<s32> rect(0, 0, 550, 20); rect += topleft_content + v2s32(0, 20); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Video"), rect, false, true, this, -1); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); } { core::rect<s32> rect(0, 0, 200, 30); rect += topleft_content + v2s32(80, 60); Environment->addCheckBox(fullscreen, rect, this, GUI_ID_FULLSCREEN_CB, wgettext("Fullscreen")); } { core::rect<s32> rect(0, 0, 200, 30); rect += topleft_content + v2s32(80, 90); Environment->addCheckBox(particles, rect, this, GUI_ID_PARTICLES_CB, wgettext("Particles")); } { core::rect<s32> rect(0, 0, 200, 30); rect += topleft_content + v2s32(80, 120); Environment->addCheckBox(mipmap, rect, this, GUI_ID_MIPMAP_CB, wgettext("Mip-Mapping")); } { core::rect<s32> rect(0, 0, 200, 30); rect += topleft_content + v2s32(80, 150); Environment->addCheckBox(bilinear, rect, this, GUI_ID_BILINEAR_CB, wgettext("Bi-Linear Filtering")); } { core::rect<s32> rect(0, 0, 200, 30); rect += topleft_content + v2s32(80, 180); Environment->addCheckBox(trilinear, rect, this, GUI_ID_TRILINEAR_CB, wgettext("Tri-Linear Filtering")); } { core::rect<s32> rect(0, 0, 200, 30); rect += topleft_content + v2s32(80, 210); Environment->addCheckBox(anisotropic, rect, this, GUI_ID_ANISOTROPIC_CB, wgettext("Anisotropic Filtering")); } if (m_is_ingame) { core::rect<s32> rect(0, 0, 550, 20); rect += topleft_content + v2s32(0, 250); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Some settings cannot be changed in-game."), rect, false, true, this, -1); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); } }else if (m_data.selected_tab == TAB_SETTINGS_SOUND) { { core::rect<s32> rect(0, 0, 550, 20); rect += topleft_content + v2s32(0, 20); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Sound"), rect, false, true, this, -1); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); } { core::rect<s32> rect(0, 0, 200, 15); rect += topleft_content + v2s32(80, 60); Environment->addStaticText(wgettext("Volume:"), rect, false, false, this, -1); } { core::rect<s32> rect(0, 0, 200, 15); rect += topleft_content + v2s32(290, 60); gui::IGUIScrollBar *sb = Environment->addScrollBar(true, rect, this, GUI_ID_VOLUME_SB); sb->setMin(0); sb->setMax(100); sb->setPos(volume); } } }
void GUIMultiplayerMenu::regenerateGui(v2u32 screensize) { std::wstring text_name; std::wstring text_address; std::wstring text_port; m_screensize = screensize; // Client options { gui::IGUIElement *e = getElementFromId(GUI_ID_NAME_INPUT); if (e != NULL) { text_name = e->getText(); }else{ text_name = m_data.mmdata->name; } if (text_name == L"") text_name = narrow_to_wide(porting::getUser()); } { gui::IGUIElement *e = getElementFromId(GUI_ID_ADDRESS_INPUT); if (e != NULL) { text_address = e->getText(); }else{ text_address = m_data.mmdata->address; } } { gui::IGUIElement *e = getElementFromId(GUI_ID_PORT_INPUT); if (e != NULL) { text_port = e->getText(); }else{ text_port = m_data.mmdata->port; } } /* Remove stuff */ removeChildren(); /* Calculate new sizes and positions */ v2s32 size(800, 500); core::rect<s32> rect( screensize.X/2 - size.X/2, screensize.Y/2 - size.Y/2, screensize.X/2 + size.X/2, screensize.Y/2 + size.Y/2 ); DesiredRect = rect; recalculateAbsolutePosition(false); // Main Menu button { core::rect<s32> rect(0, 0, 200, 40); rect += v2s32(25, 200); Environment->addButton(rect, this, GUI_ID_TAB_MP_MAINMENU, wgettext("Main Menu")); } // Dynamic List button { core::rect<s32> rect(0, 0, 180, 40); rect += v2s32(35, 260); Environment->addButton(rect, this, GUI_ID_TAB_MP_LIST, wgettext("All Servers")); } // Favourites List button { core::rect<s32> rect(0, 0, 180, 40); rect += v2s32(35, 305); Environment->addButton(rect, this, GUI_ID_TAB_MP_FAVOURITES, wgettext("Favourite Servers")); } // Custom Connect button (the old multiplayer menu) { core::rect<s32> rect(0, 0, 180, 40); rect += v2s32(35, 350); Environment->addButton(rect, this, GUI_ID_TAB_MP_CUSTOM, wgettext("Custom Connect")); } v2s32 topleft_content(250, 0); { core::rect<s32> rect(0, 0, 550, 20); rect += topleft_content + v2s32(0, 10); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Multi Player"), rect, false, true, this, -1); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); } if (m_data.selected_tab == TAB_MP_CUSTOM) { { core::rect<s32> rect(0, 0, 550, 20); rect += topleft_content + v2s32(0, 30); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Custom Connection"), rect, false, true, this, -1); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); } // Address + port { core::rect<s32> rect(0, 0, 110, 20); rect += topleft_content + v2s32(120, 60); Environment->addStaticText(wgettext("Address/Port"), rect, false, true, this, -1); } { if (text_address == L"") text_address = L"servers.voxelands.com"; core::rect<s32> rect(0, 0, 230, 30); rect += topleft_content + v2s32(135, 90); #if USE_FREETYPE new gui::intlGUIEditBox(text_address.c_str(), true, Environment, this, GUI_ID_ADDRESS_INPUT, rect); #else Environment->addEditBox(text_address.c_str(), rect, false, this, GUI_ID_ADDRESS_INPUT); #endif } { core::rect<s32> rect(0, 0, 120, 30); rect += topleft_content + v2s32(245, 125); #if USE_FREETYPE new gui::intlGUIEditBox(text_port.c_str(), true, Environment, this, GUI_ID_PORT_INPUT, rect); #else Environment->addEditBox(text_port.c_str(), rect, false, this, GUI_ID_PORT_INPUT); #endif } { core::rect<s32> rect(0, 0, 180, 30); rect += topleft_content + v2s32(80, 160); Environment->addButton(rect, this, GUI_ID_ADDFAV_BUTTON, wgettext("Add to Favourites")); } { core::rect<s32> rect(0, 0, 180, 30); rect += topleft_content + v2s32(270, 160); Environment->addButton(rect, this, GUI_ID_CONNECT_BUTTON, wgettext("Connect")); } }else if (m_data.selected_tab == TAB_MP_CONNECT) { // Nickname + password { core::rect<s32> rect(0, 0, 110, 20); rect += topleft_content + v2s32(120, 60); Environment->addStaticText(wgettext("Name/Password"), rect, false, true, this, -1); } { core::rect<s32> rect(0, 0, 230, 30); rect += topleft_content + v2s32(135, 90); #if USE_FREETYPE new gui::intlGUIEditBox(text_name.c_str(), true, Environment, this, GUI_ID_NAME_INPUT, rect); #else Environment->addEditBox(text_name.c_str(), rect, false, this, GUI_ID_NAME_INPUT); #endif } { core::rect<s32> rect(0, 0, 230, 30); rect += topleft_content + v2s32(135, 125); gui::IGUIEditBox *e; #if USE_FREETYPE e = (gui::IGUIEditBox *) new gui::intlGUIEditBox(L"", true, Environment, this, GUI_ID_PW_INPUT, rect); #else e = Environment->addEditBox(L"", rect, false, this, GUI_ID_PW_INPUT); #endif e->setPasswordBox(true); Environment->setFocus(e); // Start game button { core::rect<s32> rect(0, 0, 180, 30); rect += topleft_content + v2s32(160, 160); Environment->addButton(rect, this, GUI_ID_START_BUTTON, wgettext("Join Server")); } } }else{ gui::IGUIListBox *box = NULL; gui::IGUIStaticText *header = NULL; std::vector<ServerInfo> *list = NULL; { core::rect<s32> rect(0, 0, 550, 20); rect += topleft_content + v2s32(0, 30); header = Environment->addStaticText(L"", rect, false, true, this, -1); header->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); } { core::rect<s32> rect(0, 0, 350, 200); rect += topleft_content + v2s32(100, 60); box = Environment->addListBox(rect, this, GUI_ID_SERVER_LIST, true); box->setItemHeight(25); } if (m_data.selected_tab == TAB_MP_FAVOURITES) { header->setText(wgettext("My Favourites")); list = &m_data.favourites; }else{ header->setText(wgettext("Server List")); list = &m_data.servers; { core::rect<s32> rect(0, 0, 180, 25); rect += topleft_content + v2s32(270, 260); Environment->addButton(rect, this, GUI_ID_REFRESH_BUTTON, wgettext("Get New List")); } } for (std::vector<ServerInfo>::iterator i = list->begin(); i != list->end(); i++) { box->addItem(i->name.c_str()); } if (m_data.selected_row > -1) { ServerInfo info = list->at(m_data.selected_row); if (info.name == L"") { m_data.selected_row = -1; }else{ box->setSelected(m_data.selected_row); { core::rect<s32> rect(0, 0, 550, 20); rect += topleft_content + v2s32(0, 300); gui::IGUIStaticText *t = Environment->addStaticText(info.name.c_str(), rect, false, true, this, -1); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); } { core::rect<s32> rect(0, 0, 350, 20); rect += topleft_content + v2s32(100, 330); gui::IGUIStaticText *t = Environment->addStaticText(info.addr.c_str(), rect, false, true, this, -1); t->setTextAlignment(gui::EGUIA_UPPERLEFT, gui::EGUIA_UPPERLEFT); } { core::rect<s32> rect(0, 0, 350, 20); rect += topleft_content + v2s32(100, 350); gui::IGUIStaticText *t = Environment->addStaticText(info.mode.c_str(), rect, false, true, this, -1); t->setTextAlignment(gui::EGUIA_UPPERLEFT, gui::EGUIA_UPPERLEFT); } if (info.is_favourite) { { core::rect<s32> rect(0, 0, 180, 30); rect += topleft_content + v2s32(80, 390); Environment->addButton(rect, this, GUI_ID_REMFAV_BUTTON, wgettext("Remove from Favourites")); } }else{ { core::rect<s32> rect(0, 0, 180, 30); rect += topleft_content + v2s32(80, 390); Environment->addButton(rect, this, GUI_ID_ADDFAV_BUTTON, wgettext("Add to Favourites")); } } { core::rect<s32> rect(0, 0, 180, 30); rect += topleft_content + v2s32(270, 390); Environment->addButton(rect, this, GUI_ID_CONNECT_BUTTON, wgettext("Connect")); } } } } }