diff options
author | Alon Zakai <azakai@mozilla.com> | 2010-11-15 20:27:09 -0800 |
---|---|---|
committer | Alon Zakai <azakai@mozilla.com> | 2010-11-15 20:27:09 -0800 |
commit | 37e5988aae61bfb0806003bb98a6830518fd42b8 (patch) | |
tree | e3d9dcd7cb7f40375d5ba43dbc37e5f9809ae659 | |
parent | 31e499464ec66b4806ef0777579b3d91049dd320 (diff) |
addition SDL stubs
-rw-r--r-- | src/library_sdl.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index b0fa46d3..9c21871a 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -1,9 +1,32 @@ mergeInto(Library, { SDL_Init: function(what) { + SDL_INFO = { + width: 320, + height: 240, + }; SDL_SURFACES = {}; return 1; }, + SDL_GetVideoInfo: function() { + // %struct.SDL_VideoInfo = type { i32, i32, %struct.SDL_PixelFormat*, i32, i32 } - 5 fields of quantum size + var ret = _malloc(5*QUANTUM_SIZE); + IHEAP[ret] = 0; // TODO + IHEAP[ret+QUANTUM_SIZE] = 0; // TODO + IHEAP[ret+QUANTUM_SIZE*2] = 0; // TODO + IHEAP[ret+QUANTUM_SIZE*3] = SDL_INFO.width; + IHEAP[ret+QUANTUM_SIZE*4] = SDL_INFO.height; + return ret; + }, + + SDL_ListModes: function(format, flags) { + return -1; // -1 == all modes are ok. TODO + }, + + SDL_GL_SetAttribute: function(attr, value) { + // TODO + }, + SDL_SetVideoMode: function(width, height, depth, flags, canvas) { // ^^^^^^ a 'canvas' parameter is added here; supply a canvas from JS there var surf = _malloc(14*QUANTUM_SIZE); // SDL_Surface has 14 fields of quantum size |