TeamMidnightDust / MidnightControls

A Minecraft mod adding controller support and enhanced controls overall.
https://midnightdust.eu/midnightcontrols/
MIT License
186 stars 29 forks source link

Feature: Better touchscreen support (Multitouch) #20

Open Felix14-v2 opened 2 years ago

Felix14-v2 commented 2 years ago

Description Now there are 3 platforms that support touch input and are able to run Java Edition — Android/iOS via Pocket Java Launcher and Windows 10 installed on tablets. The number of such devices capable of running JE is growing, but so far the Java Edition does not have touch control support.

Solution MidnightControls could implement several types of touch control of the game by adding the necessary buttons (or joysticks) with actions in the UI. And, possible, some additional controls.

Alternatives Bedrock-ify is a good base to request this feature, but I think that we need it outside bedrock-styled segment. Despite the fact that most touch-screen devices run on Android, this feature would be in demand on touch-screen laptops or tablets with Windows, whose owners don't necessarily want to "bedrockize" their Java Minecraft. In addition, the mod developer stated that he was not ready to work on touch controls in this issue, so, here I am.

Additional

My current Pojav controls settings ![Screenshot_20230215-150254](https://user-images.githubusercontent.com/75726196/224540068-b19fa022-6cad-4193-a116-1ad0751e691b.jpg)
Motschen commented 2 years ago

The basics of this feature were already implemented in LambdaControls, but never really finished. I'll see what I can do about this in the future.

Adzetko commented 2 years ago

Although the readme says midnightcontrols has an experimental and bugged touchscreen support, is there actually any way to enable it?

Motschen commented 2 years ago

The Touchscreen support was commented out in later versions of LambdaControls, I'll uncomment it soon

Motschen commented 2 years ago

Added in v1.2.0 :)

Poopooracoocoo commented 2 years ago

I thought I might add just how buggy it is: https://github.com/LambdAurora/LambdaControls/issues/42 https://github.com/LambdAurora/LambdaControls/issues/94 https://github.com/LambdAurora/LambdaControls/issues/86 says

The issue that I encountered with touchscreen is, well, on desktop it considers it a single pointer: the mouse, so you can't use multiple fingers at once, or you would need to access some very low-level, potentially breaking libraries to hack into the system to just make it work. So yeah, not worth it imo.

This explains why the touch controls in LambdaControls and MidnightControls are so poor and is why Lambda ultimately dropped it. I don't know why Minecraft doesn't handle touch events properly. It seems like something that only Mojang can fix. I don't know why though and it'd be great if someone could clarify that. I just read a bit about when Chromium added support for touch on Windows but I didn't understand it.

Felix14-v2 commented 2 years ago

Yeah, now it is *a bit* buggy... Tests with Pojav: https://youtu.be/JEEhm4H-Cs8

Motschen commented 2 years ago

It likely clashes a bit with Pojavlauncher's built-in mouse emulation, I'm going to add an option to disable MidnightControls' mouse emulation in the next version. As for the multitouch input on desktop OS's Lambda mentioned in the issues, I think the situation has improved a bit, at least on Linux using wayland (it works pretty well on Steam Deck after all I know).

Motschen commented 2 years ago

Also, Mojang have added preliminary touch input support in a recent update (1.18 I think), maybe I could take advantage of that.

Adzetko commented 2 years ago

About the official "touchscreen mode" in Minecraft, I never understood what it did apart from toggling a boolean? I know this isn't the point of this issue, but is it supposed to do something?

Felix14-v2 commented 2 years ago

It likely clashes a bit with Pojavlauncher's built-in mouse emulation

Maybe. Previously, lambdaControls had problems working on it, but these problems were similar both on a tablet (win10) and on a phone with LambdaControls. I will soon test the latest MidnightControls on my tablet.

Adzetko commented 2 years ago

Honestly, I know I'm in an edge case, but I'd be okay if I just have a touchscreen ui without the controls part, so it doesn't have to support mulitouch if that's a bummer to support, as when using Steam Link, I use the app's on screen display for movements. I believe it's the same for pojav? Anyway, I think pojav/moonlight/steam link/mobile setup users, at least, want their clicks to be more touch-friendly (on my Steam Link app, without this mod, I tried setting tap as right click and hold as left click, but it's not as simple as that, I get many interactions wrong). Also, would it be considered as cheating when playing online if you'd hit at what you're tapping and not at the center of your screen? Like with the circular overlay of the bedrock edition? It's practical when you quickly need precision (creeper jumpscares anyone?)

Felix14-v2 commented 2 years ago

About the official "touchscreen mode" in Minecraft, I never understood what it did apart from toggling a boolean?

It changes the logic of moving items through the inventory. Instead of...

Not so convenient, actually. Especially on the touch screen. Ironically, this mode was called "touchscreen mode".

Poopooracoocoo commented 2 years ago

The touch controls remain terrible on Windows by the way. Spinning death. I couldn't press escape to free my cursor but I was able to just tap on close window. 😆

Felix14-v2 commented 2 years ago

Finally I was able to test it on my tablet. Unfortunately, it doesn't work properly at all. https://youtu.be/tYRyEEzx3Es

WesleyVanNeck commented 2 years ago

@Motschen this might fix the touch issues https://github.com/Tungstend/TouchInjector

nimfq commented 1 year ago

" Вероятно, это немного противоречит встроенной эмуляции мыши Pojavlauncher, я собираюсь добавить опцию отключения эмуляции мыши MidnightControls в следующей версии. Что касается мультитач-ввода на Lambda настольной ОС, упомянутой в выпусках, я думаю, что ситуация немного улучшилась, по крайней мере, в Linux, использующем wayland (в конце концов, он довольно хорошо работает на Steam Deck)." Does this mean that this function should work in Linux?

Felix14-v2 commented 1 year ago

Today I dreamed that I was playing Java Edition with a touchscreen... Just a fun fact :)

plasmatank commented 1 year ago

@Motschen this might fix the touch issues https://github.com/Tungstend/TouchInjector

Seems doesn't work either, installed it on a vanilla minecraft due to poor instructions, in the end the game still just rapidly spinning

Motschen commented 1 year ago

Today I dreamed that I was playing Java Edition with a touchscreen... Just a fun fact :)

Your dreams have now become reality, with MidnightControls 1.9.0! Even though multitouch is still not supported [yet ;) ], the touchscreen is now actually usable (tested on my Steam Deck in Desktop mode)

Felix14-v2 commented 7 months ago

Just found this interesting project for Minecraft 1.8-1.12: https://github.com/Aang23/MC-TouchControls

It relies on an external framework to achieve multitouch. Maybe it is possible to use the same approach?