aboutsummaryrefslogtreecommitdiff
path: root/vendor/sdl2/sdl_touch.odin
blob: 44633aeb638cfeff3a7551ba9c3cba832a430046 (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
33
34
35
36
37
38
39
40
package sdl2

import "core:c"

when ODIN_OS == .Windows {
	@(ignore_duplicates)
	foreign import lib "SDL2.lib"
} else {
	@(ignore_duplicates)
	foreign import lib "system:SDL2"
}

TouchID  :: distinct i64
FingerID :: distinct i64

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,
	x:        f32,
	y:        f32,
	pressure: f32,
}

TOUCH_MOUSEID  :: ~u32(0)
MOUSE_TOUCH_ID :: TouchID(-1)

@(default_calling_convention="c", link_prefix="SDL_")
foreign lib {
	GetNumTouchDevices :: proc() -> c.int ---
	GetTouchDevice     :: proc(index: c.int) -> TouchID ---
	GetTouchDeviceType :: proc(touchID: TouchID) -> TouchDeviceType ---
	GetNumTouchFingers :: proc(touchID: TouchID) -> c.int ---
	GetTouchFinger     :: proc(touchID: TouchID, index: c.int) -> ^Finger ---
}