From b5762af56787fd4ffd589fb4f29e3ea07cd5bf42 Mon Sep 17 00:00:00 2001 From: Jameson Ernst Date: Mon, 28 Oct 2013 13:09:42 -0700 Subject: [PATCH] Bind touch API. Use frameworks on OS X --- SDL2#.dll.config | 14 +++++++++----- src/SDL2.cs | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/SDL2#.dll.config b/SDL2#.dll.config index 04628d7..6653717 100644 --- a/SDL2#.dll.config +++ b/SDL2#.dll.config @@ -1,22 +1,26 @@ - + - + - + - + + + + + - + diff --git a/src/SDL2.cs b/src/SDL2.cs index 103397b..434d1ed 100644 --- a/src/SDL2.cs +++ b/src/SDL2.cs @@ -4338,6 +4338,45 @@ namespace SDL2 #endregion + #region SDL_touch.h + + public const uint SDL_TOUCH_MOUSEID = uint.MaxValue; + + public struct SDL_Finger + { + public long id; // SDL_FingerID + public float x; + public float y; + public float pressure; + } + + /** + * \brief Get the number of registered touch devices. + */ + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern int SDL_GetNumTouchDevices(); + + /** + * \brief Get the touch ID with the given index, or 0 if the index is invalid. + */ + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern long SDL_GetTouchDevice(int index); + + /** + * \brief Get the number of active fingers for a given touch device. + */ + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern int SDL_GetNumTouchFingers(long touchID); + + /** + * \brief Get the finger object of the given touch, with the given index. + * Returns pointer to SDL_Finger. + */ + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr SDL_GetTouchFinger(long touchID, int index); + + #endregion + #region SDL_joystick.h public const byte SDL_HAT_CENTERED = 0x00;