comparison src/video/android/SDL_androidvideo.c @ 4998:a514bfe6952a

The window is changed to reflect the actual screen dimensions, for now. Implemented SDL_SetWindowTitle(), which turned out to be fairly complex
author Sam Lantinga <slouken@libsdl.org>
date Thu, 13 Jan 2011 15:10:17 -0800
parents 55b82067815b
children 77df56570442
comparison
equal deleted inserted replaced
4997:a21501393bef 4998:a514bfe6952a
31 #include "../../events/SDL_events_c.h" 31 #include "../../events/SDL_events_c.h"
32 32
33 #include "SDL_androidvideo.h" 33 #include "SDL_androidvideo.h"
34 #include "SDL_androidevents.h" 34 #include "SDL_androidevents.h"
35 #include "SDL_androidkeyboard.h" 35 #include "SDL_androidkeyboard.h"
36 #include "SDL_androidwindow.h"
36 37
37 #define ANDROID_VID_DRIVER_NAME "Android" 38 #define ANDROID_VID_DRIVER_NAME "Android"
38 39
39 /* Initialization/Query functions */ 40 /* Initialization/Query functions */
40 static int Android_VideoInit(_THIS); 41 static int Android_VideoInit(_THIS);
56 /* Android driver bootstrap functions */ 57 /* Android driver bootstrap functions */
57 58
58 59
59 // These are filled in with real values in Android_SetScreenResolution on 60 // These are filled in with real values in Android_SetScreenResolution on
60 // init (before SDL_main()) 61 // init (before SDL_main())
61 static Uint32 iScreenFormat = SDL_PIXELFORMAT_UNKNOWN; 62 int Android_ScreenWidth = 0;
62 static int iScreenWidth = 0; 63 int Android_ScreenHeight = 0;
63 static int iScreenHeight = 0; 64 Uint32 Android_ScreenFormat = SDL_PIXELFORMAT_UNKNOWN;
64 65
65 66
66 static int 67 static int
67 Android_Available(void) 68 Android_Available(void)
68 { 69 {
94 /* Set the function pointers */ 95 /* Set the function pointers */
95 device->VideoInit = Android_VideoInit; 96 device->VideoInit = Android_VideoInit;
96 device->VideoQuit = Android_VideoQuit; 97 device->VideoQuit = Android_VideoQuit;
97 device->PumpEvents = Android_PumpEvents; 98 device->PumpEvents = Android_PumpEvents;
98 99
100 device->CreateWindow = Android_CreateWindow;
101 device->SetWindowTitle = Android_SetWindowTitle;
102 device->DestroyWindow = Android_DestroyWindow;
103
99 device->free = Android_DeleteDevice; 104 device->free = Android_DeleteDevice;
100 105
101 /* GL pointers */ 106 /* GL pointers */
102 device->GL_LoadLibrary = Android_GL_LoadLibrary; 107 device->GL_LoadLibrary = Android_GL_LoadLibrary;
103 device->GL_GetProcAddress = Android_GL_GetProcAddress; 108 device->GL_GetProcAddress = Android_GL_GetProcAddress;
121 int 126 int
122 Android_VideoInit(_THIS) 127 Android_VideoInit(_THIS)
123 { 128 {
124 SDL_DisplayMode mode; 129 SDL_DisplayMode mode;
125 130
126 mode.format = iScreenFormat; 131 mode.format = Android_ScreenFormat;
127 mode.w = iScreenWidth; 132 mode.w = Android_ScreenWidth;
128 mode.h = iScreenHeight; 133 mode.h = Android_ScreenHeight;
129 mode.refresh_rate = 0; 134 mode.refresh_rate = 0;
130 mode.driverdata = NULL; 135 mode.driverdata = NULL;
131 if (SDL_AddBasicVideoDisplay(&mode) < 0) { 136 if (SDL_AddBasicVideoDisplay(&mode) < 0) {
132 return -1; 137 return -1;
133 } 138 }
144 void 149 void
145 Android_VideoQuit(_THIS) 150 Android_VideoQuit(_THIS)
146 { 151 {
147 } 152 }
148 153
154 /* This function gets called before VideoInit() */
149 void 155 void
150 Android_SetScreenResolution(int width, int height, Uint32 format) 156 Android_SetScreenResolution(int width, int height, Uint32 format)
151 { 157 {
152 iScreenWidth = width; 158 Android_ScreenWidth = width;
153 iScreenHeight = height; 159 Android_ScreenHeight = height;
154 iScreenFormat = format; 160 Android_ScreenFormat = format;
155 } 161 }
156 162
157 /* vi: set ts=4 sw=4 expandtab: */ 163 /* vi: set ts=4 sw=4 expandtab: */