🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

316 lines
10 KiB

  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * \file SDL_system.h
  20. *
  21. * Include file for platform specific SDL API functions
  22. */
  23. #ifndef SDL_system_h_
  24. #define SDL_system_h_
  25. #include "SDL_stdinc.h"
  26. #include "SDL_keyboard.h"
  27. #include "SDL_render.h"
  28. #include "SDL_video.h"
  29. #include "begin_code.h"
  30. /* Set up for C function definitions, even when using C++ */
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /* Platform specific functions for Windows */
  35. #ifdef __WIN32__
  36. /**
  37. \brief Set a function that is called for every windows message, before TranslateMessage()
  38. */
  39. typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsigned int message, Uint64 wParam, Sint64 lParam);
  40. extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata);
  41. /**
  42. \brief Returns the D3D9 adapter index that matches the specified display index.
  43. This adapter index can be passed to IDirect3D9::CreateDevice and controls
  44. on which monitor a full screen application will appear.
  45. */
  46. extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex );
  47. typedef struct IDirect3DDevice9 IDirect3DDevice9;
  48. /**
  49. \brief Returns the D3D device associated with a renderer, or NULL if it's not a D3D renderer.
  50. Once you are done using the device, you should release it to avoid a resource leak.
  51. */
  52. extern DECLSPEC IDirect3DDevice9* SDLCALL SDL_RenderGetD3D9Device(SDL_Renderer * renderer);
  53. /**
  54. \brief Returns the DXGI Adapter and Output indices for the specified display index.
  55. These can be passed to EnumAdapters and EnumOutputs respectively to get the objects
  56. required to create a DX10 or DX11 device and swap chain.
  57. */
  58. extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapterIndex, int *outputIndex );
  59. #endif /* __WIN32__ */
  60. /* Platform specific functions for Linux */
  61. #ifdef __LINUX__
  62. /**
  63. \brief Sets the UNIX nice value for a thread, using setpriority() if possible, and RealtimeKit if available.
  64. \return 0 on success, or -1 on error.
  65. */
  66. extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority);
  67. #endif /* __LINUX__ */
  68. /* Platform specific functions for iOS */
  69. #ifdef __IPHONEOS__
  70. #define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
  71. extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
  72. #define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
  73. extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
  74. #endif /* __IPHONEOS__ */
  75. /* Platform specific functions for Android */
  76. #ifdef __ANDROID__
  77. /**
  78. \brief Get the JNI environment for the current thread
  79. This returns JNIEnv*, but the prototype is void* so we don't need jni.h
  80. */
  81. extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
  82. /**
  83. \brief Get the SDL Activity object for the application
  84. This returns jobject, but the prototype is void* so we don't need jni.h
  85. The jobject returned by SDL_AndroidGetActivity is a local reference.
  86. It is the caller's responsibility to properly release it
  87. (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef)
  88. */
  89. extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
  90. /**
  91. \brief Return API level of the current device
  92. API level 29: Android 10
  93. API level 28: Android 9
  94. API level 27: Android 8.1
  95. API level 26: Android 8.0
  96. API level 25: Android 7.1
  97. API level 24: Android 7.0
  98. API level 23: Android 6.0
  99. API level 22: Android 5.1
  100. API level 21: Android 5.0
  101. API level 20: Android 4.4W
  102. API level 19: Android 4.4
  103. API level 18: Android 4.3
  104. API level 17: Android 4.2
  105. API level 16: Android 4.1
  106. API level 15: Android 4.0.3
  107. API level 14: Android 4.0
  108. API level 13: Android 3.2
  109. API level 12: Android 3.1
  110. API level 11: Android 3.0
  111. API level 10: Android 2.3.3
  112. */
  113. extern DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void);
  114. /**
  115. \brief Return true if the application is running on Android TV
  116. */
  117. extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void);
  118. /**
  119. \brief Return true if the application is running on a Chromebook
  120. */
  121. extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void);
  122. /**
  123. \brief Return true is the application is running on a Samsung DeX docking station
  124. */
  125. extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void);
  126. /**
  127. \brief Trigger the Android system back button behavior.
  128. */
  129. extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void);
  130. /**
  131. See the official Android developer guide for more information:
  132. http://developer.android.com/guide/topics/data/data-storage.html
  133. */
  134. #define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01
  135. #define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02
  136. /**
  137. \brief Get the path used for internal storage for this application.
  138. This path is unique to your application and cannot be written to
  139. by other applications.
  140. */
  141. extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void);
  142. /**
  143. \brief Get the current state of external storage, a bitmask of these values:
  144. SDL_ANDROID_EXTERNAL_STORAGE_READ
  145. SDL_ANDROID_EXTERNAL_STORAGE_WRITE
  146. If external storage is currently unavailable, this will return 0.
  147. */
  148. extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
  149. /**
  150. \brief Get the path used for external storage for this application.
  151. This path is unique to your application, but is public and can be
  152. written to by other applications.
  153. */
  154. extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
  155. #endif /* __ANDROID__ */
  156. /* Platform specific functions for WinRT */
  157. #ifdef __WINRT__
  158. /**
  159. * \brief WinRT / Windows Phone path types
  160. */
  161. typedef enum
  162. {
  163. /** \brief The installed app's root directory.
  164. Files here are likely to be read-only. */
  165. SDL_WINRT_PATH_INSTALLED_LOCATION,
  166. /** \brief The app's local data store. Files may be written here */
  167. SDL_WINRT_PATH_LOCAL_FOLDER,
  168. /** \brief The app's roaming data store. Unsupported on Windows Phone.
  169. Files written here may be copied to other machines via a network
  170. connection.
  171. */
  172. SDL_WINRT_PATH_ROAMING_FOLDER,
  173. /** \brief The app's temporary data store. Unsupported on Windows Phone.
  174. Files written here may be deleted at any time. */
  175. SDL_WINRT_PATH_TEMP_FOLDER
  176. } SDL_WinRT_Path;
  177. /**
  178. * \brief WinRT Device Family
  179. */
  180. typedef enum
  181. {
  182. /** \brief Unknown family */
  183. SDL_WINRT_DEVICEFAMILY_UNKNOWN,
  184. /** \brief Desktop family*/
  185. SDL_WINRT_DEVICEFAMILY_DESKTOP,
  186. /** \brief Mobile family (for example smartphone) */
  187. SDL_WINRT_DEVICEFAMILY_MOBILE,
  188. /** \brief XBox family */
  189. SDL_WINRT_DEVICEFAMILY_XBOX,
  190. } SDL_WinRT_DeviceFamily;
  191. /**
  192. * \brief Retrieves a WinRT defined path on the local file system
  193. *
  194. * \note Documentation on most app-specific path types on WinRT
  195. * can be found on MSDN, at the URL:
  196. * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
  197. *
  198. * \param pathType The type of path to retrieve.
  199. * \return A UCS-2 string (16-bit, wide-char) containing the path, or NULL
  200. * if the path is not available for any reason. Not all paths are
  201. * available on all versions of Windows. This is especially true on
  202. * Windows Phone. Check the documentation for the given
  203. * SDL_WinRT_Path for more information on which path types are
  204. * supported where.
  205. */
  206. extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType);
  207. /**
  208. * \brief Retrieves a WinRT defined path on the local file system
  209. *
  210. * \note Documentation on most app-specific path types on WinRT
  211. * can be found on MSDN, at the URL:
  212. * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
  213. *
  214. * \param pathType The type of path to retrieve.
  215. * \return A UTF-8 string (8-bit, multi-byte) containing the path, or NULL
  216. * if the path is not available for any reason. Not all paths are
  217. * available on all versions of Windows. This is especially true on
  218. * Windows Phone. Check the documentation for the given
  219. * SDL_WinRT_Path for more information on which path types are
  220. * supported where.
  221. */
  222. extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
  223. /**
  224. * \brief Detects the device family of WinRT plattform on runtime
  225. *
  226. * \return Device family
  227. */
  228. extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
  229. #endif /* __WINRT__ */
  230. /**
  231. \brief Return true if the current device is a tablet.
  232. */
  233. extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void);
  234. /* Functions used by iOS application delegates to notify SDL about state changes */
  235. extern DECLSPEC void SDLCALL SDL_OnApplicationWillTerminate(void);
  236. extern DECLSPEC void SDLCALL SDL_OnApplicationDidReceiveMemoryWarning(void);
  237. extern DECLSPEC void SDLCALL SDL_OnApplicationWillResignActive(void);
  238. extern DECLSPEC void SDLCALL SDL_OnApplicationDidEnterBackground(void);
  239. extern DECLSPEC void SDLCALL SDL_OnApplicationWillEnterForeground(void);
  240. extern DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void);
  241. #ifdef __IPHONEOS__
  242. extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void);
  243. #endif
  244. /* Ends C function definitions when using C++ */
  245. #ifdef __cplusplus
  246. }
  247. #endif
  248. #include "close_code.h"
  249. #endif /* SDL_system_h_ */
  250. /* vi: set ts=4 sw=4 expandtab: */