diff options
| author | 3gg <3gg@shellblade.net> | 2026-03-06 13:26:57 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2026-03-06 13:26:57 -0800 |
| commit | f5c89b3bd5d74849757fd5b4d1a300068522a3ca (patch) | |
| tree | d6f6e4c81745b393d7594b334710f30c0b2df3bd /SDL-3.2.8/src/core/android/SDL_android.h | |
Diffstat (limited to 'SDL-3.2.8/src/core/android/SDL_android.h')
| -rw-r--r-- | SDL-3.2.8/src/core/android/SDL_android.h | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/SDL-3.2.8/src/core/android/SDL_android.h b/SDL-3.2.8/src/core/android/SDL_android.h new file mode 100644 index 0000000..3541c2a --- /dev/null +++ b/SDL-3.2.8/src/core/android/SDL_android.h | |||
| @@ -0,0 +1,163 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifndef SDL_android_h | ||
| 24 | #define SDL_android_h | ||
| 25 | |||
| 26 | // Set up for C function definitions, even when using C++ | ||
| 27 | #ifdef __cplusplus | ||
| 28 | /* *INDENT-OFF* */ | ||
| 29 | extern "C" { | ||
| 30 | /* *INDENT-ON* */ | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <EGL/eglplatform.h> | ||
| 34 | #include <android/native_window_jni.h> | ||
| 35 | |||
| 36 | #include "../../audio/SDL_sysaudio.h" | ||
| 37 | |||
| 38 | // this appears to be broken right now (on Android, not SDL, I think...?). | ||
| 39 | #define ALLOW_MULTIPLE_ANDROID_AUDIO_DEVICES 0 | ||
| 40 | |||
| 41 | // Life cycle | ||
| 42 | typedef enum | ||
| 43 | { | ||
| 44 | SDL_ANDROID_LIFECYCLE_WAKE, | ||
| 45 | SDL_ANDROID_LIFECYCLE_PAUSE, | ||
| 46 | SDL_ANDROID_LIFECYCLE_RESUME, | ||
| 47 | SDL_ANDROID_LIFECYCLE_LOWMEMORY, | ||
| 48 | SDL_ANDROID_LIFECYCLE_DESTROY, | ||
| 49 | SDL_NUM_ANDROID_LIFECYCLE_EVENTS | ||
| 50 | } SDL_AndroidLifecycleEvent; | ||
| 51 | |||
| 52 | void Android_SendLifecycleEvent(SDL_AndroidLifecycleEvent event); | ||
| 53 | bool Android_WaitLifecycleEvent(SDL_AndroidLifecycleEvent *event, Sint64 timeoutNS); | ||
| 54 | |||
| 55 | void Android_LockActivityMutex(void); | ||
| 56 | void Android_UnlockActivityMutex(void); | ||
| 57 | |||
| 58 | // Interface from the SDL library into the Android Java activity | ||
| 59 | extern void Android_JNI_SetActivityTitle(const char *title); | ||
| 60 | extern void Android_JNI_SetWindowStyle(bool fullscreen); | ||
| 61 | extern void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint); | ||
| 62 | extern void Android_JNI_MinizeWindow(void); | ||
| 63 | extern bool Android_JNI_ShouldMinimizeOnFocusLoss(void); | ||
| 64 | |||
| 65 | extern bool Android_JNI_GetAccelerometerValues(float values[3]); | ||
| 66 | extern void Android_JNI_ShowScreenKeyboard(int input_type, SDL_Rect *inputRect); | ||
| 67 | extern void Android_JNI_HideScreenKeyboard(void); | ||
| 68 | extern bool Android_JNI_IsScreenKeyboardShown(void); | ||
| 69 | extern ANativeWindow *Android_JNI_GetNativeWindow(void); | ||
| 70 | |||
| 71 | extern SDL_DisplayOrientation Android_JNI_GetDisplayNaturalOrientation(void); | ||
| 72 | extern SDL_DisplayOrientation Android_JNI_GetDisplayCurrentOrientation(void); | ||
| 73 | |||
| 74 | // Audio support | ||
| 75 | void Android_StartAudioHotplug(SDL_AudioDevice **default_playback, SDL_AudioDevice **default_recording); | ||
| 76 | void Android_StopAudioHotplug(void); | ||
| 77 | extern void Android_AudioThreadInit(SDL_AudioDevice *device); | ||
| 78 | |||
| 79 | // Detecting device type | ||
| 80 | extern bool Android_IsDeXMode(void); | ||
| 81 | extern bool Android_IsChromebook(void); | ||
| 82 | |||
| 83 | bool Android_JNI_FileOpen(void **puserdata, const char *fileName, const char *mode); | ||
| 84 | Sint64 Android_JNI_FileSize(void *userdata); | ||
| 85 | Sint64 Android_JNI_FileSeek(void *userdata, Sint64 offset, SDL_IOWhence whence); | ||
| 86 | size_t Android_JNI_FileRead(void *userdata, void *buffer, size_t size, SDL_IOStatus *status); | ||
| 87 | size_t Android_JNI_FileWrite(void *userdata, const void *buffer, size_t size, SDL_IOStatus *status); | ||
| 88 | bool Android_JNI_FileClose(void *userdata); | ||
| 89 | |||
| 90 | // Environment support | ||
| 91 | void Android_JNI_GetManifestEnvironmentVariables(void); | ||
| 92 | int Android_JNI_OpenFileDescriptor(const char *uri, const char *mode); | ||
| 93 | |||
| 94 | // Clipboard support | ||
| 95 | bool Android_JNI_SetClipboardText(const char *text); | ||
| 96 | char *Android_JNI_GetClipboardText(void); | ||
| 97 | bool Android_JNI_HasClipboardText(void); | ||
| 98 | |||
| 99 | // Power support | ||
| 100 | int Android_JNI_GetPowerInfo(int *plugged, int *charged, int *battery, int *seconds, int *percent); | ||
| 101 | |||
| 102 | // Joystick support | ||
| 103 | void Android_JNI_PollInputDevices(void); | ||
| 104 | |||
| 105 | // Haptic support | ||
| 106 | void Android_JNI_PollHapticDevices(void); | ||
| 107 | void Android_JNI_HapticRun(int device_id, float intensity, int length); | ||
| 108 | void Android_JNI_HapticRumble(int device_id, float low_frequency_intensity, float high_frequency_intensity, int length); | ||
| 109 | void Android_JNI_HapticStop(int device_id); | ||
| 110 | |||
| 111 | // Video | ||
| 112 | bool Android_JNI_SuspendScreenSaver(bool suspend); | ||
| 113 | |||
| 114 | // Touch support | ||
| 115 | void Android_JNI_InitTouch(void); | ||
| 116 | |||
| 117 | // Threads | ||
| 118 | #include <jni.h> | ||
| 119 | JNIEnv *Android_JNI_GetEnv(void); | ||
| 120 | bool Android_JNI_SetupThread(void); | ||
| 121 | |||
| 122 | // Locale | ||
| 123 | bool Android_JNI_GetLocale(char *buf, size_t buflen); | ||
| 124 | |||
| 125 | // Generic messages | ||
| 126 | bool Android_JNI_SendMessage(int command, int param); | ||
| 127 | |||
| 128 | // MessageBox | ||
| 129 | bool Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID); | ||
| 130 | |||
| 131 | // Cursor support | ||
| 132 | int Android_JNI_CreateCustomCursor(SDL_Surface *surface, int hot_x, int hot_y); | ||
| 133 | void Android_JNI_DestroyCustomCursor(int cursorID); | ||
| 134 | bool Android_JNI_SetCustomCursor(int cursorID); | ||
| 135 | bool Android_JNI_SetSystemCursor(int cursorID); | ||
| 136 | |||
| 137 | // Relative mouse support | ||
| 138 | bool Android_JNI_SupportsRelativeMouse(void); | ||
| 139 | bool Android_JNI_SetRelativeMouseEnabled(bool enabled); | ||
| 140 | |||
| 141 | // Show toast notification | ||
| 142 | bool Android_JNI_ShowToast(const char *message, int duration, int gravity, int xOffset, int yOffset); | ||
| 143 | |||
| 144 | bool Android_JNI_OpenURL(const char *url); | ||
| 145 | |||
| 146 | int SDL_GetAndroidSDKVersion(void); | ||
| 147 | |||
| 148 | bool SDL_IsAndroidTablet(void); | ||
| 149 | bool SDL_IsAndroidTV(void); | ||
| 150 | |||
| 151 | // File Dialogs | ||
| 152 | bool Android_JNI_OpenFileDialog(SDL_DialogFileCallback callback, void* userdata, | ||
| 153 | const SDL_DialogFileFilter *filters, int nfilters, bool forwrite, | ||
| 154 | bool multiple); | ||
| 155 | |||
| 156 | // Ends C function definitions when using C++ | ||
| 157 | #ifdef __cplusplus | ||
| 158 | /* *INDENT-OFF* */ | ||
| 159 | } | ||
| 160 | /* *INDENT-ON* */ | ||
| 161 | #endif | ||
| 162 | |||
| 163 | #endif // SDL_android_h | ||
