21#include "../../SDL_internal.h"
23#if SDL_VIDEO_DRIVER_ANDROID
30#include "../SDL_sysvideo.h"
31#include "../SDL_pixels_c.h"
32#include "../../events/SDL_events_c.h"
33#include "../../events/SDL_windowevents_c.h"
45#define ANDROID_VID_DRIVER_NAME "Android"
48static int Android_VideoInit(
_THIS);
49static void Android_VideoQuit(
_THIS);
52#include "../SDL_egl_c.h"
53#define Android_GLES_GetProcAddress SDL_EGL_GetProcAddress
54#define Android_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
55#define Android_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
56#define Android_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
57#define Android_GLES_DeleteContext SDL_EGL_DeleteContext
65static int Android_DeviceWidth = 0;
66static int Android_DeviceHeight = 0;
68static int Android_ScreenRate = 0;
74Android_Available(
void)
80Android_SuspendScreenSaver(
_THIS)
93Android_CreateDevice(
int devindex)
116 device->VideoInit = Android_VideoInit;
117 device->VideoQuit = Android_VideoQuit;
119 if (block_on_pause) {
125 device->GetDisplayDPI = Android_GetDisplayDPI;
134 device->free = Android_DeleteDevice;
138 device->GL_GetProcAddress = Android_GLES_GetProcAddress;
139 device->GL_UnloadLibrary = Android_GLES_UnloadLibrary;
142 device->GL_SetSwapInterval = Android_GLES_SetSwapInterval;
143 device->GL_GetSwapInterval = Android_GLES_GetSwapInterval;
145 device->GL_DeleteContext = Android_GLES_DeleteContext;
148 device->Vulkan_LoadLibrary = Android_Vulkan_LoadLibrary;
149 device->Vulkan_UnloadLibrary = Android_Vulkan_UnloadLibrary;
150 device->Vulkan_GetInstanceExtensions = Android_Vulkan_GetInstanceExtensions;
151 device->Vulkan_CreateSurface = Android_Vulkan_CreateSurface;
155 device->SuspendScreenSaver = Android_SuspendScreenSaver;
175 ANDROID_VID_DRIVER_NAME,
"SDL Android video driver",
176 Android_Available, Android_CreateDevice
181Android_VideoInit(
_THIS)
191 mode.format = Android_ScreenFormat;
192 mode.w = Android_DeviceWidth;
193 mode.h = Android_DeviceHeight;
194 mode.refresh_rate = Android_ScreenRate;
198 if (display_index < 0) {
217Android_VideoQuit(
_THIS)
234 Android_DeviceWidth = deviceWidth;
235 Android_DeviceHeight = deviceHeight;
236 Android_ScreenFormat =
format;
237 Android_ScreenRate = (int)rate;
SDL_DisplayOrientation Android_JNI_GetDisplayOrientation(void)
void Android_JNI_SuspendScreenSaver(SDL_bool suspend)
int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi)
SDL_bool Android_HasClipboardText(_THIS)
int Android_SetClipboardText(_THIS, const char *text)
char * Android_GetClipboardText(_THIS)
void Android_PumpEvents_NonBlocking(_THIS)
void Android_PumpEvents_Blocking(_THIS)
SDL_GLContext Android_GLES_CreateContext(_THIS, SDL_Window *window)
int Android_GLES_SwapWindow(_THIS, SDL_Window *window)
int Android_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
int Android_GLES_LoadLibrary(_THIS, const char *path)
SDL_bool Android_HasScreenKeyboardSupport(_THIS)
SDL_bool Android_IsScreenKeyboardShown(_THIS, SDL_Window *window)
void Android_StopTextInput(_THIS)
void Android_StartTextInput(_THIS)
void Android_InitKeyboard(void)
void Android_SetTextInputRect(_THIS, SDL_Rect *rect)
void Android_QuitMouse(void)
void Android_InitMouse(void)
void Android_QuitTouch(void)
void Android_InitTouch(void)
SDL_sem * Android_ResumeSem
int Android_SurfaceHeight
void Android_SendResize(SDL_Window *window)
SDL_mutex * Android_ActivityMutex
SDL_sem * Android_PauseSem
void Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, Uint32 format, float rate)
SDL_bool Android_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
void Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
void Android_SetWindowTitle(_THIS, SDL_Window *window)
int Android_CreateWindow(_THIS, SDL_Window *window)
void Android_MinimizeWindow(_THIS, SDL_Window *window)
void Android_DestroyWindow(_THIS, SDL_Window *window)
#define SDL_GetHintBoolean
#define SDL_OutOfMemory()
#define SDL_HINT_ANDROID_BLOCK_ON_PAUSE
A variable to control whether the event loop will block itself when the app is paused.
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
@ SDL_PIXELFORMAT_UNKNOWN
VideoBootStrap Android_bootstrap
int SDL_AddBasicVideoDisplay(const SDL_DisplayMode *desktop_mode)
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
SDL_VideoDisplay * SDL_GetDisplay(int displayIndex)
SDL_VideoDevice * SDL_GetVideoDevice(void)
SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
static SDL_VideoDevice * _this
@ SDL_WINDOWEVENT_RESIZED
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
EGLSurface EGLNativeWindowType * window
static SDL_AudioDeviceID device
The structure that defines a display mode.
SDL_bool suspend_screensaver
SDL_VideoDisplay * displays
SDL_DisplayMode desktop_mode
SDL_DisplayMode * display_modes
SDL_DisplayMode current_mode
The type used to identify a window.