mirror of
https://github.com/minetest/minetest.git
synced 2025-09-18 03:15:20 +02:00
split enable_touch to touch_controls (for touchscreen controls) and touch_gui
touch_gui provide adjustment to the interface, so it's more touch friendly Signed-off-by: David Heidelberg <david@ixit.cz>
This commit is contained in:
@@ -1578,7 +1578,7 @@ bool Game::initGui()
|
||||
gui_chat_console = new GUIChatConsole(guienv, guienv->getRootGUIElement(),
|
||||
-1, chat_backend, client, &g_menumgr);
|
||||
|
||||
if (g_settings->getBool("enable_touch"))
|
||||
if (g_settings->getBool("touch_controls"))
|
||||
g_touchcontrols = new TouchControls(device, texture_src);
|
||||
|
||||
return true;
|
||||
|
@@ -44,7 +44,7 @@ ClientDynamicInfo ClientDynamicInfo::getCurrent()
|
||||
|
||||
v2f32 ClientDynamicInfo::calculateMaxFSSize(v2u32 render_target_size, f32 gui_scaling)
|
||||
{
|
||||
f32 factor = (g_settings->getBool("enable_touch") ? 10 : 15) / gui_scaling;
|
||||
f32 factor = (g_settings->getBool("touch_gui") ? 10 : 15) / gui_scaling;
|
||||
f32 ratio = (f32)render_target_size.X / (f32)render_target_size.Y;
|
||||
if (ratio < 1)
|
||||
return { factor, factor / ratio };
|
||||
|
@@ -97,7 +97,8 @@ void set_default_settings()
|
||||
// Client
|
||||
settings->setDefault("address", "");
|
||||
settings->setDefault("enable_sound", "true");
|
||||
settings->setDefault("enable_touch", bool_to_cstr(has_touch));
|
||||
settings->setDefault("touch_controls", bool_to_cstr(has_touch));
|
||||
settings->setDefault("touch_gui", bool_to_cstr(has_touch));
|
||||
settings->setDefault("sound_volume", "0.8");
|
||||
settings->setDefault("sound_volume_unfocused", "0.3");
|
||||
settings->setDefault("mute_sound", "false");
|
||||
|
@@ -315,7 +315,7 @@ void GUIFormSpecMenu::parseSize(parserData* data, const std::string &element)
|
||||
data->invsize.Y = MYMAX(0, stof(parts[1]));
|
||||
|
||||
lockSize(false);
|
||||
if (!g_settings->getBool("enable_touch") && parts.size() == 3) {
|
||||
if (!g_settings->getBool("touch_gui") && parts.size() == 3) {
|
||||
if (parts[2] == "true") {
|
||||
lockSize(true,v2u32(800,600));
|
||||
}
|
||||
@@ -3166,7 +3166,7 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
||||
s32 min_screen_dim = std::min(padded_screensize.X, padded_screensize.Y);
|
||||
|
||||
double prefer_imgsize;
|
||||
if (g_settings->getBool("enable_touch")) {
|
||||
if (g_settings->getBool("touch_gui")) {
|
||||
// The preferred imgsize should be larger to accommodate the
|
||||
// smaller screensize.
|
||||
prefer_imgsize = min_screen_dim / 10 * gui_scaling;
|
||||
|
@@ -11,4 +11,12 @@ void migrate_settings()
|
||||
g_settings->getBool("opaque_water") ? "false" : "true");
|
||||
g_settings->remove("opaque_water");
|
||||
}
|
||||
|
||||
// Converts enable_touch to touch_controls/touch_gui
|
||||
if (g_settings->existsLocal("enable_touch")) {
|
||||
bool value = g_settings->getBool("enable_touch");
|
||||
g_settings->setBool("touch_controls", value);
|
||||
g_settings->setBool("touch_gui", value);
|
||||
g_settings->remove("enable_touch");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user