1 2 // Copyright 2018 - 2021 Michael D. Parker 3 // Distributed under the Boost Software License, Version 1.0. 4 // (See accompanying file LICENSE_1_0.txt or copy at 5 // http://www.boost.org/LICENSE_1_0.txt) 6 7 module bindbc.sdl.bind.sdltouch; 8 9 import bindbc.sdl.config; 10 11 alias SDL_TouchID = long; 12 alias SDL_FingerID = long; 13 14 struct SDL_Finger { 15 SDL_FingerID id; 16 float x; 17 float y; 18 float pressure; 19 } 20 21 enum DL_TOUCH_MOUSEID = cast(uint)-1; 22 23 static if(sdlSupport >= SDLSupport.sdl2010) { 24 enum SDL_TouchDeviceType { 25 SDL_TOUCH_DEVICE_INVALID = -1, 26 SDL_TOUCH_DEVICE_DIRECT, 27 SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, 28 SDL_TOUCH_DEVICE_INDIRECT_RELATIVE, 29 } 30 mixin(expandEnum!SDL_TouchDeviceType); 31 32 enum SDL_MOUSE_TOUCHID = -1L; 33 } 34 35 static if(staticBinding) { 36 extern(C) @nogc nothrow { 37 int SDL_GetNumTouchDevices(); 38 SDL_TouchID SDL_GetTouchDevice(int index); 39 int SDL_GetNumTouchFingers(SDL_TouchID touchID); 40 SDL_Finger* SDL_GetTouchFinger(SDL_TouchID touchID, int index); 41 } 42 static if(sdlSupport >= SDLSupport.sdl2010) { 43 SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID touchID); 44 } 45 } 46 else { 47 extern(C) @nogc nothrow { 48 alias pSDL_GetNumTouchDevices = int function(); 49 alias pSDL_GetTouchDevice = SDL_TouchID function(int index); 50 alias pSDL_GetNumTouchFingers = int function(SDL_TouchID touchID); 51 alias pSDL_GetTouchFinger = SDL_Finger* function(SDL_TouchID touchID, int index); 52 } 53 __gshared { 54 pSDL_GetNumTouchDevices SDL_GetNumTouchDevices; 55 pSDL_GetTouchDevice SDL_GetTouchDevice; 56 pSDL_GetNumTouchFingers SDL_GetNumTouchFingers; 57 pSDL_GetTouchFinger SDL_GetTouchFinger; 58 } 59 static if(sdlSupport >= SDLSupport.sdl2010) { 60 extern(C) @nogc nothrow { 61 alias pSDL_GetTouchDeviceType = SDL_TouchDeviceType function(SDL_TouchID touchID); 62 } 63 __gshared { 64 pSDL_GetTouchDeviceType SDL_GetTouchDeviceType; 65 } 66 } 67 }