blackberry / SDL

Simple DirectMedia Layer is an open-source, cross-platform multimedia library designed to provide a low level API.
GNU Lesser General Public License v2.1
86 stars 46 forks source link

Possibility of supporting multi-touch? #22

Closed jgranick closed 12 years ago

jgranick commented 12 years ago

Hi,

SDL 1.2 does not include support for multi-touch, officially. However, Palm patched SDL to provide support for multi-touch input by adding a "which" property to the mouse events, similar to how SDL defines a "which" property for joystick buttons.

I am not sure of the specifics of how multi-touch works "under the hood" on the PlayBook, but if it provides touch point IDs, perhaps it would be possible to expose them as a "which" property on the mouse events?

This would be extraordinary if it is possible, as we already have support for multi-touch in Android, iOS and webOS, and adding a "which" property would immediately add BlackBerry support.

Thank you!

jnicholl commented 12 years ago

I believe we already support this? If you do not provide a sdl-controls.xml file, to tell SDL that you do not wish to use TouchControlOverlay, then I believe the SDL multi-mouse support will be used. Take a look at SDL_playbookevents.c, handleMtouchEvent calls SDL_PrivateMultiMouseButton and provides the contact id as the 'which' parameter. Let me know if it doesn't work or if part of the API is missing for you.

Thanks.

-----Original Message----- From: Joshua Granick [mailto:reply@reply.github.com] Sent: Wednesday, June 06, 2012 10:56 PM To: Jeremy Nicholl Subject: [SDL] Possibility of supporting multi-touch? (#22)

Hi,

SDL 1.2 does not include support for multi-touch, officially. However, Palm patched SDL to provide support for multi-touch input by adding a "which" property to the mouse events, similar to how SDL defines a "which" property for joystick buttons.

I am not sure of the specifics of how multi-touch works "under the hood" on the PlayBook, but if it provides touch point IDs, perhaps it would be possible to expose them as a "which" property on the mouse events?

This would be extraordinary if it is possible, as we already have support for multi-touch in Android, iOS and webOS, and adding a "which" property would immediately add BlackBerry support.

Thank you!


Reply to this email directly or view it on GitHub: https://github.com/blackberry/SDL/issues/22


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

jgranick commented 12 years ago

Awesome!

With your direction, I found the code that defines the "event.motion.which" property. It is used when TOUCHPAD_SIMULATE is not defined.

Turns out, the define is commented out, so multi-touch is enabled by default. I was able to change "#ifdef WEBOS" to "#if defined(WEBOS) || defined(BLACKBERRY)" in a few places to enable multi-touch in NME. It works great.

I am sorry I missed this, and excited you already had it implemented. Thank you!

hamlatzis commented 11 years ago

I do receive mouse down/up & motion events for different fingers, but when I move two or more fingers at the same time the code runs sluggish. So it cannot be used for multi touch game