diff options
author | Aleksander Guryanov <caiiiycuk@gmail.com> | 2012-05-29 22:29:40 +0700 |
---|---|---|
committer | Aleksander Guryanov <caiiiycuk@gmail.com> | 2012-05-29 22:29:40 +0700 |
commit | d885fca368c09f9ee59012d39d010558b849d5b3 (patch) | |
tree | 510f7d9ec7afb7eb372d51bf6e868fd2451aa9e0 /src/library_sdl.js | |
parent | 0b222be053ad17a677938c3156c47842b7389a6d (diff) |
Add missing sdl functions (SDL_VideoModeOK SDL_VideoDriverName SDL_QuitSubSystem)
Diffstat (limited to 'src/library_sdl.js')
-rw-r--r-- | src/library_sdl.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index 85a04d27..ac6e7d5f 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -475,6 +475,37 @@ var LibrarySDL = { return -1; // -1 == all modes are ok. TODO }, + SDL_VideoModeOK: function(width, height, depth, flags) { + // SDL_VideoModeOK returns 0 if the requested mode is not supported under any bit depth, or returns the + // bits-per-pixel of the closest available mode with the given width, height and requested surface flags + return depth; // all modes are ok. + }, + + SDL_VideoDriverName: function(buf, max_size) { + if (SDL.startTime === null) { + return 0; //return NULL + } + //driverName - emscripten_sdl_driver + var driverName = [101, 109, 115, 99, 114, 105, 112, 116, 101, + 110, 95, 115, 100, 108, 95, 100, 114, 105, 118, 101, 114]; + + var index = 0; + var size = driverName.length; + + if (max_size <= size) { + size = max_size - 1; //-1 cause null-terminator + } + + while (index < size) { + var value = driverName[index]; + {{{ makeSetValue('buf', 'index', 'value', 'i8') }}}; + index++; + } + + {{{ makeSetValue('buf', 'index', '0', 'i8') }}}; + return buf; + }, + SDL_SetVideoMode: function(width, height, depth, flags) { ['mousedown', 'mouseup', 'mousemove', 'DOMMouseScroll'].forEach(function(event) { Module['canvas'].addEventListener(event, SDL.receiveEvent, true); @@ -484,6 +515,10 @@ var LibrarySDL = { return SDL.screen = SDL.makeSurface(width, height, flags, true, 'screen'); }, + SDL_QuitSubSystem: function(flags) { + Module.print('SDL_QuitSubSystem called (and ignored)'); + }, + SDL_Quit: function() { for (var i = 0; i < SDL.audios; i++) { SDL.audios[i].pause(); |