forked from oerkki/voxelands
new main menu
This commit is contained in:
parent
c0807b5ee3
commit
df9aa8dc5a
|
@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#include <IGUIButton.h>
|
#include <IGUIButton.h>
|
||||||
#include <IGUIStaticText.h>
|
#include <IGUIStaticText.h>
|
||||||
#include <IGUIFont.h>
|
#include <IGUIFont.h>
|
||||||
|
#include <IGUITabControl.h>
|
||||||
|
|
||||||
|
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
@ -83,6 +84,8 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||||
bool clouds_3d;
|
bool clouds_3d;
|
||||||
bool opaque_water;
|
bool opaque_water;
|
||||||
|
|
||||||
|
m_screensize = screensize;
|
||||||
|
|
||||||
// Client options
|
// Client options
|
||||||
{
|
{
|
||||||
gui::IGUIElement *e = getElementFromId(GUI_ID_NAME_INPUT);
|
gui::IGUIElement *e = getElementFromId(GUI_ID_NAME_INPUT);
|
||||||
|
@ -159,7 +162,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||||
Calculate new sizes and positions
|
Calculate new sizes and positions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
v2s32 size(620, 430);
|
v2s32 size(500, 430);
|
||||||
|
|
||||||
core::rect<s32> rect(
|
core::rect<s32> rect(
|
||||||
screensize.X/2 - size.X/2,
|
screensize.X/2 - size.X/2,
|
||||||
|
@ -171,6 +174,34 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||||
DesiredRect = rect;
|
DesiredRect = rect;
|
||||||
recalculateAbsolutePosition(false);
|
recalculateAbsolutePosition(false);
|
||||||
|
|
||||||
|
// Single Player button
|
||||||
|
{
|
||||||
|
core::rect<s32> rect(0, 0, 180, 30);
|
||||||
|
rect += v2s32(10, 80);
|
||||||
|
Environment->addButton(rect, this, GUI_ID_TAB_SINGLEPLAYER, wgettext("Single Player"));
|
||||||
|
}
|
||||||
|
// Multi Player button
|
||||||
|
{
|
||||||
|
core::rect<s32> rect(0, 0, 180, 30);
|
||||||
|
rect += v2s32(10, 120);
|
||||||
|
Environment->addButton(rect, this, GUI_ID_TAB_MULTIPLAYER, wgettext("Multi Player"));
|
||||||
|
}
|
||||||
|
// Settings button
|
||||||
|
{
|
||||||
|
core::rect<s32> rect(0, 0, 180, 30);
|
||||||
|
rect += v2s32(10, 160);
|
||||||
|
Environment->addButton(rect, this, GUI_ID_TAB_SETTINGS, wgettext("Settings"));
|
||||||
|
}
|
||||||
|
// Credits button
|
||||||
|
{
|
||||||
|
core::rect<s32> rect(0, 0, 180, 30);
|
||||||
|
rect += v2s32(10, 200);
|
||||||
|
Environment->addButton(rect, this, GUI_ID_TAB_CREDITS, wgettext("Credits"));
|
||||||
|
}
|
||||||
|
|
||||||
|
v2s32 topleft_content(200, 0);
|
||||||
|
v2s32 size_content = size - v2s32(300, 0);
|
||||||
|
|
||||||
//v2s32 size = rect.getSize();
|
//v2s32 size = rect.getSize();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -181,152 +212,176 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||||
Client section
|
Client section
|
||||||
*/
|
*/
|
||||||
|
|
||||||
v2s32 topleft_client(40, 0);
|
if (m_data->selected_tab == TAB_MULTIPLAYER) {
|
||||||
v2s32 size_client = size - v2s32(40, 0);
|
changeCtype("");
|
||||||
|
{
|
||||||
|
core::rect<s32> rect(0, 0, 310, 20);
|
||||||
|
rect += topleft_content + v2s32(0, 20);
|
||||||
|
const wchar_t *text = L"Multi Player";
|
||||||
|
gui::IGUIStaticText *t = Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
|
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
|
}
|
||||||
|
|
||||||
changeCtype("");
|
// Nickname + password
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 20, 125);
|
core::rect<s32> rect(0, 0, 110, 20);
|
||||||
rect += topleft_client + v2s32(-15, 40);
|
rect += topleft_content + v2s32(20, 60);
|
||||||
const wchar_t *text = L"C\nL\nI\nE\nN\nT";
|
Environment->addStaticText(wgettext("Name/Password"), rect, false, true, this, -1);
|
||||||
//gui::IGUIStaticText *t =
|
}
|
||||||
Environment->addStaticText(text, rect, false, true, this, -1);
|
changeCtype("C");
|
||||||
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
{
|
||||||
}
|
core::rect<s32> rect(0, 0, 230, 30);
|
||||||
|
rect += topleft_content + v2s32(35, 90);
|
||||||
|
gui::IGUIElement *e =
|
||||||
|
Environment->addEditBox(text_name.c_str(), rect, false, this, GUI_ID_NAME_INPUT);
|
||||||
|
if(text_name == L"")
|
||||||
|
Environment->setFocus(e);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
core::rect<s32> rect(0, 0, 230, 30);
|
||||||
|
rect += topleft_content + v2s32(35, 125);
|
||||||
|
gui::IGUIEditBox *e =
|
||||||
|
Environment->addEditBox(L"", rect, false, this, 264);
|
||||||
|
e->setPasswordBox(true);
|
||||||
|
if(text_name != L"" && text_address != L"")
|
||||||
|
Environment->setFocus(e);
|
||||||
|
|
||||||
// Nickname + password
|
}
|
||||||
{
|
changeCtype("");
|
||||||
core::rect<s32> rect(0, 0, 110, 20);
|
// Address + port
|
||||||
rect += topleft_client + v2s32(35, 36);
|
{
|
||||||
Environment->addStaticText(wgettext("Name/Password"),
|
core::rect<s32> rect(0, 0, 110, 20);
|
||||||
rect, false, true, this, -1);
|
rect += topleft_content + v2s32(20, 170);
|
||||||
}
|
Environment->addStaticText(wgettext("Address/Port"),
|
||||||
changeCtype("C");
|
rect, false, true, this, -1);
|
||||||
{
|
}
|
||||||
core::rect<s32> rect(0, 0, 230, 30);
|
changeCtype("C");
|
||||||
rect += topleft_client + v2s32(160, 30);
|
{
|
||||||
gui::IGUIElement *e =
|
core::rect<s32> rect(0, 0, 230, 30);
|
||||||
Environment->addEditBox(text_name.c_str(), rect, false, this, GUI_ID_NAME_INPUT);
|
rect += topleft_content + v2s32(35, 200);
|
||||||
if(text_name == L"")
|
gui::IGUIElement *e =
|
||||||
Environment->setFocus(e);
|
Environment->addEditBox(text_address.c_str(), rect, false, this, GUI_ID_ADDRESS_INPUT);
|
||||||
}
|
if(text_name != L"" && text_address == L"")
|
||||||
{
|
Environment->setFocus(e);
|
||||||
core::rect<s32> rect(0, 0, 120, 30);
|
}
|
||||||
rect += topleft_client + v2s32(size_client.X-60-100, 30);
|
{
|
||||||
gui::IGUIEditBox *e =
|
core::rect<s32> rect(0, 0, 120, 30);
|
||||||
Environment->addEditBox(L"", rect, false, this, 264);
|
rect += topleft_content + v2s32(145, 240);
|
||||||
e->setPasswordBox(true);
|
Environment->addEditBox(text_port.c_str(), rect, false, this, GUI_ID_PORT_INPUT);
|
||||||
if(text_name != L"" && text_address != L"")
|
}
|
||||||
Environment->setFocus(e);
|
changeCtype("");
|
||||||
|
// Start game button
|
||||||
|
{
|
||||||
|
core::rect<s32> rect(0, 0, 180, 30);
|
||||||
|
rect += topleft_content + v2s32(60, 290);
|
||||||
|
Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON, wgettext("Connect"));
|
||||||
|
}
|
||||||
|
}else if (m_data->selected_tab == TAB_SETTINGS) {
|
||||||
|
changeCtype("");
|
||||||
|
{
|
||||||
|
core::rect<s32> rect(0, 0, 310, 20);
|
||||||
|
rect += topleft_content + v2s32(0, 20);
|
||||||
|
const wchar_t *text = L"Settings";
|
||||||
|
gui::IGUIStaticText *t = Environment->addStaticText(text, 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(85, 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(85, 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(85, 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(85, 150);
|
||||||
|
Environment->addCheckBox(opaque_water, rect, this, GUI_ID_OPAQUE_WATER_CB,
|
||||||
|
wgettext("Opaque water"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
// Key change button
|
||||||
changeCtype("");
|
{
|
||||||
// Address + port
|
core::rect<s32> rect(0, 0, 130, 30);
|
||||||
{
|
rect += topleft_content + v2s32(90, 200);
|
||||||
core::rect<s32> rect(0, 0, 110, 20);
|
Environment->addButton(rect, this, GUI_ID_CHANGE_KEYS_BUTTON,
|
||||||
rect += topleft_client + v2s32(35, 86);
|
wgettext("Change keys"));
|
||||||
Environment->addStaticText(wgettext("Address/Port"),
|
}
|
||||||
rect, false, true, this, -1);
|
}else if (m_data->selected_tab == TAB_SINGLEPLAYER) {
|
||||||
}
|
changeCtype("");
|
||||||
changeCtype("C");
|
{
|
||||||
{
|
core::rect<s32> rect(0, 0, 300, 20);
|
||||||
core::rect<s32> rect(0, 0, 230, 30);
|
rect += topleft_content + v2s32(0, 20);
|
||||||
rect += topleft_client + v2s32(160, 80);
|
const wchar_t *text = L"Single Player";
|
||||||
gui::IGUIElement *e =
|
gui::IGUIStaticText *t = Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
Environment->addEditBox(text_address.c_str(), rect, false, this, GUI_ID_ADDRESS_INPUT);
|
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
if(text_name != L"" && text_address == L"")
|
}
|
||||||
Environment->setFocus(e);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
core::rect<s32> rect(0, 0, 120, 30);
|
|
||||||
//rect += topleft_client + v2s32(160+250+20, 125);
|
|
||||||
rect += topleft_client + v2s32(size_client.X-60-100, 80);
|
|
||||||
Environment->addEditBox(text_port.c_str(), rect, false, this, GUI_ID_PORT_INPUT);
|
|
||||||
}
|
|
||||||
changeCtype("");
|
|
||||||
{
|
|
||||||
core::rect<s32> rect(0, 0, 400, 20);
|
|
||||||
rect += topleft_client + v2s32(160, 115);
|
|
||||||
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 += topleft_client + v2s32(35, 130);
|
|
||||||
Environment->addCheckBox(fancy_trees, rect, this, GUI_ID_FANCYTREE_CB,
|
|
||||||
wgettext("Fancy trees"));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
core::rect<s32> rect(0, 0, 250, 30);
|
|
||||||
rect += topleft_client + v2s32(35, 150);
|
|
||||||
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, 170);
|
|
||||||
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, 190);
|
|
||||||
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);
|
|
||||||
//rect += topleft_client + v2s32(size_client.X/2-180/2, 225-30/2);
|
|
||||||
rect += topleft_client + v2s32(size_client.X-180-40, 155);
|
|
||||||
Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON,
|
|
||||||
wgettext("Start Game / Connect"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Key change button
|
// Server parameters
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 100, 30);
|
core::rect<s32> rect(0, 0, 200, 30);
|
||||||
//rect += topleft_client + v2s32(size_client.X/2-180/2, 225-30/2);
|
rect += topleft_content + v2s32(85, 60);
|
||||||
rect += topleft_client + v2s32(size_client.X-180-40-100-20, 155);
|
Environment->addCheckBox(creative_mode, rect, this, GUI_ID_CREATIVE_CB, wgettext("Creative Mode"));
|
||||||
Environment->addButton(rect, this, GUI_ID_CHANGE_KEYS_BUTTON,
|
}
|
||||||
wgettext("Change keys"));
|
{
|
||||||
}
|
core::rect<s32> rect(0, 0, 200, 30);
|
||||||
/*
|
rect += topleft_content + v2s32(85, 90);
|
||||||
Server section
|
Environment->addCheckBox(enable_damage, rect, this, GUI_ID_DAMAGE_CB, wgettext("Enable Damage"));
|
||||||
*/
|
}
|
||||||
|
// Map delete button
|
||||||
v2s32 topleft_server(40, 250);
|
{
|
||||||
v2s32 size_server = size - v2s32(40, 0);
|
core::rect<s32> rect(0, 0, 130, 30);
|
||||||
|
rect += topleft_content + v2s32(90, 130);
|
||||||
{
|
Environment->addButton(rect, this, GUI_ID_DELETE_MAP_BUTTON, wgettext("Delete map"));
|
||||||
core::rect<s32> rect(0, 0, 20, 125);
|
}
|
||||||
rect += topleft_server + v2s32(-15, 40);
|
// Start game button
|
||||||
const wchar_t *text = L"S\nE\nR\nV\nE\nR";
|
{
|
||||||
//gui::IGUIStaticText *t =
|
core::rect<s32> rect(0, 0, 180, 30);
|
||||||
Environment->addStaticText(text, rect, false, true, this, -1);
|
rect += topleft_content + v2s32(60, 200);
|
||||||
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON, wgettext("Start Game"));
|
||||||
}
|
}
|
||||||
|
}else if(m_data->selected_tab == TAB_CREDITS) {
|
||||||
// Server parameters
|
// CREDITS
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 250, 30);
|
core::rect<s32> rect(0, 0, 310, 20);
|
||||||
rect += topleft_server + v2s32(35, 30);
|
rect += topleft_content + v2s32(0, 20);
|
||||||
Environment->addCheckBox(creative_mode, rect, this, GUI_ID_CREATIVE_CB,
|
const wchar_t *text = L"Credits";
|
||||||
wgettext("Creative Mode"));
|
gui::IGUIStaticText *t = Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
}
|
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
{
|
}
|
||||||
core::rect<s32> rect(0, 0, 250, 30);
|
{
|
||||||
rect += topleft_server + v2s32(35, 60);
|
core::rect<s32> rect(0, 0, 300, 350);
|
||||||
Environment->addCheckBox(enable_damage, rect, this, GUI_ID_DAMAGE_CB,
|
rect += topleft_content + v2s32(0, 50);
|
||||||
wgettext("Enable Damage"));
|
gui::IGUIStaticText *t = Environment->addStaticText(
|
||||||
}
|
narrow_to_wide(
|
||||||
// Map delete button
|
"Minetest-Classic\n"
|
||||||
{
|
"http://www.minetest-classic.com/\n"
|
||||||
core::rect<s32> rect(0, 0, 130, 30);
|
"\n"
|
||||||
//rect += topleft_server + v2s32(size_server.X-40-130, 100+25);
|
"By Lisa 'darkrose' Milne <lisa@ltmnet.com>\n"
|
||||||
rect += topleft_server + v2s32(40, 100+25);
|
"and contributers: sdzen, MichaelEh?, Pentium44, Jordach\n"
|
||||||
Environment->addButton(rect, this, GUI_ID_DELETE_MAP_BUTTON,
|
"\n"
|
||||||
wgettext("Delete map"));
|
"Based on Minetest-C55\n"
|
||||||
|
"by Perttu Ahola <celeron55@gmail.com>\n"
|
||||||
|
"and contributors: PilzAdam, Taoki, tango_, kahrl (kaaaaaahrl?), darkrose, matttpt, erlehmann, SpeedProg, JacobF, teddydestodes, marktraceur, Jonathan Neuschafer, thexyz, VanessaE, sfan5... and tens of more random people."
|
||||||
|
).c_str(),
|
||||||
|
rect,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
this,
|
||||||
|
-1
|
||||||
|
);
|
||||||
|
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
changeCtype("C");
|
changeCtype("C");
|
||||||
}
|
}
|
||||||
|
@ -338,28 +393,25 @@ void GUIMainMenu::drawMenu()
|
||||||
return;
|
return;
|
||||||
video::IVideoDriver* driver = Environment->getVideoDriver();
|
video::IVideoDriver* driver = Environment->getVideoDriver();
|
||||||
|
|
||||||
video::SColor bgcolor(140,0,0,0);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 620, 230);
|
|
||||||
rect += AbsoluteRect.UpperLeftCorner;
|
|
||||||
|
|
||||||
video::SColor bgtcolor(240,50,50,70);
|
video::SColor bgtcolor(240,50,50,70);
|
||||||
video::SColor bgbcolor(240,30,30,50);
|
video::SColor bgbcolor(240,30,30,50);
|
||||||
driver->draw2DRectangle(rect,bgtcolor, bgtcolor, bgbcolor, bgbcolor, &AbsoluteClippingRect);
|
core::rect<s32> left(
|
||||||
|
AbsoluteRect.UpperLeftCorner.X,
|
||||||
|
AbsoluteRect.UpperLeftCorner.Y,
|
||||||
|
AbsoluteRect.LowerRightCorner.X-300,
|
||||||
|
AbsoluteRect.LowerRightCorner.Y
|
||||||
|
);
|
||||||
|
core::rect<s32> right(
|
||||||
|
AbsoluteRect.UpperLeftCorner.X+200,
|
||||||
|
AbsoluteRect.UpperLeftCorner.Y,
|
||||||
|
AbsoluteRect.LowerRightCorner.X,
|
||||||
|
AbsoluteRect.LowerRightCorner.Y
|
||||||
|
);
|
||||||
|
driver->draw2DRectangle(left, bgtcolor, bgtcolor, bgbcolor, bgbcolor, &AbsoluteClippingRect);
|
||||||
|
driver->draw2DRectangle(right, bgbcolor, bgbcolor, bgtcolor, bgtcolor, &AbsoluteClippingRect);
|
||||||
video::SColor bdcolor(245,60,60,80);
|
video::SColor bdcolor(245,60,60,80);
|
||||||
driver->draw2DRectangleOutline(rect, bdcolor);
|
driver->draw2DRectangleOutline(AbsoluteRect, bdcolor);
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
core::rect<s32> rect(0, 250, 620, 430);
|
|
||||||
rect += AbsoluteRect.UpperLeftCorner;
|
|
||||||
|
|
||||||
video::SColor bgtcolor(240,50,50,70);
|
|
||||||
video::SColor bgbcolor(240,30,30,50);
|
|
||||||
driver->draw2DRectangle(rect,bgtcolor, bgtcolor, bgbcolor, bgbcolor, &AbsoluteClippingRect);
|
|
||||||
video::SColor bdcolor(245,60,60,80);
|
|
||||||
driver->draw2DRectangleOutline(rect, bdcolor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gui::IGUIElement::draw();
|
gui::IGUIElement::draw();
|
||||||
|
@ -367,10 +419,14 @@ void GUIMainMenu::drawMenu()
|
||||||
|
|
||||||
void GUIMainMenu::acceptInput()
|
void GUIMainMenu::acceptInput()
|
||||||
{
|
{
|
||||||
|
m_data->selected_tab = getTab();
|
||||||
{
|
{
|
||||||
gui::IGUIElement *e = getElementFromId(GUI_ID_NAME_INPUT);
|
gui::IGUIElement *e = getElementFromId(GUI_ID_NAME_INPUT);
|
||||||
if(e != NULL)
|
if (e != NULL) {
|
||||||
m_data->name = e->getText();
|
m_data->name = e->getText();
|
||||||
|
}else if (m_data->name == L"") {
|
||||||
|
m_data->name = std::wstring(L"singleplayer");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
gui::IGUIElement *e = getElementFromId(264);
|
gui::IGUIElement *e = getElementFromId(264);
|
||||||
|
@ -379,12 +435,15 @@ void GUIMainMenu::acceptInput()
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
gui::IGUIElement *e = getElementFromId(GUI_ID_ADDRESS_INPUT);
|
gui::IGUIElement *e = getElementFromId(GUI_ID_ADDRESS_INPUT);
|
||||||
if(e != NULL)
|
if (e != NULL) {
|
||||||
m_data->address = e->getText();
|
m_data->address = e->getText();
|
||||||
|
}else{
|
||||||
|
m_data->address = std::wstring(L"");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
gui::IGUIElement *e = getElementFromId(GUI_ID_PORT_INPUT);
|
gui::IGUIElement *e = getElementFromId(GUI_ID_PORT_INPUT);
|
||||||
if(e != NULL)
|
if (e != NULL)
|
||||||
m_data->port = e->getText();
|
m_data->port = e->getText();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -470,6 +529,22 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
|
||||||
m_accepted = true;
|
m_accepted = true;
|
||||||
quitMenu();
|
quitMenu();
|
||||||
return true;
|
return true;
|
||||||
|
case GUI_ID_TAB_SINGLEPLAYER:
|
||||||
|
m_data->selected_tab = TAB_SINGLEPLAYER;
|
||||||
|
regenerateGui(m_screensize);
|
||||||
|
return true;
|
||||||
|
case GUI_ID_TAB_MULTIPLAYER:
|
||||||
|
m_data->selected_tab = TAB_MULTIPLAYER;
|
||||||
|
regenerateGui(m_screensize);
|
||||||
|
return true;
|
||||||
|
case GUI_ID_TAB_SETTINGS:
|
||||||
|
m_data->selected_tab = TAB_SETTINGS;
|
||||||
|
regenerateGui(m_screensize);
|
||||||
|
return true;
|
||||||
|
case GUI_ID_TAB_CREDITS:
|
||||||
|
m_data->selected_tab = TAB_CREDITS;
|
||||||
|
regenerateGui(m_screensize);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(event.GUIEvent.EventType==gui::EGET_EDITBOX_ENTER)
|
if(event.GUIEvent.EventType==gui::EGET_EDITBOX_ENTER)
|
||||||
|
@ -486,4 +561,3 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
|
||||||
|
|
||||||
return Parent ? Parent->OnEvent(event) : false;
|
return Parent ? Parent->OnEvent(event) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
// For IGameCallback
|
// For IGameCallback
|
||||||
#include "guiPauseMenu.h"
|
#include "guiPauseMenu.h"
|
||||||
|
|
||||||
enum
|
enum {
|
||||||
{
|
|
||||||
GUI_ID_QUIT_BUTTON = 101,
|
GUI_ID_QUIT_BUTTON = 101,
|
||||||
GUI_ID_NAME_INPUT,
|
GUI_ID_NAME_INPUT,
|
||||||
GUI_ID_ADDRESS_INPUT,
|
GUI_ID_ADDRESS_INPUT,
|
||||||
|
@ -41,12 +40,25 @@ enum
|
||||||
GUI_ID_CREATIVE_CB,
|
GUI_ID_CREATIVE_CB,
|
||||||
GUI_ID_JOIN_GAME_BUTTON,
|
GUI_ID_JOIN_GAME_BUTTON,
|
||||||
GUI_ID_CHANGE_KEYS_BUTTON,
|
GUI_ID_CHANGE_KEYS_BUTTON,
|
||||||
GUI_ID_DELETE_MAP_BUTTON
|
GUI_ID_DELETE_MAP_BUTTON,
|
||||||
|
GUI_ID_TAB_SINGLEPLAYER,
|
||||||
|
GUI_ID_TAB_MULTIPLAYER,
|
||||||
|
GUI_ID_TAB_SETTINGS,
|
||||||
|
GUI_ID_TAB_CREDITS,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
TAB_SINGLEPLAYER=0,
|
||||||
|
TAB_MULTIPLAYER,
|
||||||
|
TAB_SETTINGS,
|
||||||
|
TAB_CREDITS
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MainMenuData
|
struct MainMenuData
|
||||||
{
|
{
|
||||||
MainMenuData():
|
MainMenuData():
|
||||||
|
// Generic
|
||||||
|
selected_tab(0),
|
||||||
// Client opts
|
// Client opts
|
||||||
fancy_trees(false),
|
fancy_trees(false),
|
||||||
smooth_lighting(false),
|
smooth_lighting(false),
|
||||||
|
@ -59,6 +71,8 @@ struct MainMenuData
|
||||||
|
|
||||||
// These are in the native format of the gui elements
|
// These are in the native format of the gui elements
|
||||||
|
|
||||||
|
// Generic
|
||||||
|
int selected_tab;
|
||||||
// Client options
|
// Client options
|
||||||
std::wstring address;
|
std::wstring address;
|
||||||
std::wstring port;
|
std::wstring port;
|
||||||
|
@ -68,6 +82,12 @@ struct MainMenuData
|
||||||
bool smooth_lighting;
|
bool smooth_lighting;
|
||||||
bool clouds_3d;
|
bool clouds_3d;
|
||||||
bool opaque_water;
|
bool opaque_water;
|
||||||
|
//bool mip_map;
|
||||||
|
//bool anisotropic_filter;
|
||||||
|
//bool bilinear_filter;
|
||||||
|
//bool trilinear_filter;
|
||||||
|
//int enable_shaders;
|
||||||
|
//bool enable_particles;
|
||||||
// Server options
|
// Server options
|
||||||
bool creative_mode;
|
bool creative_mode;
|
||||||
bool enable_damage;
|
bool enable_damage;
|
||||||
|
@ -102,6 +122,11 @@ public:
|
||||||
|
|
||||||
bool OnEvent(const SEvent& event);
|
bool OnEvent(const SEvent& event);
|
||||||
|
|
||||||
|
int getTab()
|
||||||
|
{
|
||||||
|
return m_data->selected_tab;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainMenuData *m_data;
|
MainMenuData *m_data;
|
||||||
bool m_accepted;
|
bool m_accepted;
|
||||||
|
@ -111,6 +136,7 @@ private:
|
||||||
gui::IGUIElement* parent;
|
gui::IGUIElement* parent;
|
||||||
s32 id;
|
s32 id;
|
||||||
IMenuManager *menumgr;
|
IMenuManager *menumgr;
|
||||||
|
v2u32 m_screensize;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue