Skip to content

Commit

Permalink
Android: Replace movement buttons with joystick (#7126)
Browse files Browse the repository at this point in the history
* Android: Replace movement buttons with joystick

Replace movement control buttons (arrows at bottom left screen) with virtual joystick.
Joystick has 8 directions (same as keyboard). Basically, just map it to keyboard input.
Joystick applies only on left 1/3 of screen.
Joystick's position can be fixed by enabling fixed_virtual_joystick setting.
Three new images:
(1) placeholder joystick,
(2) joystick container (background), and
(3) joystick cursor.
Remove unused images: movement control buttons (*_arrow.png).
New data type: touch_gui_joystick_move_id

Joystick's fixed position is spaced one button size from bottom and from left of screen.
Remove unused variable: m_joystick_downlocation
  • Loading branch information
srifqi authored and SmallJoker committed Apr 10, 2018
1 parent 22ebbe1 commit 326eeca
Show file tree
Hide file tree
Showing 12 changed files with 340 additions and 122 deletions.
7 changes: 7 additions & 0 deletions builtin/settingtypes.txt
Expand Up @@ -118,6 +118,13 @@ random_input (Random input) bool false
# Continuous forward movement, toggled by autoforward key.
continuous_forward (Continuous forward) bool false

# The length in pixels it takes for touch screen interaction to start.
touchscreen_threshold (Touch screen threshold) int 20 0 100

# (Android) Fixes the position of virtual joystick.
# If disabled, virtual joystick will center to first-touch's position.
fixed_virtual_joystick (Fixed virtual joystick) bool false

# Enable joysticks
enable_joysticks (Enable joysticks) bool false

Expand Down
9 changes: 9 additions & 0 deletions minetest.conf.example
Expand Up @@ -86,6 +86,15 @@
# type: bool
# continuous_forward = false

# The length in pixels it takes for touch screen interaction to start.
# type: int
# touchscreen_threshold = 20

# (Android) Fixes the position of virtual joystick.
# If disabled, virtual joystick will center to first-touch's position.
# type: int
# fixed_virtual_joystick = false

# Enable Joysticks
# type: bool
# enable_joysticks = false
Expand Down
1 change: 1 addition & 0 deletions src/defaultsettings.cpp
Expand Up @@ -408,6 +408,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("touchtarget", "true");
settings->setDefault("TMPFolder","/sdcard/" PROJECT_NAME_C "/tmp/");
settings->setDefault("touchscreen_threshold","20");
settings->setDefault("fixed_virtual_joystick", "false");
settings->setDefault("smooth_lighting", "false");
settings->setDefault("max_simultaneous_block_sends_per_client", "3");
settings->setDefault("emergequeue_limit_diskonly", "8");
Expand Down

0 comments on commit 326eeca

Please sign in to comment.