sdl_touch.odin 966 B

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