diff options
Diffstat (limited to 'src/library_sdl.js')
-rw-r--r-- | src/library_sdl.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index 9231f41b..7c0593b2 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -883,6 +883,14 @@ var LibrarySDL = { surfData.locked++; if (surfData.locked > 1) return 0; + // Mark in C/C++-accessible SDL structure + // SDL_Surface has the following fields: Uint32 flags, SDL_PixelFormat *format; int w, h; Uint16 pitch; void *pixels; ... + // So we have fields all of the same size, and 5 of them before us. + // TODO: Use macros like in library.js + {{{ makeSetValue('surf', '5*Runtime.QUANTUM_SIZE', 'surfData.buffer', 'void*') }}}; + + if (surf == SDL.screen && Module.screenIsReadOnly && surfData.image) return 0; + surfData.image = surfData.ctx.getImageData(0, 0, surfData.width, surfData.height); if (surf == SDL.screen) { var data = surfData.image.data; @@ -925,12 +933,6 @@ var LibrarySDL = { } } - // Mark in C/C++-accessible SDL structure - // SDL_Surface has the following fields: Uint32 flags, SDL_PixelFormat *format; int w, h; Uint16 pitch; void *pixels; ... - // So we have fields all of the same size, and 5 of them before us. - // TODO: Use macros like in library.js - {{{ makeSetValue('surf', '5*Runtime.QUANTUM_SIZE', 'surfData.buffer', 'void*') }}}; - return 0; }, @@ -1271,6 +1273,11 @@ var LibrarySDL = { return 1; }, + SDL_SetPalette__deps: ['SDL_SetColors'], + SDL_SetPalette: function(surf, flags, colors, firstColor, nColors) { + return _SDL_SetColors(surf, colors, firstColor, nColors); + }, + SDL_MapRGB: function(fmt, r, g, b) { // Canvas screens are always RGBA. We assume the machine is little-endian. return r&0xff|(g&0xff)<<8|(b&0xff)<<16|0xff000000; @@ -2276,7 +2283,7 @@ var LibrarySDL = { SDL_CondWaitTimeout: function() { throw 'SDL_CondWaitTimeout: TODO' }, SDL_WM_IconifyWindow: function() { throw 'SDL_WM_IconifyWindow TODO' }, - Mix_SetPostMix: function() { throw 'Mix_SetPostMix: TODO' }, + Mix_SetPostMix: function() { Runtime.warnOnce('Mix_SetPostMix: TODO') }, Mix_QuerySpec: function() { throw 'Mix_QuerySpec: TODO' }, Mix_FadeInChannelTimed: function() { throw 'Mix_FadeInChannelTimed' }, Mix_FadeOutChannel: function() { throw 'Mix_FadeOutChannel' }, |