sdl_touch.odin 1010 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package sdl2
  2. import "core:c"
  3. when ODIN_OS == .Windows {
  4. @(ignore_duplicates)
  5. foreign import lib "SDL2.lib"
  6. } else {
  7. @(ignore_duplicates)
  8. foreign import lib "system:SDL2"
  9. }
  10. TouchID :: distinct i64
  11. FingerID :: distinct i64
  12. TouchDeviceType :: enum c.int {
  13. INVALID = -1,
  14. DIRECT, /* touch screen with window-relative coordinates */
  15. INDIRECT_ABSOLUTE, /* trackpad with absolute device coordinates */
  16. INDIRECT_RELATIVE, /* trackpad with screen cursor-relative coordinates */
  17. }
  18. Finger :: struct {
  19. id: FingerID,
  20. x: f32,
  21. y: f32,
  22. pressure: f32,
  23. }
  24. TOUCH_MOUSEID :: ~u32(0)
  25. MOUSE_TOUCH_ID :: TouchID(-1)
  26. @(default_calling_convention="c", link_prefix="SDL_")
  27. foreign lib {
  28. GetNumTouchDevices :: proc() -> c.int ---
  29. GetTouchDevice :: proc(index: c.int) -> TouchID ---
  30. GetTouchDeviceType :: proc(touchID: TouchID) -> TouchDeviceType ---
  31. GetNumTouchFingers :: proc(touchID: TouchID) -> c.int ---
  32. GetTouchFinger :: proc(touchID: TouchID, index: c.int) -> ^Finger ---
  33. }