src/core/android/SDL_android.h
author Sam Lantinga <slouken@libsdl.org>
Fri, 28 Sep 2018 20:39:57 -0700
changeset 12255 d2e5d4520677
parent 12242 df7260f149f2
child 12313 8451760ff7b3
permissions -rw-r--r--
Ensure we wait on the surface resize before returning from setting fullscreen mode.
     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_rect.h"
    35 
    36 /* Interface from the SDL library into the Android Java activity */
    37 extern void Android_JNI_SetActivityTitle(const char *title);
    38 extern void Android_JNI_SetWindowStyle(SDL_bool fullscreen);
    39 extern void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint);
    40 
    41 extern SDL_bool Android_JNI_GetAccelerometerValues(float values[3]);
    42 extern void Android_JNI_ShowTextInput(SDL_Rect *inputRect);
    43 extern void Android_JNI_HideTextInput(void);
    44 extern SDL_bool Android_JNI_IsScreenKeyboardShown(void);
    45 extern ANativeWindow* Android_JNI_GetNativeWindow(void);
    46 
    47 extern int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi);
    48 
    49 /* Audio support */
    50 extern int Android_JNI_OpenAudioDevice(int iscapture, int sampleRate, int is16Bit, int channelCount, int desiredBufferFrames);
    51 extern void* Android_JNI_GetAudioBuffer(void);
    52 extern void Android_JNI_WriteAudioBuffer(void);
    53 extern int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen);
    54 extern void Android_JNI_FlushCapturedAudio(void);
    55 extern void Android_JNI_CloseAudioDevice(const int iscapture);
    56 
    57 /* Detecting device type */
    58 extern SDL_bool Android_IsDeXMode();
    59 extern SDL_bool Android_IsChromebook();
    60 
    61 #include "SDL_rwops.h"
    62 
    63 int Android_JNI_FileOpen(SDL_RWops* ctx, const char* fileName, const char* mode);
    64 Sint64 Android_JNI_FileSize(SDL_RWops* ctx);
    65 Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence);
    66 size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, size_t size, size_t maxnum);
    67 size_t Android_JNI_FileWrite(SDL_RWops* ctx, const void* buffer, size_t size, size_t num);
    68 int Android_JNI_FileClose(SDL_RWops* ctx);
    69 
    70 /* Environment support */
    71 void Android_JNI_GetManifestEnvironmentVariables(void);
    72 
    73 /* Clipboard support */
    74 int Android_JNI_SetClipboardText(const char* text);
    75 char* Android_JNI_GetClipboardText(void);
    76 SDL_bool Android_JNI_HasClipboardText(void);
    77 
    78 /* Power support */
    79 int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seconds, int* percent);
    80 
    81 /* Joystick support */
    82 void Android_JNI_PollInputDevices(void);
    83 
    84 /* Haptic support */
    85 void Android_JNI_PollHapticDevices(void);
    86 void Android_JNI_HapticRun(int device_id, int length);
    87 void Android_JNI_HapticStop(int device_id);
    88 
    89 /* Video */
    90 void Android_JNI_SuspendScreenSaver(SDL_bool suspend);
    91 
    92 /* Touch support */
    93 int Android_JNI_InitTouch(void);
    94 void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value);
    95 int Android_JNI_GetTouchDeviceIds(int **ids);
    96 
    97 /* Threads */
    98 #include <jni.h>
    99 JNIEnv *Android_JNI_GetEnv(void);
   100 int Android_JNI_SetupThread(void);
   101 
   102 /* Generic messages */
   103 int Android_JNI_SendMessage(int command, int param);
   104 
   105 /* Init */
   106 JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls);
   107 
   108 /* MessageBox */
   109 #include "SDL_messagebox.h"
   110 int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
   111 
   112 /* Cursor support */
   113 int Android_JNI_CreateCustomCursor(SDL_Surface *surface, int hot_x, int hot_y);
   114 SDL_bool Android_JNI_SetCustomCursor(int cursorID);
   115 SDL_bool Android_JNI_SetSystemCursor(int cursorID);
   116 
   117 /* Relative mouse support */
   118 SDL_bool Android_JNI_SupportsRelativeMouse(void);
   119 SDL_bool Android_JNI_SetRelativeMouseEnabled(SDL_bool enabled);
   120 
   121 
   122 SDL_bool SDL_IsAndroidTablet(void);
   123 SDL_bool SDL_IsAndroidTV(void);
   124 SDL_bool SDL_IsChromebook(void);
   125 SDL_bool SDL_IsDeXMode(void);
   126 
   127 /* Ends C function definitions when using C++ */
   128 #ifdef __cplusplus
   129 /* *INDENT-OFF* */
   130 }
   131 /* *INDENT-ON* */
   132 #endif
   133 
   134 /* vi: set ts=4 sw=4 expandtab: */