| | |
| | | static int Emscripten_VideoInit(_THIS); |
| | | static int Emscripten_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); |
| | | static void Emscripten_VideoQuit(_THIS); |
| | | static int Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); |
| | | |
| | | static int Emscripten_CreateWindow(_THIS, SDL_Window * window); |
| | | static void Emscripten_SetWindowSize(_THIS, SDL_Window * window); |
| | |
| | | |
| | | |
| | | /* Emscripten driver bootstrap functions */ |
| | | |
| | | static int |
| | | Emscripten_Available(void) |
| | | { |
| | | return (1); |
| | | } |
| | | |
| | | static void |
| | | Emscripten_DeleteDevice(SDL_VideoDevice * device) |
| | |
| | | /* Set the function pointers */ |
| | | device->VideoInit = Emscripten_VideoInit; |
| | | device->VideoQuit = Emscripten_VideoQuit; |
| | | device->GetDisplayUsableBounds = Emscripten_GetDisplayUsableBounds; |
| | | device->SetDisplayMode = Emscripten_SetDisplayMode; |
| | | |
| | | |
| | |
| | | |
| | | VideoBootStrap Emscripten_bootstrap = { |
| | | EMSCRIPTENVID_DRIVER_NAME, "SDL emscripten video driver", |
| | | Emscripten_Available, Emscripten_CreateDevice |
| | | Emscripten_CreateDevice |
| | | }; |
| | | |
| | | |
| | |
| | | Emscripten_VideoQuit(_THIS) |
| | | { |
| | | Emscripten_FiniMouse(); |
| | | } |
| | | |
| | | static int |
| | | Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) |
| | | { |
| | | if (rect) { |
| | | rect->x = 0; |
| | | rect->y = 0; |
| | | rect->w = EM_ASM_INT_V({ |
| | | return window.innerWidth; |
| | | }); |
| | | rect->h = EM_ASM_INT_V({ |
| | | return window.innerHeight; |
| | | }); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | static void |
| | |
| | | static void |
| | | Emscripten_SetWindowTitle(_THIS, SDL_Window * window) { |
| | | EM_ASM_INT({ |
| | | if (typeof Module['setWindowTitle'] !== 'undefined') { |
| | | Module['setWindowTitle'](UTF8ToString($0)); |
| | | if (typeof setWindowTitle !== 'undefined') { |
| | | setWindowTitle(UTF8ToString($0)); |
| | | } |
| | | return 0; |
| | | }, window->title); |