Skip to content

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

Merged
y5nw merged 4 commits into
luanti-org:masterfrom
grorp:buttonn
Mar 21, 2025
Merged

TouchControls: Implement an option for dig/place buttons#15845
y5nw merged 4 commits into
luanti-org:masterfrom
grorp:buttonn

Conversation

@grorp

@grorp grorp commented Feb 28, 2025

Copy link
Copy Markdown
Member

meant to resolve #13229

This PR adds the option to have dig/place buttons as a part of the touchscreen layout, instead of using long/short tap gestures for digging/placing. The biggest advantage is probably that the buttons allow for precise timing.

This PR introduces three different "modes" for the touch controls (new setting touch_interaction_style):

  • "Tap" (previously touch_use_crosshair = false)
    Long/short tap anywhere on the screen to interact. Interaction happens at finger position.
  • "Tap with crosshair" (previously touch_use_crosshair = true)
    Long/short tap anywhere on the screen to interact. Interaction happens at crosshair position.
  • "Buttons with crosshair" (NEW)
    Use dedicated dig/place buttons to interact. Interaction happens at crosshair position.

Adding an option for dig/place buttons and framing the different control schemes as "modes" (as an enumeration) in the settings was inspired by Minecraft's mobile version.

Video demo of the three modes (the new mode is at the end):

b5.mp4

To do

This PR is a Ready for Review.

Note: ~300 of the ~530 added lines in this PR are the new SVG icons.

How to test

  • Test the different modes, confirm that they work as expected.
  • Try upgrading from an earlier Luanti version, confirm that settings are preserved, confirm that the new mode still works as expected.
  • Confirm that dig/place buttons don't appear in modes other than "Buttons with crosshair".
  • Confirm that custom dig/place button positions aren't lost when switching away from "Buttons with crosshair" mode and going back later.

To have some fun, you could try the new control scheme in Block League on the A.E.S. server

@maplemedley

Copy link
Copy Markdown
Contributor

This is a great addition!
I tried building and running it, but when I open the installed app it gives this error as a popup:

Error: SDL C/Java version mismatch (expected 2.30.8, got 2.32.0)

Any idea where the issue is? Might be my gradle installation or something like that

@grorp

grorp commented Mar 3, 2025

Copy link
Copy Markdown
Member Author

@maplemedley this is caused by luanti-org/luanti_android_deps@6819d1f in combination with the fact that this PR has not been rebased on top of eb79a76 yet. Rebased now, should be fixed. If it still doesn't work, you could also try running gradle(w) clean before compiling again.

@maplemedley

maplemedley commented Mar 5, 2025

Copy link
Copy Markdown
Contributor

Thank you that worked

I tested the new features out on my phone and it all works as expected! It feels surprisingly snappy to use the direct dig/place buttons

The layout is also preserved when you switch away from and back to the new input mode. Didn't try upgrading from an earlier version though.

@NyxousLev01

Copy link
Copy Markdown

This is a Great Idea!

I also have another suggestion for the "Tap" Mode, It's better to have a TOUCH INDICATOR, similarly Minecraft PE has a similar feature and it appears as a Circle, which everybody knows whats this.

But this TOUCH INDICATOR could help navigating around more easier, and maybe reducing the need for a System(Device) Touch Indicator.

@y5nw y5nw self-requested a review March 18, 2025 16:05

@y5nw y5nw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase needed. Makes sense and works (tested with a convertible) otherwise.

The place/dig buttons could be improved, but IMO this can be done in a followup.

Comment thread src/gui/touchcontrols.cpp Outdated
@y5nw y5nw added Rebase needed The PR needs to be rebased by its author One approval ✅ ◻️ labels Mar 19, 2025
@grorp

grorp commented Mar 21, 2025

Copy link
Copy Markdown
Member Author

The place/dig buttons could be improved, but IMO this can be done in a followup.

It might be hard to make better textures while keeping them game-agnostic. Good icons would need to have some meaning to them, but the meaning of the buttons can differ wildly in different contexts (LMB = dig a node, punch someone, shoot a gun, press a button, ..; for all of these, there are different suitable icons). Luckily games and texture packs can override the button textures (at least statically), so we can also defer this to them.

@grorp grorp removed the Rebase needed The PR needs to be rebased by its author label Mar 21, 2025
@y5nw y5nw merged commit ead44a2 into luanti-org:master Mar 21, 2025
@grorp grorp deleted the buttonn branch March 21, 2025 11:13
@NyxousLev01

Copy link
Copy Markdown

What if there's also a 4th option of Allowing to use The Button CROSSHAIR, while also interacting with TAP without Crosshair, it's kind of like a 2-in-1 Option, and its

Also, it kinda would be nice if the Punch BUTTON or the RMB can be swippable and at the same time when you swipe it, it also swipe the screen view Which is the reason for that thing, since its more convinient using the Button, it feels kinda rough using it that way, even Mobile FPS game has this option tho, so why not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android: Add more touchscreen buttons

4 participants