Removed old video subsystem, along with (now-unncessary) egl files.
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2010 Sam Lantinga
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "SDL_config.h"
24 /* Android SDL video driver implementation
27 #include "SDL_video.h"
28 #include "SDL_mouse.h"
29 #include "../SDL_sysvideo.h"
30 #include "../SDL_pixels_c.h"
31 #include "../../events/SDL_events_c.h"
33 #include "SDL_androidvideo.h"
34 #include "SDL_androidevents.h"
35 #include "SDL_androidrender.h"
37 #define ANDROID_VID_DRIVER_NAME "Android"
39 /* Initialization/Query functions */
40 static int Android_VideoInit(_THIS);
41 static int Android_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
42 static void Android_VideoQuit(_THIS);
44 /* GL functions (SDL_androidgl.c) */
45 extern int Android_GL_LoadLibrary(_THIS, const char *path);
46 extern void *Android_GL_GetProcAddress(_THIS, const char *proc);
47 extern void Android_GL_UnloadLibrary(_THIS);
48 //extern int *Android_GL_GetVisual(_THIS, Display * display, int screen);
49 extern SDL_GLContext Android_GL_CreateContext(_THIS, SDL_Window * window);
50 extern int Android_GL_MakeCurrent(_THIS, SDL_Window * window,
51 SDL_GLContext context);
52 extern int Android_GL_SetSwapInterval(_THIS, int interval);
53 extern int Android_GL_GetSwapInterval(_THIS);
54 extern void Android_GL_SwapWindow(_THIS, SDL_Window * window);
55 extern void Android_GL_DeleteContext(_THIS, SDL_GLContext context);
57 /* Android driver bootstrap functions */
61 Android_Available(void)
67 Android_DeleteDevice(SDL_VideoDevice * device)
72 static SDL_VideoDevice *
73 Android_CreateDevice(int devindex)
75 printf("Creating video device\n");
76 SDL_VideoDevice *device;
78 /* Initialize all variables that we clean on shutdown */
79 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
88 /* Set the function pointers */
89 device->VideoInit = Android_VideoInit;
90 device->VideoQuit = Android_VideoQuit;
91 device->SetDisplayMode = Android_SetDisplayMode;
92 device->PumpEvents = Android_PumpEvents;
94 device->free = Android_DeleteDevice;
97 device->GL_LoadLibrary = Android_GL_LoadLibrary;
98 device->GL_GetProcAddress = Android_GL_GetProcAddress;
99 device->GL_UnloadLibrary = Android_GL_UnloadLibrary;
100 device->GL_CreateContext = Android_GL_CreateContext;
101 device->GL_MakeCurrent = Android_GL_MakeCurrent;
102 device->GL_SetSwapInterval = Android_GL_SetSwapInterval;
103 device->GL_GetSwapInterval = Android_GL_GetSwapInterval;
104 device->GL_SwapWindow = Android_GL_SwapWindow;
105 device->GL_DeleteContext = Android_GL_DeleteContext;
110 VideoBootStrap Android_bootstrap = {
111 ANDROID_VID_DRIVER_NAME, "SDL Android video driver",
112 Android_Available, Android_CreateDevice
117 Android_VideoInit(_THIS)
119 SDL_DisplayMode mode;
121 /* Use a fake 32-bpp desktop mode */
122 mode.format = SDL_PIXELFORMAT_RGB888;
125 mode.refresh_rate = 0;
126 mode.driverdata = NULL;
127 if (SDL_AddBasicVideoDisplay(&mode) < 0) {
130 SDL_AddRenderDriver(&_this->displays[0], &Android_RenderDriver);
133 SDL_AddDisplayMode(&_this->displays[0], &mode);
140 Android_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
146 Android_VideoQuit(_THIS)
152 /* vi: set ts=4 sw=4 expandtab: */