SDL  2.0
SDL_android.h
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2018 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 
37 /* Interface from the SDL library into the Android Java activity */
38 extern void Android_JNI_SetActivityTitle(const char *title);
39 extern void Android_JNI_SetWindowStyle(SDL_bool fullscreen);
40 extern void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint);
41 
43 extern void Android_JNI_ShowTextInput(SDL_Rect *inputRect);
44 extern void Android_JNI_HideTextInput(void);
46 extern ANativeWindow* Android_JNI_GetNativeWindow(void);
47 
48 extern int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi);
49 
50 /* Audio support */
51 extern int Android_JNI_OpenAudioDevice(int iscapture, SDL_AudioSpec *spec);
52 extern void* Android_JNI_GetAudioBuffer(void);
53 extern void Android_JNI_WriteAudioBuffer(void);
54 extern int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen);
56 extern void Android_JNI_CloseAudioDevice(const int iscapture);
57 
58 /* Detecting device type */
61 
62 #include "SDL_rwops.h"
63 
64 int Android_JNI_FileOpen(SDL_RWops* ctx, const char* fileName, const char* mode);
67 size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, size_t size, size_t maxnum);
68 size_t Android_JNI_FileWrite(SDL_RWops* ctx, const void* buffer, size_t size, size_t num);
70 
71 /* Environment support */
73 
74 /* Clipboard support */
78 
79 /* Power support */
80 int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seconds, int* percent);
81 
82 /* Joystick support */
84 
85 /* Haptic support */
87 void Android_JNI_HapticRun(int device_id, float intensity, int length);
88 void Android_JNI_HapticStop(int device_id);
89 
90 /* Video */
92 
93 /* Touch support */
97 
98 /* Threads */
99 #include <jni.h>
100 JNIEnv *Android_JNI_GetEnv(void);
102 
103 /* Generic messages */
104 int Android_JNI_SendMessage(int command, int param);
105 
106 /* Init */
107 JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls);
108 
109 /* MessageBox */
110 #include "SDL_messagebox.h"
111 int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
112 
113 /* Cursor support */
117 
118 /* Relative mouse support */
121 
122 
127 
128 /* Ends C function definitions when using C++ */
129 #ifdef __cplusplus
130 /* *INDENT-OFF* */
131 }
132 /* *INDENT-ON* */
133 #endif
134 
135 /* vi: set ts=4 sw=4 expandtab: */
Android_JNI_SetOrientation
void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint)
Android_JNI_InitTouch
int Android_JNI_InitTouch(void)
Android_JNI_GetManifestEnvironmentVariables
void Android_JNI_GetManifestEnvironmentVariables(void)
Android_IsDeXMode
SDL_bool Android_IsDeXMode()
Android_JNI_HapticRun
void Android_JNI_HapticRun(int device_id, float intensity, int length)
Android_JNI_SetActivityTitle
void Android_JNI_SetActivityTitle(const char *title)
offset
GLintptr offset
Definition: SDL_opengl_glext.h:538
Android_JNI_SetupThread
int Android_JNI_SetupThread(void)
SDL_Surface
A collection of pixels used in software blitting.
Definition: SDL_surface.h:70
Android_JNI_SetWindowStyle
void Android_JNI_SetWindowStyle(SDL_bool fullscreen)
Android_JNI_GetClipboardText
char * Android_JNI_GetClipboardText(void)
SDL_rect.h
Android_JNI_SetSeparateMouseAndTouch
void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value)
Android_JNI_GetAccelerometerValues
SDL_bool Android_JNI_GetAccelerometerValues(float values[3])
surface
EGLSurface surface
Definition: eglext.h:248
mode
GLenum mode
Definition: SDL_opengl_glext.h:1122
SDL_IsAndroidTablet
SDL_bool SDL_IsAndroidTablet(void)
eglplatform.h
Android_JNI_FileSeek
Sint64 Android_JNI_FileSeek(SDL_RWops *ctx, Sint64 offset, int whence)
SDL_messagebox.h
Android_JNI_GetTouchDeviceIds
int Android_JNI_GetTouchDeviceIds(int **ids)
SDL_AudioSpec
Definition: SDL_audio.h:179
num
GLuint num
Definition: SDL_opengl_glext.h:4956
Android_JNI_CreateCustomCursor
int Android_JNI_CreateCustomCursor(SDL_Surface *surface, int hot_x, int hot_y)
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1946
length
GLuint GLsizei GLsizei * length
Definition: SDL_opengl_glext.h:669
Android_JNI_SetRelativeMouseEnabled
SDL_bool Android_JNI_SetRelativeMouseEnabled(SDL_bool enabled)
ctx
EGLContext ctx
Definition: eglext.h:208
Android_JNI_GetPowerInfo
int Android_JNI_GetPowerInfo(int *plugged, int *charged, int *battery, int *seconds, int *percent)
Android_JNI_ShowMessageBox
int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
values
GLenum GLsizei GLsizei GLint * values
Definition: SDL_opengl_glext.h:1486
buffer
GLuint buffer
Definition: SDL_opengl_glext.h:533
Android_JNI_GetAudioBuffer
void * Android_JNI_GetAudioBuffer(void)
SDL_audio.h
Android_IsChromebook
SDL_bool Android_IsChromebook()
SDL_IsAndroidTV
SDL_bool SDL_IsAndroidTV(void)
Android_JNI_FlushCapturedAudio
void Android_JNI_FlushCapturedAudio(void)
SDL_MessageBoxData
MessageBox structure containing title, text, window, etc.
Definition: SDL_messagebox.h:93
SDL_Android_Init
JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv *mEnv, jclass cls)
SDL_IsChromebook
SDL_bool SDL_IsChromebook(void)
Android_JNI_FileRead
size_t Android_JNI_FileRead(SDL_RWops *ctx, void *buffer, size_t size, size_t maxnum)
Android_JNI_GetEnv
JNIEnv * Android_JNI_GetEnv(void)
text
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:47
Android_JNI_FileSize
Sint64 Android_JNI_FileSize(SDL_RWops *ctx)
Android_JNI_FileOpen
int Android_JNI_FileOpen(SDL_RWops *ctx, const char *fileName, const char *mode)
param
GLfloat param
Definition: SDL_opengl_glext.h:370
Android_JNI_SupportsRelativeMouse
SDL_bool Android_JNI_SupportsRelativeMouse(void)
Android_JNI_SetCustomCursor
SDL_bool Android_JNI_SetCustomCursor(int cursorID)
Android_JNI_OpenAudioDevice
int Android_JNI_OpenAudioDevice(int iscapture, SDL_AudioSpec *spec)
Android_JNI_SetSystemCursor
SDL_bool Android_JNI_SetSystemCursor(int cursorID)
hot_x
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
Definition: SDL_kmsdrmsym.h:57
Android_JNI_FileClose
int Android_JNI_FileClose(SDL_RWops *ctx)
size
GLsizeiptr size
Definition: SDL_opengl_glext.h:537
spec
SDL_AudioSpec spec
Definition: loopwave.c:31
Android_JNI_PollHapticDevices
void Android_JNI_PollHapticDevices(void)
Android_JNI_SendMessage
int Android_JNI_SendMessage(int command, int param)
Android_JNI_ShowTextInput
void Android_JNI_ShowTextInput(SDL_Rect *inputRect)
SDL_IsDeXMode
SDL_bool SDL_IsDeXMode(void)
Sint64
int64_t Sint64
Definition: SDL_stdinc.h:210
Android_JNI_SuspendScreenSaver
void Android_JNI_SuspendScreenSaver(SDL_bool suspend)
Android_JNI_CloseAudioDevice
void Android_JNI_CloseAudioDevice(const int iscapture)
Android_JNI_HasClipboardText
SDL_bool Android_JNI_HasClipboardText(void)
Android_JNI_PollInputDevices
void Android_JNI_PollInputDevices(void)
Android_JNI_GetNativeWindow
ANativeWindow * Android_JNI_GetNativeWindow(void)
SDL_Rect
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:65
SDL_system.h
Android_JNI_HideTextInput
void Android_JNI_HideTextInput(void)
Android_JNI_WriteAudioBuffer
void Android_JNI_WriteAudioBuffer(void)
Android_JNI_FileWrite
size_t Android_JNI_FileWrite(SDL_RWops *ctx, const void *buffer, size_t size, size_t num)
Android_JNI_HapticStop
void Android_JNI_HapticStop(int device_id)
enabled
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: SDL_opengl_glext.h:2479
Android_JNI_SetClipboardText
int Android_JNI_SetClipboardText(const char *text)
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:162
SDL_RWops
Definition: SDL_rwops.h:53
Android_JNI_CaptureAudioBuffer
int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen)
Android_JNI_IsScreenKeyboardShown
SDL_bool Android_JNI_IsScreenKeyboardShown(void)
ids
GLuint * ids
Definition: SDL_opengl_glext.h:525
Android_JNI_GetDisplayDPI
int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi)
SDL_rwops.h
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:731