Skip to content

Commit

Permalink
Adjust touchscreen_sensitivity to display density
Browse files Browse the repository at this point in the history
  • Loading branch information
grorp committed Jan 27, 2024
1 parent 8ba896d commit cafc9a1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion builtin/settingtypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ touchscreen_threshold (Touchscreen threshold) int 20 0 100
# Touchscreen sensitivity multiplier.
#
# Requires: touchscreen_gui
touchscreen_sensitivity (Touchscreen sensitivity) float 0.1 0.001 10.0
touchscreen_sensitivity (Touchscreen sensitivity) float 0.2 0.001 10.0

# Use crosshair to select object instead of whole screen.
# If enabled, a crosshair will be shown and will be used for selecting object.
Expand Down
2 changes: 1 addition & 1 deletion src/defaultsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ void set_default_settings()

#ifdef HAVE_TOUCHSCREENGUI
settings->setDefault("touchscreen_threshold", "20");
settings->setDefault("touchscreen_sensitivity", "0.1");
settings->setDefault("touchscreen_sensitivity", "0.2");
settings->setDefault("touch_use_crosshair", "false");
settings->setDefault("fixed_virtual_joystick", "false");
settings->setDefault("virtual_joystick_triggers_aux1", "false");
Expand Down
3 changes: 2 additions & 1 deletion src/gui/touchscreengui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,8 @@ void TouchScreenGUI::translateEvent(const SEvent &event)
m_pointer_pos[event.TouchInput.ID] = touch_pos;

// adapt to similar behavior as pc screen
const double d = g_settings->getFloat("touchscreen_sensitivity", 0.001f, 10.0f) * 3.0f;
const double d = g_settings->getFloat("touchscreen_sensitivity", 0.001f, 10.0f)
* 6.0f / RenderingEngine::getDisplayDensity();

// update camera_yaw and camera_pitch
m_camera_yaw_change -= dir_free.X * d;
Expand Down

0 comments on commit cafc9a1

Please sign in to comment.