mirror of
https://github.com/minetest/minetest.git
synced 2024-11-04 14:53:45 +01:00
Make non-formspec modal menus respect gui scale (#7850)
This commit is contained in:
parent
8ba64e43fe
commit
9519d57017
@ -70,13 +70,16 @@ void GUIConfirmRegistration::regenerateGui(v2u32 screensize)
|
|||||||
/*
|
/*
|
||||||
Calculate new sizes and positions
|
Calculate new sizes and positions
|
||||||
*/
|
*/
|
||||||
core::rect<s32> rect(screensize.X / 2 - 600 / 2, screensize.Y / 2 - 360 / 2,
|
const float s = m_gui_scale;
|
||||||
screensize.X / 2 + 600 / 2, screensize.Y / 2 + 360 / 2);
|
DesiredRect = core::rect<s32>(
|
||||||
|
screensize.X / 2 - 600 * s / 2,
|
||||||
DesiredRect = rect;
|
screensize.Y / 2 - 360 * s / 2,
|
||||||
|
screensize.X / 2 + 600 * s / 2,
|
||||||
|
screensize.Y / 2 + 360 * s / 2
|
||||||
|
);
|
||||||
recalculateAbsolutePosition(false);
|
recalculateAbsolutePosition(false);
|
||||||
|
|
||||||
v2s32 size = rect.getSize();
|
v2s32 size = DesiredRect.getSize();
|
||||||
v2s32 topleft_client(0, 0);
|
v2s32 topleft_client(0, 0);
|
||||||
|
|
||||||
const wchar_t *text;
|
const wchar_t *text;
|
||||||
@ -84,13 +87,13 @@ void GUIConfirmRegistration::regenerateGui(v2u32 screensize)
|
|||||||
/*
|
/*
|
||||||
Add stuff
|
Add stuff
|
||||||
*/
|
*/
|
||||||
s32 ypos = 30;
|
s32 ypos = 30 * s;
|
||||||
{
|
{
|
||||||
std::string address = m_address;
|
std::string address = m_address;
|
||||||
if (address.empty())
|
if (address.empty())
|
||||||
address = "localhost";
|
address = "localhost";
|
||||||
core::rect<s32> rect2(0, 0, 540, 180);
|
core::rect<s32> rect2(0, 0, 540 * s, 180 * s);
|
||||||
rect2 += topleft_client + v2s32(30, ypos);
|
rect2 += topleft_client + v2s32(30 * s, ypos);
|
||||||
static const std::string info_text_template = strgettext(
|
static const std::string info_text_template = strgettext(
|
||||||
"You are about to join the server at %1$s with the "
|
"You are about to join the server at %1$s with the "
|
||||||
"name \"%2$s\" for the first time. If you proceed, a "
|
"name \"%2$s\" for the first time. If you proceed, a "
|
||||||
@ -114,33 +117,33 @@ void GUIConfirmRegistration::regenerateGui(v2u32 screensize)
|
|||||||
e->setTextAlignment(gui::EGUIA_UPPERLEFT, gui::EGUIA_CENTER);
|
e->setTextAlignment(gui::EGUIA_UPPERLEFT, gui::EGUIA_CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
ypos += 210;
|
ypos += 210 * s;
|
||||||
{
|
{
|
||||||
core::rect<s32> rect2(0, 0, 540, 30);
|
core::rect<s32> rect2(0, 0, 540 * s, 30 * s);
|
||||||
rect2 += topleft_client + v2s32(30, ypos);
|
rect2 += topleft_client + v2s32(30 * s, ypos);
|
||||||
gui::IGUIEditBox *e = Environment->addEditBox(m_pass_confirm.c_str(),
|
gui::IGUIEditBox *e = Environment->addEditBox(m_pass_confirm.c_str(),
|
||||||
rect2, true, this, ID_confirmPassword);
|
rect2, true, this, ID_confirmPassword);
|
||||||
e->setPasswordBox(true);
|
e->setPasswordBox(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ypos += 60;
|
ypos += 60 * s;
|
||||||
{
|
{
|
||||||
core::rect<s32> rect2(0, 0, 230, 35);
|
core::rect<s32> rect2(0, 0, 230 * s, 35 * s);
|
||||||
rect2 = rect2 + v2s32(size.X / 2 - 220, ypos);
|
rect2 = rect2 + v2s32(size.X / 2 - 220 * s, ypos);
|
||||||
text = wgettext("Register and Join");
|
text = wgettext("Register and Join");
|
||||||
Environment->addButton(rect2, this, ID_confirm, text);
|
Environment->addButton(rect2, this, ID_confirm, text);
|
||||||
delete[] text;
|
delete[] text;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect<s32> rect2(0, 0, 120, 35);
|
core::rect<s32> rect2(0, 0, 120 * s, 35 * s);
|
||||||
rect2 = rect2 + v2s32(size.X / 2 + 70, ypos);
|
rect2 = rect2 + v2s32(size.X / 2 + 70 * s, ypos);
|
||||||
text = wgettext("Cancel");
|
text = wgettext("Cancel");
|
||||||
Environment->addButton(rect2, this, ID_cancel, text);
|
Environment->addButton(rect2, this, ID_cancel, text);
|
||||||
delete[] text;
|
delete[] text;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect<s32> rect2(0, 0, 200, 20);
|
core::rect<s32> rect2(0, 0, 200 * s, 20 * s);
|
||||||
rect2 += topleft_client + v2s32(30, ypos - 40);
|
rect2 += topleft_client + v2s32(30 * s, ypos - 40 * s);
|
||||||
text = wgettext("Passwords do not match!");
|
text = wgettext("Passwords do not match!");
|
||||||
IGUIElement *e = Environment->addStaticText(
|
IGUIElement *e = Environment->addStaticText(
|
||||||
text, rect2, false, true, this, ID_message);
|
text, rect2, false, true, this, ID_message);
|
||||||
|
@ -116,20 +116,22 @@ void GUIKeyChangeMenu::removeChildren()
|
|||||||
void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
||||||
{
|
{
|
||||||
removeChildren();
|
removeChildren();
|
||||||
v2s32 size(745, 430);
|
|
||||||
|
|
||||||
core::rect < s32 > rect(screensize.X / 2 - size.X / 2,
|
const float s = m_gui_scale;
|
||||||
screensize.Y / 2 - size.Y / 2, screensize.X / 2 + size.X / 2,
|
DesiredRect = core::rect<s32>(
|
||||||
screensize.Y / 2 + size.Y / 2);
|
screensize.X / 2 - 745 * s / 2,
|
||||||
|
screensize.Y / 2 - 430 * s / 2,
|
||||||
DesiredRect = rect;
|
screensize.X / 2 + 745 * s / 2,
|
||||||
|
screensize.Y / 2 + 430 * s / 2
|
||||||
|
);
|
||||||
recalculateAbsolutePosition(false);
|
recalculateAbsolutePosition(false);
|
||||||
|
|
||||||
|
v2s32 size = DesiredRect.getSize();
|
||||||
v2s32 topleft(0, 0);
|
v2s32 topleft(0, 0);
|
||||||
|
|
||||||
{
|
{
|
||||||
core::rect < s32 > rect(0, 0, 600, 40);
|
core::rect<s32> rect(0, 0, 600 * s, 40 * s);
|
||||||
rect += topleft + v2s32(25, 3);
|
rect += topleft + v2s32(25 * s, 3 * s);
|
||||||
//gui::IGUIStaticText *t =
|
//gui::IGUIStaticText *t =
|
||||||
const wchar_t *text = wgettext("Keybindings. (If this menu screws up, remove stuff from minetest.conf)");
|
const wchar_t *text = wgettext("Keybindings. (If this menu screws up, remove stuff from minetest.conf)");
|
||||||
Environment->addStaticText(text,
|
Environment->addStaticText(text,
|
||||||
@ -140,68 +142,68 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
|||||||
|
|
||||||
// Build buttons
|
// Build buttons
|
||||||
|
|
||||||
v2s32 offset(25, 60);
|
v2s32 offset(25 * s, 60 * s);
|
||||||
|
|
||||||
for(size_t i = 0; i < key_settings.size(); i++)
|
for(size_t i = 0; i < key_settings.size(); i++)
|
||||||
{
|
{
|
||||||
key_setting *k = key_settings.at(i);
|
key_setting *k = key_settings.at(i);
|
||||||
{
|
{
|
||||||
core::rect < s32 > rect(0, 0, 150, 20);
|
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
|
||||||
rect += topleft + v2s32(offset.X, offset.Y);
|
rect += topleft + v2s32(offset.X, offset.Y);
|
||||||
Environment->addStaticText(k->button_name, rect, false, true, this, -1);
|
Environment->addStaticText(k->button_name, rect, false, true, this, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
core::rect < s32 > rect(0, 0, 100, 30);
|
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
|
||||||
rect += topleft + v2s32(offset.X + 120, offset.Y - 5);
|
rect += topleft + v2s32(offset.X + 120 * s, offset.Y - 5 * s);
|
||||||
const wchar_t *text = wgettext(k->key.name());
|
const wchar_t *text = wgettext(k->key.name());
|
||||||
k->button = Environment->addButton(rect, this, k->id, text);
|
k->button = Environment->addButton(rect, this, k->id, text);
|
||||||
delete[] text;
|
delete[] text;
|
||||||
}
|
}
|
||||||
if ((i + 1) % KMaxButtonPerColumns == 0) {
|
if ((i + 1) % KMaxButtonPerColumns == 0) {
|
||||||
offset.X += 230;
|
offset.X += 230 * s;
|
||||||
offset.Y = 60;
|
offset.Y = 60 * s;
|
||||||
} else {
|
} else {
|
||||||
offset += v2s32(0, 25);
|
offset += v2s32(0, 25 * s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
s32 option_x = offset.X;
|
s32 option_x = offset.X;
|
||||||
s32 option_y = offset.Y + 5;
|
s32 option_y = offset.Y + 5 * s;
|
||||||
u32 option_w = 180;
|
u32 option_w = 180 * s;
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, option_w, 30);
|
core::rect<s32> rect(0, 0, option_w, 30 * s);
|
||||||
rect += topleft + v2s32(option_x, option_y);
|
rect += topleft + v2s32(option_x, option_y);
|
||||||
const wchar_t *text = wgettext("\"Special\" = climb down");
|
const wchar_t *text = wgettext("\"Special\" = climb down");
|
||||||
Environment->addCheckBox(g_settings->getBool("aux1_descends"), rect, this,
|
Environment->addCheckBox(g_settings->getBool("aux1_descends"), rect, this,
|
||||||
GUI_ID_CB_AUX1_DESCENDS, text);
|
GUI_ID_CB_AUX1_DESCENDS, text);
|
||||||
delete[] text;
|
delete[] text;
|
||||||
}
|
}
|
||||||
offset += v2s32(0, 25);
|
offset += v2s32(0, 25 * s);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
s32 option_x = offset.X;
|
s32 option_x = offset.X;
|
||||||
s32 option_y = offset.Y + 5;
|
s32 option_y = offset.Y + 5 * s;
|
||||||
u32 option_w = 280;
|
u32 option_w = 280 * s;
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, option_w, 30);
|
core::rect<s32> rect(0, 0, option_w, 30 * s);
|
||||||
rect += topleft + v2s32(option_x, option_y);
|
rect += topleft + v2s32(option_x, option_y);
|
||||||
const wchar_t *text = wgettext("Double tap \"jump\" to toggle fly");
|
const wchar_t *text = wgettext("Double tap \"jump\" to toggle fly");
|
||||||
Environment->addCheckBox(g_settings->getBool("doubletap_jump"), rect, this,
|
Environment->addCheckBox(g_settings->getBool("doubletap_jump"), rect, this,
|
||||||
GUI_ID_CB_DOUBLETAP_JUMP, text);
|
GUI_ID_CB_DOUBLETAP_JUMP, text);
|
||||||
delete[] text;
|
delete[] text;
|
||||||
}
|
}
|
||||||
offset += v2s32(0, 25);
|
offset += v2s32(0, 25 * s);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
s32 option_x = offset.X;
|
s32 option_x = offset.X;
|
||||||
s32 option_y = offset.Y + 5;
|
s32 option_y = offset.Y + 5 * s;
|
||||||
u32 option_w = 280;
|
u32 option_w = 280;
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, option_w, 30);
|
core::rect<s32> rect(0, 0, option_w, 30 * s);
|
||||||
rect += topleft + v2s32(option_x, option_y);
|
rect += topleft + v2s32(option_x, option_y);
|
||||||
const wchar_t *text = wgettext("Automatic jumping");
|
const wchar_t *text = wgettext("Automatic jumping");
|
||||||
Environment->addCheckBox(g_settings->getBool("autojump"), rect, this,
|
Environment->addCheckBox(g_settings->getBool("autojump"), rect, this,
|
||||||
@ -212,16 +214,16 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
core::rect < s32 > rect(0, 0, 100, 30);
|
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
|
||||||
rect += topleft + v2s32(size.X / 2 - 105, size.Y - 40);
|
rect += topleft + v2s32(size.X / 2 - 105 * s, size.Y - 40 * s);
|
||||||
const wchar_t *text = wgettext("Save");
|
const wchar_t *text = wgettext("Save");
|
||||||
Environment->addButton(rect, this, GUI_ID_BACK_BUTTON,
|
Environment->addButton(rect, this, GUI_ID_BACK_BUTTON,
|
||||||
text);
|
text);
|
||||||
delete[] text;
|
delete[] text;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect < s32 > rect(0, 0, 100, 30);
|
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
|
||||||
rect += topleft + v2s32(size.X / 2 + 5, size.Y - 40);
|
rect += topleft + v2s32(size.X / 2 + 5 * s, size.Y - 40 * s);
|
||||||
const wchar_t *text = wgettext("Cancel");
|
const wchar_t *text = wgettext("Cancel");
|
||||||
Environment->addButton(rect, this, GUI_ID_ABORT_BUTTON,
|
Environment->addButton(rect, this, GUI_ID_ABORT_BUTTON,
|
||||||
text);
|
text);
|
||||||
@ -237,12 +239,7 @@ void GUIKeyChangeMenu::drawMenu()
|
|||||||
video::IVideoDriver* driver = Environment->getVideoDriver();
|
video::IVideoDriver* driver = Environment->getVideoDriver();
|
||||||
|
|
||||||
video::SColor bgcolor(140, 0, 0, 0);
|
video::SColor bgcolor(140, 0, 0, 0);
|
||||||
|
driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect);
|
||||||
{
|
|
||||||
core::rect < s32 > rect(0, 0, 745, 620);
|
|
||||||
rect += AbsoluteRect.UpperLeftCorner;
|
|
||||||
driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect);
|
|
||||||
}
|
|
||||||
|
|
||||||
gui::IGUIElement::draw();
|
gui::IGUIElement::draw();
|
||||||
}
|
}
|
||||||
|
@ -76,91 +76,90 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
|
|||||||
/*
|
/*
|
||||||
Calculate new sizes and positions
|
Calculate new sizes and positions
|
||||||
*/
|
*/
|
||||||
core::rect<s32> rect(
|
const float s = m_gui_scale;
|
||||||
screensize.X/2 - 580/2,
|
DesiredRect = core::rect<s32>(
|
||||||
screensize.Y/2 - 300/2,
|
screensize.X / 2 - 580 * s / 2,
|
||||||
screensize.X/2 + 580/2,
|
screensize.Y / 2 - 300 * s / 2,
|
||||||
screensize.Y/2 + 300/2
|
screensize.X / 2 + 580 * s / 2,
|
||||||
|
screensize.Y / 2 + 300 * s / 2
|
||||||
);
|
);
|
||||||
|
|
||||||
DesiredRect = rect;
|
|
||||||
recalculateAbsolutePosition(false);
|
recalculateAbsolutePosition(false);
|
||||||
|
|
||||||
v2s32 size = rect.getSize();
|
v2s32 size = DesiredRect.getSize();
|
||||||
v2s32 topleft_client(40, 0);
|
v2s32 topleft_client(40 * s, 0);
|
||||||
|
|
||||||
const wchar_t *text;
|
const wchar_t *text;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Add stuff
|
Add stuff
|
||||||
*/
|
*/
|
||||||
s32 ypos = 50;
|
s32 ypos = 50 * s;
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 150, 20);
|
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
|
||||||
rect += topleft_client + v2s32(25, ypos + 6);
|
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
|
||||||
text = wgettext("Old Password");
|
text = wgettext("Old Password");
|
||||||
Environment->addStaticText(text, rect, false, true, this, -1);
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
delete[] text;
|
delete[] text;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 230, 30);
|
core::rect<s32> rect(0, 0, 230 * s, 30 * s);
|
||||||
rect += topleft_client + v2s32(160, ypos);
|
rect += topleft_client + v2s32(160 * s, ypos);
|
||||||
gui::IGUIEditBox *e = Environment->addEditBox(
|
gui::IGUIEditBox *e = Environment->addEditBox(
|
||||||
m_oldpass.c_str(), rect, true, this, ID_oldPassword);
|
m_oldpass.c_str(), rect, true, this, ID_oldPassword);
|
||||||
Environment->setFocus(e);
|
Environment->setFocus(e);
|
||||||
e->setPasswordBox(true);
|
e->setPasswordBox(true);
|
||||||
}
|
}
|
||||||
ypos += 50;
|
ypos += 50 * s;
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 150, 20);
|
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
|
||||||
rect += topleft_client + v2s32(25, ypos + 6);
|
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
|
||||||
text = wgettext("New Password");
|
text = wgettext("New Password");
|
||||||
Environment->addStaticText(text, rect, false, true, this, -1);
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
delete[] text;
|
delete[] text;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 230, 30);
|
core::rect<s32> rect(0, 0, 230 * s, 30 * s);
|
||||||
rect += topleft_client + v2s32(160, ypos);
|
rect += topleft_client + v2s32(160 * s, ypos);
|
||||||
gui::IGUIEditBox *e = Environment->addEditBox(
|
gui::IGUIEditBox *e = Environment->addEditBox(
|
||||||
m_newpass.c_str(), rect, true, this, ID_newPassword1);
|
m_newpass.c_str(), rect, true, this, ID_newPassword1);
|
||||||
e->setPasswordBox(true);
|
e->setPasswordBox(true);
|
||||||
}
|
}
|
||||||
ypos += 50;
|
ypos += 50 * s;
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 150, 20);
|
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
|
||||||
rect += topleft_client + v2s32(25, ypos + 6);
|
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
|
||||||
text = wgettext("Confirm Password");
|
text = wgettext("Confirm Password");
|
||||||
Environment->addStaticText(text, rect, false, true, this, -1);
|
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||||
delete[] text;
|
delete[] text;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 230, 30);
|
core::rect<s32> rect(0, 0, 230 * s, 30 * s);
|
||||||
rect += topleft_client + v2s32(160, ypos);
|
rect += topleft_client + v2s32(160 * s, ypos);
|
||||||
gui::IGUIEditBox *e = Environment->addEditBox(
|
gui::IGUIEditBox *e = Environment->addEditBox(
|
||||||
m_newpass_confirm.c_str(), rect, true, this, ID_newPassword2);
|
m_newpass_confirm.c_str(), rect, true, this, ID_newPassword2);
|
||||||
e->setPasswordBox(true);
|
e->setPasswordBox(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ypos += 50;
|
ypos += 50 * s;
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 100, 30);
|
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
|
||||||
rect = rect + v2s32(size.X / 4 + 56, ypos);
|
rect = rect + v2s32(size.X / 4 + 56 * s, ypos);
|
||||||
text = wgettext("Change");
|
text = wgettext("Change");
|
||||||
Environment->addButton(rect, this, ID_change, text);
|
Environment->addButton(rect, this, ID_change, text);
|
||||||
delete[] text;
|
delete[] text;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 100, 30);
|
core::rect<s32> rect(0, 0, 100 * s, 30 * s);
|
||||||
rect = rect + v2s32(size.X / 4 + 185, ypos);
|
rect = rect + v2s32(size.X / 4 + 185 * s, ypos);
|
||||||
text = wgettext("Cancel");
|
text = wgettext("Cancel");
|
||||||
Environment->addButton(rect, this, ID_cancel, text);
|
Environment->addButton(rect, this, ID_cancel, text);
|
||||||
delete[] text;
|
delete[] text;
|
||||||
}
|
}
|
||||||
|
|
||||||
ypos += 50;
|
ypos += 50 * s;
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 300, 20);
|
core::rect<s32> rect(0, 0, 300 * s, 20 * s);
|
||||||
rect += topleft_client + v2s32(35, ypos);
|
rect += topleft_client + v2s32(35 * s, ypos);
|
||||||
text = wgettext("Passwords do not match!");
|
text = wgettext("Passwords do not match!");
|
||||||
IGUIElement *e =
|
IGUIElement *e =
|
||||||
Environment->addStaticText(
|
Environment->addStaticText(
|
||||||
|
@ -41,7 +41,7 @@ void GUIFileSelectMenu::regenerateGui(v2u32 screensize)
|
|||||||
removeChildren();
|
removeChildren();
|
||||||
m_fileOpenDialog = 0;
|
m_fileOpenDialog = 0;
|
||||||
|
|
||||||
core::dimension2du size(600, 400);
|
core::dimension2du size(600 * m_gui_scale, 400 * m_gui_scale);
|
||||||
core::rect<s32> rect(0, 0, screensize.X, screensize.Y);
|
core::rect<s32> rect(0, 0, screensize.X, screensize.Y);
|
||||||
|
|
||||||
DesiredRect = rect;
|
DesiredRect = rect;
|
||||||
|
@ -66,15 +66,15 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize)
|
|||||||
Remove stuff
|
Remove stuff
|
||||||
*/
|
*/
|
||||||
removeChildren();
|
removeChildren();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Calculate new sizes and positions
|
Calculate new sizes and positions
|
||||||
*/
|
*/
|
||||||
|
const float s = m_gui_scale;
|
||||||
DesiredRect = core::rect<s32>(
|
DesiredRect = core::rect<s32>(
|
||||||
screensize.X/2 - 380/2,
|
screensize.X / 2 - 380 * s / 2,
|
||||||
screensize.Y/2 - 200/2,
|
screensize.Y / 2 - 200 * s / 2,
|
||||||
screensize.X/2 + 380/2,
|
screensize.X / 2 + 380 * s / 2,
|
||||||
screensize.Y/2 + 200/2
|
screensize.Y / 2 + 200 * s / 2
|
||||||
);
|
);
|
||||||
recalculateAbsolutePosition(false);
|
recalculateAbsolutePosition(false);
|
||||||
|
|
||||||
@ -85,8 +85,8 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize)
|
|||||||
Add stuff
|
Add stuff
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 160, 20);
|
core::rect<s32> rect(0, 0, 160 * s, 20 * s);
|
||||||
rect = rect + v2s32(size.X / 2 - 80, size.Y / 2 - 70);
|
rect = rect + v2s32(size.X / 2 - 80 * s, size.Y / 2 - 70 * s);
|
||||||
|
|
||||||
const wchar_t *text = wgettext("Sound Volume: ");
|
const wchar_t *text = wgettext("Sound Volume: ");
|
||||||
core::stringw volume_text = text;
|
core::stringw volume_text = text;
|
||||||
@ -97,24 +97,24 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize)
|
|||||||
true, this, ID_soundText);
|
true, this, ID_soundText);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 80, 30);
|
core::rect<s32> rect(0, 0, 80 * s, 30 * s);
|
||||||
rect = rect + v2s32(size.X/2-80/2, size.Y/2+55);
|
rect = rect + v2s32(size.X / 2 - 80 * s / 2, size.Y / 2 + 55 * s);
|
||||||
const wchar_t *text = wgettext("Exit");
|
const wchar_t *text = wgettext("Exit");
|
||||||
Environment->addButton(rect, this, ID_soundExitButton,
|
Environment->addButton(rect, this, ID_soundExitButton,
|
||||||
text);
|
text);
|
||||||
delete[] text;
|
delete[] text;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 300, 20);
|
core::rect<s32> rect(0, 0, 300 * s, 20 * s);
|
||||||
rect = rect + v2s32(size.X / 2 - 150, size.Y / 2);
|
rect = rect + v2s32(size.X / 2 - 150 * s, size.Y / 2);
|
||||||
gui::IGUIScrollBar *e = Environment->addScrollBar(true,
|
gui::IGUIScrollBar *e = Environment->addScrollBar(true,
|
||||||
rect, this, ID_soundSlider);
|
rect, this, ID_soundSlider);
|
||||||
e->setMax(100);
|
e->setMax(100);
|
||||||
e->setPos(volume);
|
e->setPos(volume);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 160, 20);
|
core::rect<s32> rect(0, 0, 160 * s, 20 * s);
|
||||||
rect = rect + v2s32(size.X / 2 - 80, size.Y / 2 - 35);
|
rect = rect + v2s32(size.X / 2 - 80 * s, size.Y / 2 - 35 * s);
|
||||||
const wchar_t *text = wgettext("Muted");
|
const wchar_t *text = wgettext("Muted");
|
||||||
Environment->addCheckBox(g_settings->getBool("mute_sound"), rect, this,
|
Environment->addCheckBox(g_settings->getBool("mute_sound"), rect, this,
|
||||||
ID_soundMuteButton, text);
|
ID_soundMuteButton, text);
|
||||||
|
@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "modalMenu.h"
|
#include "modalMenu.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "porting.h"
|
#include "porting.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
#ifdef HAVE_TOUCHSCREENGUI
|
#ifdef HAVE_TOUCHSCREENGUI
|
||||||
#include "touchscreengui.h"
|
#include "touchscreengui.h"
|
||||||
@ -37,6 +38,11 @@ GUIModalMenu::GUIModalMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent,
|
|||||||
#endif
|
#endif
|
||||||
m_menumgr(menumgr)
|
m_menumgr(menumgr)
|
||||||
{
|
{
|
||||||
|
m_gui_scale = g_settings->getFloat("gui_scaling");
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
float d = porting::getDisplayDensity();
|
||||||
|
m_gui_scale *= 1.1 - 0.3 * d + 0.2 * d * d;
|
||||||
|
#endif
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
Environment->setFocus(this);
|
Environment->setFocus(this);
|
||||||
m_menumgr->createdMenu(this);
|
m_menumgr->createdMenu(this);
|
||||||
|
@ -65,6 +65,7 @@ protected:
|
|||||||
v2s32 m_pointer;
|
v2s32 m_pointer;
|
||||||
v2s32 m_old_pointer; // Mouse position after previous mouse event
|
v2s32 m_old_pointer; // Mouse position after previous mouse event
|
||||||
v2u32 m_screensize_old;
|
v2u32 m_screensize_old;
|
||||||
|
float m_gui_scale;
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
v2s32 m_down_pos;
|
v2s32 m_down_pos;
|
||||||
std::string m_jni_field_name;
|
std::string m_jni_field_name;
|
||||||
|
@ -86,6 +86,7 @@ src/gettext.cpp
|
|||||||
src/gettext.h
|
src/gettext.h
|
||||||
src/gui/guiChatConsole.cpp
|
src/gui/guiChatConsole.cpp
|
||||||
src/gui/guiChatConsole.h
|
src/gui/guiChatConsole.h
|
||||||
|
src/gui/guiConfirmRegistration.cpp
|
||||||
src/gui/guiEditBoxWithScrollbar.cpp
|
src/gui/guiEditBoxWithScrollbar.cpp
|
||||||
src/gui/guiEditBoxWithScrollbar.h
|
src/gui/guiEditBoxWithScrollbar.h
|
||||||
src/gui/guiEngine.cpp
|
src/gui/guiEngine.cpp
|
||||||
|
Loading…
Reference in New Issue
Block a user