diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-11-06 11:56:14 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-11-06 11:56:14 -0800 |
commit | 7f870cf9c357f6a1138ba612ace7d7249f85e250 (patch) | |
tree | b39b3c6cb644b5c20936de1bae7833c0b95173c7 | |
parent | 663075274d30ae406734e7eb5ef8b07c9340e9a6 (diff) | |
parent | 2247ff845fa862a35fc9d1acf8150eb7e56f41ac (diff) |
Merge pull request #1748 from caiiiycuk/fix_sdl_colors
Fix SDL_SetColors && SDL_envets
-rw-r--r-- | src/library_sdl.js | 8 | ||||
-rw-r--r-- | system/include/SDL/SDL_events.h | 1 | ||||
-rw-r--r-- | tests/sdl_canvas_palette.c | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index 0cf6c97a..5b43b7ab 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -1237,11 +1237,11 @@ var LibrarySDL = { surfData.colors = new Uint8Array(256 * 3); //256 RGB colors } - for (var i = firstColor; i < firstColor + nColors; i++) { - var index = i *3; + for (var i = 0; i < nColors; ++i) { + var index = (firstColor + i) * 3; surfData.colors[index] = {{{ makeGetValue('colors', 'i*4', 'i8', null, true) }}}; - surfData.colors[index +1] = {{{ makeGetValue('colors', 'i*4 +1', 'i8', null, true) }}}; - surfData.colors[index +2] = {{{ makeGetValue('colors', 'i*4 +2', 'i8', null, true) }}}; + surfData.colors[index + 1] = {{{ makeGetValue('colors', 'i*4 + 1', 'i8', null, true) }}}; + surfData.colors[index + 2] = {{{ makeGetValue('colors', 'i*4 + 2', 'i8', null, true) }}}; } return 1; diff --git a/system/include/SDL/SDL_events.h b/system/include/SDL/SDL_events.h index 804ac57e..8be00ceb 100644 --- a/system/include/SDL/SDL_events.h +++ b/system/include/SDL/SDL_events.h @@ -55,6 +55,7 @@ extern "C" { */ typedef enum { + SDL_NOEVENT = 0, SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */ /* Application events */ diff --git a/tests/sdl_canvas_palette.c b/tests/sdl_canvas_palette.c index 316aa44a..361f71a6 100644 --- a/tests/sdl_canvas_palette.c +++ b/tests/sdl_canvas_palette.c @@ -42,7 +42,7 @@ int main() { //changing green color //to yellow pal[1].r = 255; - SDL_SetColors(screen, pal, 1, 1); + SDL_SetColors(screen, &pal[1], 1, 1); { SDL_Rect rect = { 300, 200, 300, 200 }; |