sdl_touch.odin 1.1 KB

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