TouchScreenGUI: use mouse_sensitivity
setting instead of mouse_sensity
This commit is contained in:
parent
df9e57bf05
commit
a254814f11
@ -81,7 +81,7 @@ local languages, language_dropdown, lang_idx = get_language_list()
|
||||
local function formspec(tabview, name, tabdata)
|
||||
local fps = tonumber(core.settings:get("fps_max"))
|
||||
local range = tonumber(core.settings:get("viewing_range"))
|
||||
local sensitivity = tonumber(core.settings:get("mouse_sensitivity")) * 2000
|
||||
local sensitivity = tonumber(core.settings:get("touch_sensitivity")) * 2000
|
||||
local touchtarget = core.settings:get_bool("touchtarget") or false
|
||||
local fancy_leaves = core.settings:get("leaves_style") == "fancy"
|
||||
local fast_move = core.settings:get_bool("fast_move") or false
|
||||
@ -296,7 +296,7 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
||||
|
||||
local event = core.explode_scrollbar_event(fields["sb_sensitivity"])
|
||||
if event.type == "CHG" then
|
||||
core.settings:set("mouse_sensitivity", event.value / 2000)
|
||||
core.settings:set("touch_sensitivity", event.value / 2000)
|
||||
|
||||
-- The formspec cannot be updated or the scrollbar movement will
|
||||
-- break.
|
||||
|
@ -99,6 +99,9 @@ invert_mouse (Invert mouse) bool false
|
||||
# Mouse sensitivity multiplier.
|
||||
mouse_sensitivity (Mouse sensitivity) float 0.2
|
||||
|
||||
# Touch sensitivity multiplier.
|
||||
touch_sensitivity (Touch sensitivity) float 0.2
|
||||
|
||||
# If enabled, "special" key instead of "sneak" key is used for climbing down and
|
||||
# descending.
|
||||
aux1_descends (Special key for climbing/descending) bool false
|
||||
|
@ -61,6 +61,10 @@
|
||||
# type: float
|
||||
# mouse_sensitivity = 0.2
|
||||
|
||||
# Touch sensitivity multiplier.
|
||||
# type: float
|
||||
# touch_sensitivity = 0.2
|
||||
|
||||
# If enabled, "special" key instead of "sneak" key is used for climbing down and
|
||||
# descending.
|
||||
# type: bool
|
||||
|
@ -528,6 +528,7 @@ void set_default_settings()
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
settings->setDefault("touchtarget", "true");
|
||||
settings->setDefault("touchscreen_threshold", "20");
|
||||
settings->setDefault("touch_sensitivity", "0.2");
|
||||
settings->setDefault("fixed_virtual_joystick", "true");
|
||||
settings->setDefault("virtual_joystick_triggers_aux", "false");
|
||||
settings->setDefault("fast_move", "true");
|
||||
@ -640,7 +641,7 @@ void set_default_settings()
|
||||
if (x_inches <= 3.7) {
|
||||
// small 4" phones
|
||||
g_settings->setDefault("hud_scaling", "0.55");
|
||||
g_settings->setDefault("mouse_sensitivity", "0.3");
|
||||
g_settings->setDefault("touch_sensitivity", "0.3");
|
||||
} else if (x_inches > 3.7 && x_inches <= 4.5) {
|
||||
// medium phones
|
||||
g_settings->setDefault("hud_scaling", "0.6");
|
||||
@ -686,33 +687,36 @@ void set_default_settings()
|
||||
if SDVersion4Inch {
|
||||
// 4" iPhone and iPod Touch
|
||||
settings->setDefault("hud_scaling", "0.55");
|
||||
settings->setDefault("mouse_sensitivity", "0.33");
|
||||
settings->setDefault("touch_sensitivity", "0.33");
|
||||
} else if SDVersion4and7Inch {
|
||||
// 4.7" iPhone
|
||||
settings->setDefault("hud_scaling", "0.6");
|
||||
settings->setDefault("mouse_sensitivity", "0.27");
|
||||
settings->setDefault("touch_sensitivity", "0.27");
|
||||
} else if SDVersion5and5Inch {
|
||||
// 5.5" iPhone Plus
|
||||
settings->setDefault("hud_scaling", "0.65");
|
||||
settings->setDefault("mouse_sensitivity", "0.3");
|
||||
settings->setDefault("touch_sensitivity", "0.3");
|
||||
} else if (SDVersion5and8Inch || SDVersion6and1Inch) {
|
||||
// 5.8" and 6.1" iPhones
|
||||
settings->setDefault("hud_scaling", "0.8");
|
||||
settings->setDefault("mouse_sensitivity", "0.35");
|
||||
settings->setDefault("touch_sensitivity", "0.35");
|
||||
settings->setDefault("selectionbox_width", "6");
|
||||
} else if SDVersion6and5Inch {
|
||||
// 6.5" iPhone
|
||||
settings->setDefault("hud_scaling", "0.85");
|
||||
settings->setDefault("mouse_sensitivity", "0.35");
|
||||
settings->setDefault("touch_sensitivity", "0.35");
|
||||
settings->setDefault("selectionbox_width", "6");
|
||||
} else if SDVersion7and9Inch {
|
||||
// iPad mini
|
||||
settings->setDefault("hud_scaling", "0.9");
|
||||
settings->setDefault("mouse_sensitivity", "0.25");
|
||||
settings->setDefault("touch_sensitivity", "0.25");
|
||||
settings->setDefault("selectionbox_width", "6");
|
||||
} else if SDVersion8and3Inch {
|
||||
settings->setDefault("touch_sensitivity", "0.25");
|
||||
settings->setDefault("selectionbox_width", "6");
|
||||
} else {
|
||||
// iPad
|
||||
settings->setDefault("mouse_sensitivity", "0.3");
|
||||
settings->setDefault("touch_sensitivity", "0.3");
|
||||
settings->setDefault("selectionbox_width", "6");
|
||||
}
|
||||
|
||||
|
@ -437,7 +437,7 @@ TouchScreenGUI::TouchScreenGUI(IrrlichtDevice *device, IEventReceiver *receiver)
|
||||
}
|
||||
|
||||
m_touchscreen_threshold = g_settings->getU16("touchscreen_threshold");
|
||||
m_mouse_sensitivity = rangelim(g_settings->getFloat("mouse_sensitivity"), 0.1, 1.0);
|
||||
m_touch_sensitivity = rangelim(g_settings->getFloat("touch_sensitivity"), 0.1, 1.0);
|
||||
m_fixed_joystick = g_settings->getBool("fixed_virtual_joystick");
|
||||
m_joystick_triggers_special1 = g_settings->getBool("virtual_joystick_triggers_aux");
|
||||
m_screensize = m_device->getVideoDriver()->getScreenSize();
|
||||
@ -865,6 +865,9 @@ void TouchScreenGUI::moveJoystick(const SEvent &event, float dx, float dy) {
|
||||
|
||||
void TouchScreenGUI::translateEvent(const SEvent &event)
|
||||
{
|
||||
if (!m_buttons_initialized)
|
||||
return;
|
||||
|
||||
if (!m_visible) {
|
||||
infostream
|
||||
<< "TouchScreenGUI::translateEvent got event but not visible!"
|
||||
@ -991,11 +994,8 @@ void TouchScreenGUI::translateEvent(const SEvent &event)
|
||||
s32 dx = X - m_pointerpos[event.TouchInput.ID].X;
|
||||
s32 dy = Y - m_pointerpos[event.TouchInput.ID].Y;
|
||||
|
||||
// adapt to similar behaviour as pc screen
|
||||
double d = m_mouse_sensitivity;
|
||||
|
||||
m_camera_yaw_change -= dx * d;
|
||||
m_camera_pitch = MYMIN(MYMAX(m_camera_pitch + (dy * d), -180), 180);
|
||||
m_camera_yaw_change -= dx * m_touch_sensitivity;
|
||||
m_camera_pitch = MYMIN(MYMAX(m_camera_pitch + (dy * m_touch_sensitivity), -180), 180);
|
||||
|
||||
// update shootline
|
||||
m_shootline = m_device
|
||||
|
@ -224,7 +224,7 @@ private:
|
||||
v2u32 m_screensize;
|
||||
s32 button_size;
|
||||
double m_touchscreen_threshold;
|
||||
double m_mouse_sensitivity;
|
||||
double m_touch_sensitivity;
|
||||
std::map<int, rect<s32>> m_hud_rects;
|
||||
std::map<size_t, irr::EKEY_CODE> m_hud_ids;
|
||||
bool m_visible; // is the gui visible
|
||||
|
Loading…
x
Reference in New Issue
Block a user