src/core/android/SDL_android.h
author Sam Lantinga <slouken@libsdl.org>
Thu, 15 Mar 2018 18:22:48 -0700
changeset 11931 d479188e0155
parent 11865 af91d564aa40
child 11932 a05a909eeddb
permissions -rw-r--r--
Added Android custom cursor implementation
This is commented out in SDLActivity.java, with the note #CURSORIMPLEENTATION because it requires API 24, which is higher than the minimum required SDK
     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 
    23 /* Set up for C function definitions, even when using C++ */
    24 #ifdef __cplusplus
    25 /* *INDENT-OFF* */
    26 extern "C" {
    27 /* *INDENT-ON* */
    28 #endif
    29 
    30 #include <EGL/eglplatform.h>
    31 #include <android/native_window_jni.h>
    32 
    33 #include "SDL_rect.h"
    34 
    35 /* Interface from the SDL library into the Android Java activity */
    36 extern void Android_JNI_SetActivityTitle(const char *title);
    37 extern void Android_JNI_SetWindowStyle(SDL_bool fullscreen);
    38 extern void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint);
    39 
    40 extern SDL_bool Android_JNI_GetAccelerometerValues(float values[3]);
    41 extern void Android_JNI_ShowTextInput(SDL_Rect *inputRect);
    42 extern void Android_JNI_HideTextInput(void);
    43 extern SDL_bool Android_JNI_IsScreenKeyboardShown(void);
    44 extern ANativeWindow* Android_JNI_GetNativeWindow(void);
    45 
    46 extern int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi);
    47 
    48 /* Audio support */
    49 extern int Android_JNI_OpenAudioDevice(int iscapture, int sampleRate, int is16Bit, int channelCount, int desiredBufferFrames);
    50 extern void* Android_JNI_GetAudioBuffer(void);
    51 extern void Android_JNI_WriteAudioBuffer(void);
    52 extern int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen);
    53 extern void Android_JNI_FlushCapturedAudio(void);
    54 extern void Android_JNI_CloseAudioDevice(const int iscapture);
    55 
    56 #include "SDL_rwops.h"
    57 
    58 int Android_JNI_FileOpen(SDL_RWops* ctx, const char* fileName, const char* mode);
    59 Sint64 Android_JNI_FileSize(SDL_RWops* ctx);
    60 Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence);
    61 size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, size_t size, size_t maxnum);
    62 size_t Android_JNI_FileWrite(SDL_RWops* ctx, const void* buffer, size_t size, size_t num);
    63 int Android_JNI_FileClose(SDL_RWops* ctx);
    64 
    65 /* Environment support */
    66 void Android_JNI_GetManifestEnvironmentVariables(void);
    67 
    68 /* Clipboard support */
    69 int Android_JNI_SetClipboardText(const char* text);
    70 char* Android_JNI_GetClipboardText(void);
    71 SDL_bool Android_JNI_HasClipboardText(void);
    72 
    73 /* Power support */
    74 int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seconds, int* percent);
    75 
    76 /* Joystick support */
    77 void Android_JNI_PollInputDevices(void);
    78 
    79 /* Haptic support */
    80 void Android_JNI_PollHapticDevices(void);
    81 void Android_JNI_HapticRun(int device_id, int length);
    82 
    83 /* Video */
    84 void Android_JNI_SuspendScreenSaver(SDL_bool suspend);
    85 
    86 /* Touch support */
    87 int Android_JNI_GetTouchDeviceIds(int **ids);
    88 void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value);
    89 
    90 /* Threads */
    91 #include <jni.h>
    92 JNIEnv *Android_JNI_GetEnv(void);
    93 int Android_JNI_SetupThread(void);
    94 
    95 /* Generic messages */
    96 int Android_JNI_SendMessage(int command, int param);
    97 
    98 /* Init */
    99 JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls);
   100 
   101 /* MessageBox */
   102 #include "SDL_messagebox.h"
   103 int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
   104 
   105 /* Cursor support */
   106 int Android_JNI_CreateCustomCursor(SDL_Surface *surface, int hot_x, int hot_y);
   107 void Android_JNI_SetCustomCursor(int cursorID);
   108 void Android_JNI_SetSystemCursor(int cursorID);
   109 
   110 /* Ends C function definitions when using C++ */
   111 #ifdef __cplusplus
   112 /* *INDENT-OFF* */
   113 }
   114 /* *INDENT-ON* */
   115 #endif
   116 
   117 /* vi: set ts=4 sw=4 expandtab: */