SDL  2.0
SDL_android.h
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2020 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 #include "SDL_system.h"
23 
24 /* Set up for C function definitions, even when using C++ */
25 #ifdef __cplusplus
26 /* *INDENT-OFF* */
27 extern "C" {
28 /* *INDENT-ON* */
29 #endif
30 
31 #include <EGL/eglplatform.h>
32 #include <android/native_window_jni.h>
33 
34 #include "SDL_audio.h"
35 #include "SDL_rect.h"
36 #include "SDL_video.h"
37 
38 /* Interface from the SDL library into the Android Java activity */
39 extern void Android_JNI_SetActivityTitle(const char *title);
40 extern void Android_JNI_SetWindowStyle(SDL_bool fullscreen);
41 extern void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint);
42 extern void Android_JNI_MinizeWindow(void);
44 
46 extern void Android_JNI_ShowTextInput(SDL_Rect *inputRect);
47 extern void Android_JNI_HideTextInput(void);
49 extern ANativeWindow* Android_JNI_GetNativeWindow(void);
51 
53 extern int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi);
54 
55 /* Audio support */
56 extern int Android_JNI_OpenAudioDevice(int iscapture, SDL_AudioSpec *spec);
57 extern void* Android_JNI_GetAudioBuffer(void);
58 extern void Android_JNI_WriteAudioBuffer(void);
59 extern int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen);
61 extern void Android_JNI_CloseAudioDevice(const int iscapture);
62 extern void Android_JNI_AudioSetThreadPriority(int iscapture, int device_id);
63 
64 /* Detecting device type */
67 
68 #include "SDL_rwops.h"
69 
70 int Android_JNI_FileOpen(SDL_RWops* ctx, const char* fileName, const char* mode);
73 size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, size_t size, size_t maxnum);
74 size_t Android_JNI_FileWrite(SDL_RWops* ctx, const void* buffer, size_t size, size_t num);
76 
77 /* Environment support */
79 
80 /* Clipboard support */
84 
85 /* Power support */
86 int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seconds, int* percent);
87 
88 /* Joystick support */
90 
91 /* Haptic support */
93 void Android_JNI_HapticRun(int device_id, float intensity, int length);
94 void Android_JNI_HapticStop(int device_id);
95 
96 /* Video */
98 
99 /* Touch support */
101 
102 /* Threads */
103 #include <jni.h>
104 JNIEnv *Android_JNI_GetEnv(void);
106 
107 /* Locale */
108 int Android_JNI_GetLocale(char *buf, size_t buflen);
109 
110 /* Generic messages */
111 int Android_JNI_SendMessage(int command, int param);
112 
113 /* Init */
114 JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls);
115 
116 /* MessageBox */
117 #include "SDL_messagebox.h"
118 int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
119 
120 /* Cursor support */
124 
125 /* Relative mouse support */
128 
129 /* Request permission */
130 SDL_bool Android_JNI_RequestPermission(const char *permission);
131 
132 int Android_JNI_OpenURL(const char *url);
133 
135 
140 
144 
145 /* Ends C function definitions when using C++ */
146 #ifdef __cplusplus
147 /* *INDENT-OFF* */
148 }
149 /* *INDENT-ON* */
150 #endif
151 
152 /* vi: set ts=4 sw=4 expandtab: */
SDL_bool Android_JNI_HasClipboardText(void)
SDL_bool SDL_IsAndroidTablet(void)
SDL_bool Android_JNI_SupportsRelativeMouse(void)
SDL_bool Android_JNI_SetRelativeMouseEnabled(SDL_bool enabled)
SDL_bool Android_JNI_GetAccelerometerValues(float values[3])
int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen)
void * Android_JNI_GetAudioBuffer(void)
void Android_JNI_ShowTextInput(SDL_Rect *inputRect)
void Android_JNI_FlushCapturedAudio(void)
void Android_ActivityMutex_Lock(void)
SDL_bool Android_JNI_IsScreenKeyboardShown(void)
int Android_JNI_SetupThread(void)
void Android_JNI_SetSurfaceViewFormat(int format)
size_t Android_JNI_FileRead(SDL_RWops *ctx, void *buffer, size_t size, size_t maxnum)
int Android_JNI_FileOpen(SDL_RWops *ctx, const char *fileName, const char *mode)
int Android_JNI_GetLocale(char *buf, size_t buflen)
int Android_JNI_OpenAudioDevice(int iscapture, SDL_AudioSpec *spec)
void Android_JNI_MinizeWindow(void)
int SDL_GetAndroidSDKVersion(void)
void Android_JNI_CloseAudioDevice(const int iscapture)
size_t Android_JNI_FileWrite(SDL_RWops *ctx, const void *buffer, size_t size, size_t num)
void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint)
SDL_bool Android_JNI_SetCustomCursor(int cursorID)
SDL_bool Android_IsDeXMode(void)
void Android_JNI_HapticRun(int device_id, float intensity, int length)
void Android_ActivityMutex_Unlock(void)
SDL_bool Android_JNI_SetSystemCursor(int cursorID)
int Android_JNI_GetPowerInfo(int *plugged, int *charged, int *battery, int *seconds, int *percent)
void Android_JNI_SetActivityTitle(const char *title)
void Android_JNI_SetWindowStyle(SDL_bool fullscreen)
Sint64 Android_JNI_FileSize(SDL_RWops *ctx)
JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv *mEnv, jclass cls)
ANativeWindow * Android_JNI_GetNativeWindow(void)
SDL_DisplayOrientation Android_JNI_GetDisplayOrientation(void)
SDL_bool Android_JNI_ShouldMinimizeOnFocusLoss(void)
void Android_JNI_AudioSetThreadPriority(int iscapture, int device_id)
Sint64 Android_JNI_FileSeek(SDL_RWops *ctx, Sint64 offset, int whence)
void Android_JNI_SuspendScreenSaver(SDL_bool suspend)
void Android_JNI_PollHapticDevices(void)
void Android_JNI_InitTouch(void)
void Android_ActivityMutex_Lock_Running(void)
void Android_JNI_HapticStop(int device_id)
SDL_bool SDL_IsChromebook(void)
SDL_bool SDL_IsDeXMode(void)
SDL_bool SDL_IsAndroidTV(void)
void Android_JNI_WriteAudioBuffer(void)
int Android_JNI_CreateCustomCursor(SDL_Surface *surface, int hot_x, int hot_y)
void Android_JNI_PollInputDevices(void)
SDL_bool Android_IsChromebook(void)
void Android_JNI_HideTextInput(void)
char * Android_JNI_GetClipboardText(void)
int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
JNIEnv * Android_JNI_GetEnv(void)
void Android_JNI_GetManifestEnvironmentVariables(void)
int Android_JNI_FileClose(SDL_RWops *ctx)
SDL_bool Android_JNI_RequestPermission(const char *permission)
int Android_JNI_SendMessage(int command, int param)
int Android_JNI_OpenURL(const char *url)
int Android_JNI_SetClipboardText(const char *text)
int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi)
int uint32_t uint32_t uint32_t uint32_t uint32_t int drmModeModeInfoPtr mode int uint32_t uint32_t uint32_t uint32_t int32_t hot_x
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: SDL_opengl.h:1572
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLenum mode
GLintptr offset
GLfloat param
GLuint buffer
GLenum GLsizei GLsizei GLint * values
GLsizeiptr size
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLsizei GLsizei * length
GLuint num
GLfloat GLfloat GLfloat GLfloat h
GLubyte GLubyte GLubyte GLubyte w
SDL_bool
Definition: SDL_stdinc.h:168
int64_t Sint64
Definition: SDL_stdinc.h:216
SDL_DisplayOrientation
Definition: SDL_video.h:184
EGLSurface surface
Definition: eglext.h:248
EGLContext ctx
Definition: eglext.h:208
SDL_AudioSpec spec
Definition: loopwave.c:31
MessageBox structure containing title, text, window, etc.
A rectangle, with the origin at the upper left (integer).
Definition: SDL_rect.h:78
A collection of pixels used in software blitting.
Definition: SDL_surface.h:71
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:47