SDL_system.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
  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. #if defined(__IPHONEOS__) && __IPHONEOS__
  27. #include "SDL_video.h"
  28. #include "SDL_keyboard.h"
  29. #endif
  30. #include "begin_code.h"
  31. /* Set up for C function definitions, even when using C++ */
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. /* Platform specific functions for iOS */
  36. #if defined(__IPHONEOS__) && __IPHONEOS__
  37. extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
  38. extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
  39. #endif /* __IPHONEOS__ */
  40. /* Platform specific functions for Android */
  41. #if defined(__ANDROID__) && __ANDROID__
  42. /* Get the JNI environment for the current thread
  43. This returns JNIEnv*, but the prototype is void* so we don't need jni.h
  44. */
  45. extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv();
  46. /* Get the SDL Activity object for the application
  47. This returns jobject, but the prototype is void* so we don't need jni.h
  48. The jobject returned by SDL_AndroidGetActivity is a local reference.
  49. It is the caller's responsibility to properly release it
  50. (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef)
  51. */
  52. extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity();
  53. /* See the official Android developer guide for more information:
  54. http://developer.android.com/guide/topics/data/data-storage.html
  55. */
  56. #define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01
  57. #define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02
  58. /* Get the path used for internal storage for this application.
  59. This path is unique to your application and cannot be written to
  60. by other applications.
  61. */
  62. extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath();
  63. /* Get the current state of external storage, a bitmask of these values:
  64. SDL_ANDROID_EXTERNAL_STORAGE_READ
  65. SDL_ANDROID_EXTERNAL_STORAGE_WRITE
  66. If external storage is currently unavailable, this will return 0.
  67. */
  68. extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState();
  69. /* Get the path used for external storage for this application.
  70. This path is unique to your application, but is public and can be
  71. written to by other applications.
  72. */
  73. extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath();
  74. #endif /* __ANDROID__ */
  75. /* Platform specific functions for WinRT */
  76. #if defined(__WINRT__) && __WINRT__
  77. /**
  78. * \brief WinRT / Windows Phone path types
  79. */
  80. typedef enum
  81. {
  82. /** \brief The installed app's root directory.
  83. Files here are likely to be read-only. */
  84. SDL_WINRT_PATH_INSTALLED_LOCATION,
  85. /** \brief The app's local data store. Files may be written here */
  86. SDL_WINRT_PATH_LOCAL_FOLDER,
  87. /** \brief The app's roaming data store. Unsupported on Windows Phone.
  88. Files written here may be copied to other machines via a network
  89. connection.
  90. */
  91. SDL_WINRT_PATH_ROAMING_FOLDER,
  92. /** \brief The app's temporary data store. Unsupported on Windows Phone.
  93. Files written here may be deleted at any time. */
  94. SDL_WINRT_PATH_TEMP_FOLDER
  95. } SDL_WinRT_Path;
  96. /**
  97. * \brief Retrieves a WinRT defined path on the local file system
  98. *
  99. * \note Documentation on most app-specific path types on WinRT
  100. * can be found on MSDN, at the URL:
  101. * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
  102. *
  103. * \param pathType The type of path to retrieve.
  104. * \ret A UCS-2 string (16-bit, wide-char) containing the path, or NULL
  105. * if the path is not available for any reason. Not all paths are
  106. * available on all versions of Windows. This is especially true on
  107. * Windows Phone. Check the documentation for the given
  108. * SDL_WinRT_Path for more information on which path types are
  109. * supported where.
  110. */
  111. extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType);
  112. /**
  113. * \brief Retrieves a WinRT defined path on the local file system
  114. *
  115. * \note Documentation on most app-specific path types on WinRT
  116. * can be found on MSDN, at the URL:
  117. * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
  118. *
  119. * \param pathType The type of path to retrieve.
  120. * \ret A UTF-8 string (8-bit, multi-byte) containing the path, or NULL
  121. * if the path is not available for any reason. Not all paths are
  122. * available on all versions of Windows. This is especially true on
  123. * Windows Phone. Check the documentation for the given
  124. * SDL_WinRT_Path for more information on which path types are
  125. * supported where.
  126. */
  127. extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
  128. #ifdef __cplusplus_winrt
  129. /**
  130. * \brief Initializes a WinRT and XAML based application.
  131. *
  132. * \param backgroundPanel The XAML background panel to draw onto and receive
  133. * events from.
  134. * \param mainFunction The SDL app's C-style main().
  135. * \ret 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more
  136. * information on the failure.
  137. */
  138. /* TODO, WinRT: consider making SDL_WinRTInitXAMLApp accept a void pointer to IUnknown, rather than a C++/CX reference */
  139. extern DECLSPEC int SDLCALL SDL_WinRTInitXAMLApp(Platform::Object^ backgroundPanel, int (*mainFunction)(int, char **));
  140. #endif // ifdef __cplusplus_winrt
  141. #endif /* __WINRT__ */
  142. /* Ends C function definitions when using C++ */
  143. #ifdef __cplusplus
  144. }
  145. #endif
  146. #include "close_code.h"
  147. #endif /* _SDL_system_h */
  148. /* vi: set ts=4 sw=4 expandtab: */