aboutsummaryrefslogtreecommitdiff
path: root/vendor/sdl3/sdl3_touch.odin
blob: 2933aa751698fa3ba768b5b64a362a92e0f230a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package sdl3

import "core:c"


TouchID  :: distinct Uint64
FingerID :: distinct Uint64

TouchDeviceType :: enum c.int {
	INVALID = -1,
	DIRECT,            /**< touch screen with window-relative coordinates */
	INDIRECT_ABSOLUTE, /**< trackpad with absolute device coordinates */
	INDIRECT_RELATIVE, /**< trackpad with screen cursor-relative coordinates */
}

Finger :: struct {
	id:       FingerID, /**< the finger ID */
	x:        f32,      /**< the x-axis location of the touch event, normalized (0...1) */
	y:        f32,      /**< the y-axis location of the touch event, normalized (0...1) */
	pressure: f32,      /**< the quantity of pressure applied, normalized (0...1) */
}

TOUCH_MOUSEID :: MouseID(1<<32 - 1)
MOUSE_TOUCHID :: TouchID(1<<64 - 1)

@(default_calling_convention="c", link_prefix="SDL_", require_results)
foreign lib {
	GetTouchDevices    :: proc(count: ^c.int) -> [^]TouchID ---
	GetTouchDeviceName :: proc(touchID: TouchID) -> cstring ---
	GetTouchDeviceType :: proc(touchID: TouchID) -> TouchDeviceType ---
	GetTouchFingers    :: proc(touchID: TouchID, count: ^c.int) -> [^]^Finger ---
}