Hi Guys,
Need some advice/help...
I am trying to port one of our apps for Windows Desktop.
What are the best project settings, so that the app can be played with the touch screen and the mouse without an issue?
I only "Listen" to touch events.
I have the following problem:
- If I set "Mouse events generate touch events" I get a weird double touch event when I use the touchscreen and tap. The app can be played with the mouse with no issues.
- If I DON'T set "Mouse events generate touch events" - the game plays just fine with touchscreen(no double event), but the mouse stops working.
Any suggestions?
Thanks
Vlad
Comments
Can you download gideros-2015.07.15 - Custom[6].zip and see the event generated.
At that, you can detect event.touch.type that would shown whether it was from generated-mouse or real touch. With this, you can ignore one of the double event.
Can this fix your problem?
( i will include this in the future release, but not at the next release)
On which platform do you experience it?
It does it only on tap. Looks like Windows is trying to be smart and help apps that are not written to work with touches by generating an extra mouse click event or something ...
I will do some tests as per @tkhnoman's instructions and post the results here.
E.g. Open the "Bloom" example(by the way: kudos guys for adding this to Gideros - very nice).
Open the example on a Windows 8.1 PC with a touch screen. Play it in the player.
In the "bloom" example you can toggle the bloom effect (on/off) by clicking/tapping the app.
For me:
- it works with the mouse
- Does not work with the touch(tap) since it gets two quick events.
Does it work for you with the tap?
Not sure whether it is device/driver related though.
Or maybe our Gideros app needs to announce itself as "touch aware" to the OS so it will not receive these extra events. We will investigate...
https://github.com/gideros/gideros
https://www.youtube.com/c/JohnBlackburn1975
I did some more tests.
I compiled the app with Visual studio for WinRT.
The app opens in a full screen as a tablet/phone app. In this case windows does NOT do that - give extra events, I guess because it knows that the app must be touch aware to run in this mode.
In this case the app can be played with a mouse and touch just fine :-)
I don't see a good solution for desktop apps and desktop player in the Gideros code itself.
Unless there is a way to programmatically tell Windows that the desktop app is touch aware and it somehow stops trying to be smart (as @john26 suggests)
However I can see a simple workaround if @tkhnoman adds the extra touch value (touch.type) in some next release:
In the app code - we add a hidden touch receiving sprite on top of everything, which uses the touch.type to filter the extra mouse events. Simple logic - e.g: if the new touch is type "mouse" and there was a "touch" type event that happened prior to it, say less than 2 sec back - stop propagation of the mouse event.
Basically it will stop the extra events from propagating to your game below. This way you don't have to rewrite all your touch code...
Without touch registration you get the WM_GESTURE message, this is the one that has to be replied to in order to keep getting messages. You should check to see if 'GetGestureInfo' is in user32.dll and if it is then call it using lParam. You then look at gi\dwID to see what stage the gesture is at. Return false at the end of the message to indicate you know what is going on. If you get a WM_GESTURENOTIFY then check from 'SetGestureConfig' in user32.dll and if it's there call it with the address and length of a gesture config table.
To register a touch window, just check to see if 'RegisterTouchWindow' is present in user32.dll, if it is then call it with the window handle. That window will then get multi-touch messages.
For multi-touch, the messages to look for are WM_TOUCH and WM_TOUCHHITTESTING.
In win32 also look for WM_SETTINGCHANGE as that lets you know if a modern laptop has gone from Desktop to Slate mode (there is a string pointed to by lParam if not nil).
Desktop mode is when a laptop look like a laptop, slate mode is when a laptop looks like a tablet. On some laptops this means the screen has been flipped over the keyboard, on others this means the screen has been push far back and pulled underneath the keyboard, on some it means the screen has been pulled off the keyboard!
From what I've been led to believe, if you get the text "desktop" then it's a desktop and anything else means it's a slate.
Here are some equates from none gideros project I have...
https://deluxepixel.com