🛠️🐜 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.

279 lines
8.9 KiB

  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2019 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. #if defined(__IPHONEOS__) && __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. #if defined(__ANDROID__) && __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 true if the application is running on Android TV
  92. */
  93. extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void);
  94. /**
  95. \brief Return true if the application is running on a Chromebook
  96. */
  97. extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void);
  98. /**
  99. \brief Return true is the application is running on a Samsung DeX docking station
  100. */
  101. extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void);
  102. /**
  103. \brief Trigger the Android system back button behavior.
  104. */
  105. extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void);
  106. /**
  107. See the official Android developer guide for more information:
  108. http://developer.android.com/guide/topics/data/data-storage.html
  109. */
  110. #define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01
  111. #define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02
  112. /**
  113. \brief Get the path used for internal storage for this application.
  114. This path is unique to your application and cannot be written to
  115. by other applications.
  116. */
  117. extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void);
  118. /**
  119. \brief Get the current state of external storage, a bitmask of these values:
  120. SDL_ANDROID_EXTERNAL_STORAGE_READ
  121. SDL_ANDROID_EXTERNAL_STORAGE_WRITE
  122. If external storage is currently unavailable, this will return 0.
  123. */
  124. extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
  125. /**
  126. \brief Get the path used for external storage for this application.
  127. This path is unique to your application, but is public and can be
  128. written to by other applications.
  129. */
  130. extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
  131. #endif /* __ANDROID__ */
  132. /* Platform specific functions for WinRT */
  133. #if defined(__WINRT__) && __WINRT__
  134. /**
  135. * \brief WinRT / Windows Phone path types
  136. */
  137. typedef enum
  138. {
  139. /** \brief The installed app's root directory.
  140. Files here are likely to be read-only. */
  141. SDL_WINRT_PATH_INSTALLED_LOCATION,
  142. /** \brief The app's local data store. Files may be written here */
  143. SDL_WINRT_PATH_LOCAL_FOLDER,
  144. /** \brief The app's roaming data store. Unsupported on Windows Phone.
  145. Files written here may be copied to other machines via a network
  146. connection.
  147. */
  148. SDL_WINRT_PATH_ROAMING_FOLDER,
  149. /** \brief The app's temporary data store. Unsupported on Windows Phone.
  150. Files written here may be deleted at any time. */
  151. SDL_WINRT_PATH_TEMP_FOLDER
  152. } SDL_WinRT_Path;
  153. /**
  154. * \brief WinRT Device Family
  155. */
  156. typedef enum
  157. {
  158. /** \brief Unknown family */
  159. SDL_WINRT_DEVICEFAMILY_UNKNOWN,
  160. /** \brief Desktop family*/
  161. SDL_WINRT_DEVICEFAMILY_DESKTOP,
  162. /** \brief Mobile family (for example smartphone) */
  163. SDL_WINRT_DEVICEFAMILY_MOBILE,
  164. /** \brief XBox family */
  165. SDL_WINRT_DEVICEFAMILY_XBOX,
  166. } SDL_WinRT_DeviceFamily;
  167. /**
  168. * \brief Retrieves a WinRT defined path on the local file system
  169. *
  170. * \note Documentation on most app-specific path types on WinRT
  171. * can be found on MSDN, at the URL:
  172. * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
  173. *
  174. * \param pathType The type of path to retrieve.
  175. * \return A UCS-2 string (16-bit, wide-char) containing the path, or NULL
  176. * if the path is not available for any reason. Not all paths are
  177. * available on all versions of Windows. This is especially true on
  178. * Windows Phone. Check the documentation for the given
  179. * SDL_WinRT_Path for more information on which path types are
  180. * supported where.
  181. */
  182. extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType);
  183. /**
  184. * \brief Retrieves a WinRT defined path on the local file system
  185. *
  186. * \note Documentation on most app-specific path types on WinRT
  187. * can be found on MSDN, at the URL:
  188. * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
  189. *
  190. * \param pathType The type of path to retrieve.
  191. * \return A UTF-8 string (8-bit, multi-byte) containing the path, or NULL
  192. * if the path is not available for any reason. Not all paths are
  193. * available on all versions of Windows. This is especially true on
  194. * Windows Phone. Check the documentation for the given
  195. * SDL_WinRT_Path for more information on which path types are
  196. * supported where.
  197. */
  198. extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
  199. /**
  200. * \brief Detects the device family of WinRT plattform on runtime
  201. *
  202. * \return Device family
  203. */
  204. extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
  205. #endif /* __WINRT__ */
  206. /**
  207. \brief Return true if the current device is a tablet.
  208. */
  209. extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void);
  210. /* Ends C function definitions when using C++ */
  211. #ifdef __cplusplus
  212. }
  213. #endif
  214. #include "close_code.h"
  215. #endif /* SDL_system_h_ */
  216. /* vi: set ts=4 sw=4 expandtab: */