SDL
SDL copied to clipboard
No support for Tablet input features
This bug report was migrated from our old Bugzilla tracker.
Reported in version: HG 2.1 Reported for operating system, platform: Windows (All), x86_64
Comments on the original bug report:
On 2016-07-07 22:14:20 +0000, Stefan Murawski wrote:
So I decided to create this feature-request/bug-report, since it seems that this strangely has not been done before. On Windows, more advanced, say anything other than x/y position and left/right click, is not supported. To list a few of these feature that might be supported by tablets:
- pressure
- z position (stylus being recognized before touching the surface)
- rotation
- angle
- differentiation between different tips and stylii and very likely more that I didn't think about.
The, I would guess, most wanted feature would be to get the pressure, this has quite a few potential uses in games and non-game applications. (Painting Programs are a very good example!)
Getting this data on Windows is not really an easy task, there are two major competing apis available. One is Wintab, which has been created by Wacom which is used by their tablets and (a bit more poorly) by some 3rd Party developers like for example Huion. This one is, in my opinion, actually the easier to use one, you can get some results rather quickly and examples are a bit more common since this has been around for quite some time.
The other way to get this data would be from Microsofts APIs, for SDL it seems that the RealTimeStylus Interface would be the most useful one. https://msdn.microsoft.com/en-us/library/windows/desktop/ms701683(v=vs.85).aspx
Anders Ekermo, has created a blog post 3 years ago about this, and has even posted a working example using SDL and the RealTimeStylus Interface. http://backworlds.com/under-pressure/
While it's good to know that this works and that someone could use that example to add tablet support to his program, this is not a really clean or intuitive solution and it also won't translate into SDL Ports for other languages. So, if SDL would support this directly someone using PySDL would be able to simply get the same inputs from tablets without having to bash their head open trying to speak to the RealTimeStylus Interface. (Silently raises hand, Microsofts APIs are really confusing, even more if you want to use them from a not supported language like python.)
So in short: Please support the RealTimeStylus Interface so we can create more SDL programs with pressure support, thanks.
On 2017-08-12 01:13:33 +0000, Sam Lantinga wrote:
This is good feedback for SDL 2.1, thanks!
+1 i'm extremely interested in this - could this be done through explicit query API's , analogous to GetKeyboardState() .. "SDL2_GetPenPressure()" returning the pressure corresponding the data returned by SDL_GetMouseState() regarding exact synchronization with any event queue - in desktop OS's the pen is wired up controlling the mouse cursor that the application usually reads as a matter of course.
I am currently most interested in MacOSX support for this , second to that XInput?
@dobkeratops , thank you for your interest-- feel free to have a look at the API:
Event API:
- https://github.com/creichen/SDL/blob/pen-api/include/SDL_events.h#L163
- https://github.com/creichen/SDL/blob/pen-api/include/SDL_events.h#L553
Other API: https://github.com/creichen/SDL/blob/pen-api/include/SDL_pen.h (this includes calls such as the one you asked for)
XInput2 support is already available.
This has been implemented in SDL 3.0, in SDL_pen.h. Please feel free to create a new issue if there's functionality that you need that is still missing.
This has been implemented in SDL 3.0, in SDL_pen.h. Please feel free to create a new issue if there's functionality that you need that is still missing.
HUZZAH! (Or as Tux Paint would say "wah wah WAH"!)