1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

TouchControls: Implement an option for dig/place buttons (#15845)

This commit is contained in:
grorp 2025-03-21 07:06:44 -04:00 committed by GitHub
parent 1f14b7cb1b
commit ead44a27ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 540 additions and 88 deletions

View file

@ -259,6 +259,17 @@ local function load()
["true"] = fgettext_ne("Enabled"),
["false"] = fgettext_ne("Disabled"),
}
get_setting_info("touch_interaction_style").option_labels = {
["tap"] = fgettext_ne("Tap"),
["tap_crosshair"] = fgettext_ne("Tap with crosshair"),
["buttons_crosshair"] = fgettext("Buttons with crosshair"),
}
get_setting_info("touch_punch_gesture").option_labels = {
["short_tap"] = fgettext_ne("Short tap"),
["long_tap"] = fgettext_ne("Long tap"),
}
end
@ -359,6 +370,7 @@ local function check_requirements(name, requires)
local video_driver = core.get_active_driver()
local touch_support = core.irrlicht_device_supports_touch()
local touch_controls = core.settings:get("touch_controls")
local touch_interaction_style = core.settings:get("touch_interaction_style")
local special = {
android = PLATFORM == "Android",
desktop = PLATFORM ~= "Android",
@ -369,6 +381,7 @@ local function check_requirements(name, requires)
keyboard_mouse = not touch_support or (touch_controls == "auto" or not core.is_yes(touch_controls)),
opengl = (video_driver == "opengl" or video_driver == "opengl3"),
gles = video_driver:sub(1, 5) == "ogles",
touch_interaction_style_tap = touch_interaction_style ~= "buttons_crosshair",
}
for req_key, req_value in pairs(requires) do

View file

@ -167,6 +167,36 @@ invert_hotbar_mouse_wheel (Hotbar: Invert mouse wheel direction) bool false
# Requires: touch_support
touch_controls (Touchscreen controls) enum auto auto,true,false
# The kind of digging/placing controls used.
#
# * Tap
# Long/short tap anywhere on the screen to interact.
# Interaction happens at finger position.
#
# * Tap with crosshair
# Long/short tap anywhere on the screen to interact.
# Interaction happens at crosshair position.
#
# * Buttons with crosshair
# Use dedicated dig/place buttons to interact.
# Interaction happens at crosshair position.
#
# Requires: touchscreen
touch_interaction_style (Interaction style) enum tap tap,tap_crosshair,buttons_crosshair
# The gesture for punching players/entities.
# This can be overridden by games and mods.
#
# * Short tap
# Easy to use and well-known from other games that shall not be named.
#
# * Long tap
# Known from the classic Luanti mobile controls.
# Combat is more or less impossible.
#
# Requires: touchscreen, touch_interaction_style_tap
touch_punch_gesture (Punch gesture) enum short_tap short_tap,long_tap
# Touchscreen sensitivity multiplier.
#
# Requires: touchscreen
@ -182,12 +212,6 @@ touchscreen_threshold (Movement threshold) int 20 0 100
# Requires: touchscreen
touch_long_tap_delay (Threshold for long taps) int 400 100 1000
# Use crosshair to select object instead of whole screen.
# If enabled, a crosshair will be shown and will be used for selecting object.
#
# Requires: touchscreen
touch_use_crosshair (Use crosshair for touch screen) bool false
# Fixes the position of virtual joystick.
# If disabled, virtual joystick will center to first-touch's position.
#
@ -200,20 +224,6 @@ fixed_virtual_joystick (Fixed virtual joystick) bool false
# Requires: touchscreen
virtual_joystick_triggers_aux1 (Virtual joystick triggers Aux1 button) bool false
# The gesture for punching players/entities.
# This can be overridden by games and mods.
#
# * short_tap
# Easy to use and well-known from other games that shall not be named.
#
# * long_tap
# Known from the classic Luanti mobile controls.
# Combat is more or less impossible.
#
# Requires: touchscreen
touch_punch_gesture (Punch gesture) enum short_tap short_tap,long_tap
[Graphics and Audio]
[*Graphics]