1 /+
2 +            Copyright 2022 – 2023 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 	string[][] ret;
39 	ret ~= makeFnBinds([
40 		[q{int}, q{SDL_GetNumTouchDevices}, q{}],
41 		[q{SDL_TouchID}, q{SDL_GetTouchDevice}, q{int index}],
42 		[q{int}, q{SDL_GetNumTouchFingers}, q{SDL_TouchID touchID}],
43 		[q{SDL_Finger*}, q{SDL_GetTouchFinger}, q{SDL_TouchID touchID, int index}],
44 	]);
45 	static if(sdlSupport >= SDLSupport.v2_0_10){
46 		ret ~= makeFnBinds([
47 			[q{SDL_TouchDeviceType}, q{SDL_GetTouchDeviceType}, q{SDL_TouchID touchID}],
48 		]);
49 	}
50 	static if(sdlSupport >= SDLSupport.v2_0_22){
51 		ret ~= makeFnBinds([
52 			[q{const(char)*}, q{SDL_GetTouchName}, q{int index}],
53 		]);
54 	}
55 	return ret;
56 }()));