diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-05-21 21:18:35 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-05-21 21:18:35 -0700 |
commit | 32358a7dedd5a00611bf01129599739faaa6f985 (patch) | |
tree | b43d2cf13f428b6fbf633b9a967fd55a290b7b79 | |
parent | ab40876d469b2c94d7e4c4e579bdab419861b623 (diff) |
SDL_PushEvent
-rw-r--r-- | src/library_sdl.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index 25b5b85f..caf34c58 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -95,6 +95,12 @@ mergeInto(Library, { }, makeCEvent: function(event, ptr) { + if (typeof event === 'number') { + // This is a pointer to a native C event that was SDL_PushEvent'ed + _memcpy(ptr, event, SDL.structs.KeyboardEvent.__size__); + return; + } + switch(event.type) { case 'keydown': case 'keyup': var down = event.type === 'keydown'; @@ -287,6 +293,12 @@ mergeInto(Library, { return 1; }, + SDL_PushEvent: function(ptr) { + SDL.events.push(ptr); // XXX Should we copy it? Not clear from API + + return 0; + }, + SDL_SetColors: function(surf, colors, firstColor, nColors) { var surfData = SDL.surfaces[surf]; surfData.colors = []; |