1 /+
2 +            Copyright 2022 – 2024 Aya Partridge
3 +          Copyright 2018 - 2022 Michael D. Parker
4 + Distributed under the Boost Software License, Version 1.0.
5 +     (See accompanying file LICENSE_1_0.txt or copy at
6 +           http://www.boost.org/LICENSE_1_0.txt)
7 +/
8 module sdl.touch;
9 
10 import bindbc.sdl.config;
11 import bindbc.sdl.codegen;
12 
13 alias SDL_TouchID = long;
14 alias SDL_FingerID = long;
15 
16 struct SDL_Finger{
17 	SDL_FingerID id;
18 	float x;
19 	float y;
20 	float pressure;
21 }
22 
23 enum SDL_TOUCH_MOUSEID = cast(uint)-1;
24 
25 static if(sdlSupport >= SDLSupport.v2_0_10){
26 	alias SDL_TouchDeviceType = int;
27 	enum: SDL_TouchDeviceType{
28 		SDL_TOUCH_DEVICE_INVALID = -1,
29 		SDL_TOUCH_DEVICE_DIRECT,
30 		SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE,
31 		SDL_TOUCH_DEVICE_INDIRECT_RELATIVE,
32 	}
33 	
34 	enum SDL_MOUSE_TOUCHID = -1L;
35 }
36 
37 mixin(joinFnBinds((){
38 	FnBind[] ret = [
39 		{q{int}, q{SDL_GetNumTouchDevices}, q{}},
40 		{q{SDL_TouchID}, q{SDL_GetTouchDevice}, q{int index}},
41 		{q{int}, q{SDL_GetNumTouchFingers}, q{SDL_TouchID touchID}},
42 		{q{SDL_Finger*}, q{SDL_GetTouchFinger}, q{SDL_TouchID touchID, int index}},
43 	];
44 	if(sdlSupport >= SDLSupport.v2_0_10){
45 		FnBind[] add = [
46 			{q{SDL_TouchDeviceType}, q{SDL_GetTouchDeviceType}, q{SDL_TouchID touchID}},
47 		];
48 		ret ~= add;
49 	}
50 	if(sdlSupport >= SDLSupport.v2_0_22){
51 		FnBind[] add = [
52 			{q{const(char)*}, q{SDL_GetTouchName}, q{int index}},
53 		];
54 		ret ~= add;
55 	}
56 	return ret;
57 }()));