-
Notifications
You must be signed in to change notification settings - Fork 4
Touch vs Mouse
John Galvin edited this page Oct 26, 2024
·
11 revisions
A Touch Event and a Mouse Event are not same event.
This is one of the hardest things to grasp when moving from a desktop development to mobile, is the understanding that there is no such thing as a "mouse" in the mobile development world. There are only touch events and unlike mouse events, touch events do not maintain state.
And that's it in a nutshell...
- There is no concept of a Left button events (i.e. Click, Down, Up etc)
- There is no concept of a Right button events (i.e. Click, Down, Up etc)
- There is no concept of Mouse Location Events (Hover etc)
The good news is, a single touch event, olc::GetTouch()
, can be likened to a olc::GetMouse(0)
which means your simple fire and forget code will work the very same.
-
olc::GetTouch().bPressed
can be executed the same asolc::GetMouse(0).bPressed
-
olc::GetTouch().bHeld
can be executed the same asolc::GetMouse(0).bHeld
-
olc::GetTouch().bReleased
can be executed the same asolc::GetMouse(0).bReleased
- For Visual Studio All In One Android and iOS (Windows) Project Template: OLC Pixel Game Engine Mobile 2.2.8 Visual Studio for Android and iOS
- For Visual Studio Android Only (Windows) Use this project: OLC Pixel Game Engine Mobile 2.2.8 for Android Visual Studio
- For Android Studio (Windows/Linux/MAC) Use this project: OLC Pixel Game Engine Mobile 2.2.8 for Android Studio
- For Xcode (MAC) Use this project: OLC Pixel Game Engine Mobile 2.2.8 for Xcode