1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
/*
* documentation for the functions in this file can be found at:
* http://www.libsdl.org/docs/html/
*/
#include <SDL.h>
#ifdef __cplusplus
extern "C" {
#endif
static struct SDL_Surface stubSurface;
static struct SDL_RWops stubRWops;
static Uint8 stubKeyState[1];
static SDL_version stubVersion;
static Uint32 stubSubSystemsInit = 0;
extern DECLSPEC void SDLCALL SDL_free(void* p) {
return;
}
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags) {
stubSurface.w = 512;
stubSurface.h = 512;
stubSubSystemsInit = SDL_INIT_EVERYTHING;
return 0;
}
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags) {
return (stubSubSystemsInit & flags);
}
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags) {
return 0;
}
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags) {
}
extern DECLSPEC const char* SDLCALL SDL_GetError() {
return "using the SDL stub library";
}
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value) {
return 0;
}
extern DECLSPEC SDL_Window* SDLCALL SDL_CreateWindow(const char* title, int x, int y, int w, int h, Uint32 flags) {
static int foo;
return (SDL_Window*)(&foo);
}
extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window) {}
extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window) {}
extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window) {}
extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window) {}
extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext context){
return 0;
}
extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window) {
return "";
}
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window* window) { return 0; }
extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format) { return ""; }
extern DECLSPEC struct SDL_RWops* SDLCALL SDL_RWFromFile(const char* file, const char* mode) {
return &stubRWops;
}
extern DECLSPEC SDL_Surface* SDLCALL SDL_LoadBMP_RW(SDL_RWops* src, int freesrc) {
return &stubSurface;
}
extern DECLSPEC void SDLCALL SDL_Quit() {
}
extern DECLSPEC SDL_Surface* SDLCALL SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) {
return NULL;
}
extern DECLSPEC SDL_Surface* SDLCALL SDL_CreateRGBSurfaceFrom(void* pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) {
return NULL;
}
extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface* surface) {
}
extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window* window) {
}
extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled) { return SDL_FALSE; }
extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window* window, int x, int y) {
}
extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow() {
return 0;
}
extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window* window) {
}
extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window* window, Uint32 flags) {
return 0;
}
extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window* window, SDL_bool bordered) {
}
extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int i, int j) {
return 0;
}
extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate) {
}
extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event* event) { return 0; }
extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event* event) { return 0; }
extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type) {}
extern DECLSPEC void SDLCALL SDL_PumpEvents() {}
extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window* window, const char* title) {
}
extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window* window, SDL_Surface* icon) {
}
extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window* window, int min_w, int min_h) {
}
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value) {
*value = 0;
return 0;
}
extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window* window) {
static int foo;
return &foo;
}
extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context) {
}
extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window* window, SDL_bool grabbed) {
}
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window* window) {
return 0;
}
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window* window) {
return 0;
}
extern DECLSPEC void SDLCALL SDL_EnableScreenSaver() {}
extern DECLSPEC void SDLCALL SDL_DisableScreenSaver() {}
extern DECLSPEC char* SDLCALL SDL_GetClipboardText() {
return "";
}
extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char* text) {
return -1;
}
extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int* numkeys) {
*numkeys = 0;
return stubKeyState;
}
extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState() {
return 0;
}
extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode) {
return 0;
}
extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key) {
return 0;
}
extern DECLSPEC const SDL_version* SDLCALL SDL_Linked_Version() {
return &stubVersion;
}
extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version* ver) {
*ver = stubVersion;
}
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle) {
return 0;
}
extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int* x, int* y) {
return 0;
}
extern DECLSPEC int SDLCALL SDL_NumJoysticks() {
return 0;
}
extern DECLSPEC const char* SDLCALL SDL_JoystickName(SDL_Joystick* device_index) {
return "";
}
extern DECLSPEC SDL_Joystick* SDLCALL SDL_JoystickOpen(int device_index) {
return 0;
}
extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick* joystick) {
}
extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex) {
return 0;
}
extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode* mode) {
mode->format = SDL_PIXELFORMAT_RGB24;
mode->w = 640;
mode->h = 480;
mode->refresh_rate = 100;
mode->driverdata = NULL;
return 0;
}
extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode* mode) {
return SDL_GetDesktopDisplayMode(0, mode);
}
extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window* window, SDL_DisplayMode* mode) {
return SDL_GetDesktopDisplayMode(0, mode);
}
extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex, SDL_DisplayMode* mode) {
return SDL_GetDesktopDisplayMode(0, mode);
}
extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event* events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType) {
return 0;
}
extern DECLSPEC Uint8 SDLCALL SDL_GetAppState() {
return 0;
}
extern DECLSPEC int SDL_GetNumVideoDisplays(void) {
return 0;
}
extern DECLSPEC int SDL_GetDisplayBounds(int displayIndex, SDL_Rect* rect) {
if (rect == 0) return -1;
rect->w = 640;
rect->h = 480;
rect->x = 0;
rect->y = 0;
return 0;
}
extern DECLSPEC int SDL_GL_GetSwapInterval() {
return 0;
}
extern DECLSPEC void SDL_SetWindowPosition(SDL_Window * window, int x, int y) {
}
extern DECLSPEC void SDL_SetWindowSize(SDL_Window * window, int w, int h) {
}
extern DECLSPEC SDL_PowerState SDL_GetPowerInfo(int *secs, int *pct) {
return SDL_POWERSTATE_UNKNOWN;
}
extern DECLSPEC SDL_bool SDL_SetHint(const char* name, const char* value) {
return SDL_TRUE;
}
extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect) {
}
extern DECLSPEC void SDLCALL SDL_StartTextInput(void) {
}
extern DECLSPEC void SDLCALL SDL_StopTextInput(void) {
}
#ifdef __cplusplus
} // extern "C"
#endif
|