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.sdlhints;
8 
9 import bindbc.sdl.config;
10 import bindbc.sdl.bind.sdlstdinc : SDL_bool;
11 
12 enum SDL_HINT_FRAMEBUFFER_ACCELERATION = "SDL_FRAMEBUFFER_ACCELERATION";
13 enum SDL_HINT_RENDER_DRIVER = "SDL_RENDER_DRIVER";
14 enum SDL_HINT_RENDER_OPENGL_SHADERS = "SDL_RENDER_OPENGL_SHADERS";
15 enum SDL_HINT_RENDER_SCALE_QUALITY = "SDL_RENDER_SCALE_QUALITY";
16 enum SDL_HINT_RENDER_VSYNC = "SDL_RENDER_VSYNC";
17 enum SDL_HINT_VIDEO_X11_XVIDMODE = "SDL_VIDEO_X11_XVIDMODE";
18 enum SDL_HINT_VIDEO_X11_XINERAMA = "SDL_VIDEO_X11_XINERAMA";
19 enum SDL_HINT_VIDEO_X11_XRANDR = "SDL_VIDEO_X11_XRANDR";
20 enum SDL_HINT_GRAB_KEYBOARD = "SDL_GRAB_KEYBOARD";
21 enum SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS = "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS";
22 enum SDL_HINT_IDLE_TIMER_DISABLED = "SDL_IOS_IDLE_TIMER_DISABLED";
23 enum SDL_HINT_ORIENTATIONS = "SDL_IOS_ORIENTATIONS";
24 enum SDL_HINT_XINPUT_ENABLED = "SDL_XINPUT_ENABLED";
25 enum SDL_HINT_GAMECONTROLLERCONFIG = "SDL_GAMECONTROLLERCONFIG";
26 enum SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS = "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS";
27 enum SDL_HINT_ALLOW_TOPMOST = "SDL_ALLOW_TOPMOST";
28 enum SDL_HINT_TIMER_RESOLUTION = "SDL_TIMER_RESOLUTION";
29 
30 static if(sdlSupport >= SDLSupport.sdl201) {
31     enum SDL_HINT_RENDER_DIRECT3D_THREADSAFE = "SDL_RENDER_DIRECT3D_THREADSAFE";
32     enum SDL_HINT_VIDEO_HIGHDPI_DISABLED = "SDL_VIDEO_HIGHDPI_DISABLED";
33 }
34 
35 static if(sdlSupport >= SDLSupport.sdl202) {
36     enum SDL_HINT_VIDEO_ALLOW_SCREENSAVER = "SDL_VIDEO_ALLOW_SCREENSAVER";
37     enum SDL_HINT_MOUSE_RELATIVE_MODE_WARP = "SDL_MOUSE_RELATIVE_MODE_WARP";
38     enum SDL_HINT_ACCELEROMETER_AS_JOYSTICK = "SDL_ACCELEROMETER_AS_JOYSTICK";
39     enum SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK = "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK";
40     enum SDL_HINT_VIDEO_WIN_D3DCOMPILER = "SDL_VIDEO_WIN_D3DCOMPILER";
41     enum SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT = "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT";
42     enum SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES = "SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES";
43 }
44 
45 // This is *intended* to be == and not >=. The values for all of these changed in 2.0.4.
46 static if(sdlSupport == SDLSupport.sdl203) {
47     enum SDL_HINT_RENDER_DIRECT3D11_DEBUG = "SDL_HINT_RENDER_DIRECT3D11_DEBUG";
48     enum SDL_HINT_WINRT_PRIVACY_POLICY_URL = "SDL_HINT_WINRT_PRIVACY_POLICY_URL";
49     enum SDL_HINT_WINRT_PRIVACY_POLICY_LABEL = "SDL_HINT_WINRT_PRIVACY_POLICY_LABEL";
50     enum SDL_HINT_WINRT_HANDLE_BACK_BUTTON = "SDL_HINT_WINRT_HANDLE_BACK_BUTTON";
51 }
52 
53 static if(sdlSupport >= SDLSupport.sdl204) {
54     enum SDL_HINT_VIDEO_X11_NET_WM_PING = "SDL_VIDEO_X11_NET_WM_PING";
55     enum SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN = "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN";
56     enum SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP = "SDL_WINDOWS_ENABLE_MESSAGELOOP";
57     enum SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING = "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING";
58     enum SDL_HINT_THREAD_STACK_SIZE = "SDL_THREAD_STACK_SIZE";
59     enum SDL_HINT_MAC_BACKGROUND_APP = "SDL_MAC_BACKGROUND_APP";
60     enum SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION = "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION";
61     enum SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION = "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION";
62     enum SDL_HINT_IME_INTERNAL_EDITING = "SDL_IME_INTERNAL_EDITING";
63     enum SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT = "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT";
64     enum SDL_HINT_NO_SIGNAL_HANDLERS = "SDL_NO_SIGNAL_HANDLERS";
65     enum SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 = "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4";
66 
67     // Changed values from those introduced in 2.0.3
68     enum SDL_HINT_RENDER_DIRECT3D11_DEBUG = "SDL_RENDER_DIRECT3D11_DEBUG";
69     enum SDL_HINT_WINRT_PRIVACY_POLICY_URL = "SDL_WINRT_PRIVACY_POLICY_URL";
70     enum SDL_HINT_WINRT_PRIVACY_POLICY_LABEL = "SDL_WINRT_PRIVACY_POLICY_LABEL";
71     enum SDL_HINT_WINRT_HANDLE_BACK_BUTTON = "SDL_WINRT_HANDLE_BACK_BUTTON";
72 }
73 
74 static if(sdlSupport >= SDLSupport.sdl205) {
75     enum SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH = "SDL_MOUSE_FOCUS_CLICKTHROUGH";
76     enum SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS = "SDL_APPLE_TV_CONTROLLER_UI_EVENTS";
77     enum SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION = "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION";
78     enum SDL_HINT_BMP_SAVE_LEGACY_FORMAT = "SDL_BMP_SAVE_LEGACY_FORMAT";
79     enum SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING = "SDL_WINDOWS_DISABLE_THREAD_NAMING";
80     enum SDL_HINT_RPI_VIDEO_LAYER = "SDL_RPI_VIDEO_LAYER";
81 }
82 
83 static if(sdlSupport >= SDLSupport.sdl206) {
84     enum SDL_HINT_RENDER_LOGICAL_SIZE_MODE = "SDL_RENDER_LOGICAL_SIZE_MODE";
85     enum SDL_HINT_WINDOWS_INTRESOURCE_ICON = "SDL_WINDOWS_INTRESOURCE_ICON";
86     enum SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL = "SDL_WINDOWS_INTRESOURCE_ICON_SMALL";
87     enum SDL_HINT_MOUSE_NORMAL_SPEED_SCALE = "SDL_MOUSE_NORMAL_SPEED_SCALE";
88     enum SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE = "SDL_MOUSE_RELATIVE_SPEED_SCALE";
89     enum SDL_HINT_TOUCH_MOUSE_EVENTS = "SDL_TOUCH_MOUSE_EVENTS";
90     enum SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES = "SDL_GAMECONTROLLER_IGNORE_DEVICES";
91     enum SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT = "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT";
92     enum SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION = "SDL_QTWAYLAND_CONTENT_ORIENTATION";
93     enum SDL_HINT_QTWAYLAND_WINDOW_FLAGS = "SDL_QTWAYLAND_WINDOW_FLAGS";
94     enum SDL_HINT_OPENGL_ES_DRIVER = "SDL_OPENGL_ES_DRIVER";
95     enum SDL_HINT_AUDIO_RESAMPLING_MODE = "SDL_AUDIO_RESAMPLING_MODE";
96     enum SDL_HINT_AUDIO_CATEGORY = "SDL_AUDIO_CATEGORY";
97 }
98 
99 static if(sdlSupport >= SDLSupport.sdl208) {
100     enum SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR = "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR";
101     enum SDL_HINT_IOS_HIDE_HOME_INDICATOR = "SDL_IOS_HIDE_HOME_INDICATOR";
102     enum SDL_HINT_TV_REMOTE_AS_JOYSTICK = "SDL_TV_REMOTE_AS_JOYSTICK";
103     enum SDL_HINT_RETURN_KEY_HIDES_IME = "SDL_RETURN_KEY_HIDES_IME";
104     enum SDL_HINT_VIDEO_DOUBLE_BUFFER = "SDL_VIDEO_DOUBLE_BUFFER";
105 }
106 
107 static if(sdlSupport >= SDLSupport.sdl209) {
108     enum SDL_HINT_MOUSE_DOUBLE_CLICK_TIME = "SDL_MOUSE_DOUBLE_CLICK_TIME";
109     enum SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS = "SDL_MOUSE_DOUBLE_CLICK_RADIUS";
110     enum SDL_HINT_JOYSTICK_HIDAPI = "SDL_JOYSTICK_HIDAPI";
111     enum SDL_HINT_JOYSTICK_HIDAPI_PS4 = "SDL_JOYSTICK_HIDAPI_PS4";
112     enum SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE = "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE";
113     enum SDL_HINT_JOYSTICK_HIDAPI_STEAM = "SDL_JOYSTICK_HIDAPI_STEAM";
114     enum SDL_HINT_JOYSTICK_HIDAPI_SWITCH = "SDL_JOYSTICK_HIDAPI_SWITCH";
115     enum SDL_HINT_JOYSTICK_HIDAPI_XBOX = "SDL_JOYSTICK_HIDAPI_XBOX";
116     enum SDL_HINT_ENABLE_STEAM_CONTROLLERS = "SDL_ENABLE_STEAM_CONTROLLERS";
117     enum SDL_HINT_ANDROID_TRAP_BACK_BUTTON = "SDL_ANDROID_TRAP_BACK_BUTTON";
118 }
119 
120 static if(sdlSupport >= SDLSupport.sdl2010) {
121     enum SDL_HINT_MOUSE_TOUCH_EVENTS = "SDL_MOUSE_TOUCH_EVENTS";
122     enum SDL_HINT_GAMECONTROLLERCONFIG_FILE = "SDL_GAMECONTROLLERCONFIG_FILE";
123     enum SDL_HINT_ANDROID_BLOCK_ON_PAUSE = "SDL_ANDROID_BLOCK_ON_PAUSE";
124     enum SDL_HINT_RENDER_BATCHING = "SDL_RENDER_BATCHING";
125     enum SDL_HINT_EVENT_LOGGING = "SDL_EVENT_LOGGING";
126     enum SDL_HINT_WAVE_RIFF_CHUNK_SIZE = "SDL_WAVE_RIFF_CHUNK_SIZE";
127     enum SDL_HINT_WAVE_TRUNCATION = "SDL_WAVE_TRUNCATION";
128     enum SDL_HINT_WAVE_FACT_CHUNK = "SDL_WAVE_FACT_CHUNK";
129 }
130 else static if(sdlSupport >= SDLSupport.sdl204) {
131     // Added in 2.0.4, removed in 2.0.10.
132     enum SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH = "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH";
133 }
134 
135 static if(sdlSupport >= SDLSupport.sdl2012) {
136     enum SDL_HINT_VIDEO_EXTERNAL_CONTEXT = "SDL_VIDEO_EXTERNAL_CONTEXT";
137     enum SDL_HINT_VIDEO_X11_WINDOW_VISUALID = "SDL_VIDEO_X11_WINDOW_VISUALID";
138     enum SDL_HINT_VIDEO_X11_FORCE_EGL = "SDL_VIDEO_X11_FORCE_EGL";
139     enum SDL_HINT_GAMECONTROLLERTYPE = "SDL_GAMECONTROLLERTYPE";
140     enum SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS = "SDL_GAMECONTROLLER_USE_BUTTON_LABELS";
141     enum SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE = "SDL_JOYSTICK_HIDAPI_GAMECUBE";
142     enum SDL_HINT_DISPLAY_USABLE_BOUNDS = "SDL_DISPLAY_USABLE_BOUNDS";
143 }
144 
145 static if(sdlSupport >= SDLSupport.sdl2014) {
146     enum SDL_HINT_MOUSE_RELATIVE_SCALING = "SDL_MOUSE_RELATIVE_SCALING";
147     enum SDL_HINT_JOYSTICK_HIDAPI_PS5 = "SDL_JOYSTICK_HIDAPI_PS5";
148     enum SDL_HINT_JOYSTICK_HIDAPI_CORRELATE_XINPUT = "SDL_JOYSTICK_HIDAPI_CORRELATE_XINPUT";
149     enum SDL_HINT_JOYSTICK_RAWINPUT = "SDL_JOYSTICK_RAWINPUT";
150     enum SDL_HINT_JOYSTICK_THREAD = "SDL_JOYSTICK_THREAD";
151     enum SDL_HINT_LINUX_JOYSTICK_DEADZONES = "SDL_LINUX_JOYSTICK_DEADZONES";
152     enum SDL_HINT_THREAD_PRIORITY_POLICY = "SDL_THREAD_PRIORITY_POLICY";
153     enum SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL = "SDL_THREAD_FORCE_REALTIME_TIME_CRITICAL";
154     enum SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO = "SDL_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO";
155     enum SDL_HINT_EMSCRIPTEN_ASYNCIFY = "SDL_EMSCRIPTEN_ASYNCIFY";
156     enum SDL_HINT_AUTO_UPDATE_JOYSTICKS = "SDL_AUTO_UPDATE_JOYSTICKS";
157     enum SDL_HINT_AUTO_UPDATE_SENSORS = "SDL_AUTO_UPDATE_SENSORS";
158     enum SDL_HINT_AUDIO_DEVICE_APP_NAME = "SDL_AUDIO_DEVICE_APP_NAME";
159     enum SDL_HINT_AUDIO_DEVICE_STREAM_NAME = "SDL_AUDIO_DEVICE_STREAM_NAME";
160     enum SDL_HINT_PREFERRED_LOCALES = "SDL_PREFERRED_LOCALES";
161 }
162 
163 enum SDL_HintPriority {
164     SDL_HINT_DEFAULT,
165     SDL_HINT_NORMAL,
166     SDL_HINT_OVERRIDE,
167 }
168 mixin(expandEnum!SDL_HintPriority);
169 
170 extern(C) nothrow alias SDL_HintCallback = void function(void*, const(char)*, const(char)*);
171 
172 static if(staticBinding) {
173     extern(C) @nogc nothrow {
174         SDL_bool SDL_SetHintWithPriority(const(char)* name, const(char)* value, SDL_HintPriority priority);
175         SDL_bool SDL_SetHint(const(char)* name, const(char)* value);
176         const(char)* SDL_GetHint(const(char)* name);
177         void SDL_AddHintCallback(const(char)* name, SDL_HintCallback callback, void* userdata);
178         void SDL_DelHintCallback(const(char)* name, SDL_HintCallback callback, void* userdata);
179         void SDL_ClearHints();
180 
181         static if(sdlSupport >= SDLSupport.sdl205) {
182             SDL_bool SDL_GetHintBoolean(const(char)* name, SDL_bool default_value);
183         }
184     }
185 }
186 else {
187     extern(C) @nogc nothrow {
188         alias pSDL_SetHintWithPriority = SDL_bool function(const(char)* name, const(char)* value, SDL_HintPriority priority);
189         alias pSDL_SetHint = SDL_bool function(const(char)* name, const(char)* value);
190         alias pSDL_GetHint = const(char)* function(const(char)* name);
191         alias pSDL_AddHintCallback = void function(const(char)* name, SDL_HintCallback callback, void* userdata);
192         alias pSDL_DelHintCallback = void function(const(char)* name, SDL_HintCallback callback, void* userdata);
193         alias pSDL_ClearHints = void function();
194     }
195 
196     __gshared {
197         pSDL_SetHintWithPriority SDL_SetHintWithPriority;
198         pSDL_SetHint SDL_SetHint;
199         pSDL_GetHint SDL_GetHint;
200         pSDL_AddHintCallback SDL_AddHintCallback;
201         pSDL_DelHintCallback SDL_DelHintCallback;
202         pSDL_ClearHints SDL_ClearHints;
203     }
204 
205     static if(sdlSupport >= SDLSupport.sdl205) {
206         extern(C) @nogc nothrow {
207             alias pSDL_GetHintBoolean = SDL_bool function(const(char)* name, SDL_bool default_value);
208         }
209 
210         __gshared {
211             pSDL_GetHintBoolean SDL_GetHintBoolean;
212         }
213     }
214 }