eugeneloza / decoherence

Project moved to https://gitlab.com/EugeneLoza/decoherence
GNU General Public License v3.0
10 stars 7 forks source link

Check: cursor may interfere with Android #486

Closed eugeneloza closed 6 years ago

eugeneloza commented 6 years ago

(for later, if Android support will be returned) I'm not sure how cursor will behave in case of Android, because usually the coordinates will be "the last touch" i.e. it will get stuck with cursor remaining at the last touch position. So, in case of Android (or any other touch-device) the cursor must be hidden permanently (rather not created at all).

michaliskambi commented 6 years ago

Helpful tip (something I found works nicely in my games):

I advice to use the Application.TouchDevice to do some logic depending on "whether we are on a touch device". Like:

if Application.TouchDevice then
  ... cursor stays hidden always ...
else
  .. custom drawn cursor ...

Application.TouchDevice is automatically initialized to true on Android and iOS, false elsewhere.

The advantage of this approach is that you can then easily simulate "touch device behavior" on desktop, by trivially doing Application.TouchDevice := true at the beginning of your program. See http://castle-engine.io/manual_cross_platform.php about Application.TouchDevice and see how example https://github.com/castle-engine/castle-engine/blob/master/examples/fps_game/game.pas uses Application.TouchDevice .

eugeneloza commented 6 years ago

Thanks a lot! That should be easy to fix then.