diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-04-17 21:18:17 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-04-17 21:18:17 -0700 |
commit | 327b6f859e95be71e5613f24cc1c9d4f4b97c15f (patch) | |
tree | 2e20c2261892aa04cdcc7b8a901d9cc020621ba7 /tests/sdl_mouse.c | |
parent | 735637e9a10049f69525d57d3e50f4ad0b90850e (diff) |
some support for SDL_PeepEvents
Diffstat (limited to 'tests/sdl_mouse.c')
-rw-r--r-- | tests/sdl_mouse.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/sdl_mouse.c b/tests/sdl_mouse.c index dae3f636..7fc14638 100644 --- a/tests/sdl_mouse.c +++ b/tests/sdl_mouse.c @@ -33,6 +33,9 @@ void one() { SDL_MouseButtonEvent *m = (SDL_MouseButtonEvent*)&event; printf("button up: %d,%d %d,%d\n", m->button, m->state, m->x, m->y); result += 5 * (m->button + m->state + m->x + m->y); + // Remove another click we want to ignore + assert(SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONDOWN) == 1); + assert(SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_MOUSEBUTTONUP, SDL_MOUSEBUTTONUP) == 1); break; } } @@ -48,6 +51,7 @@ int main() { emscripten_run_script("simulateMouseEvent(10, 20, -1)"); // move from 0,0 to 10,20 emscripten_run_script("simulateMouseEvent(10, 20, 0)"); // click + emscripten_run_script("simulateMouseEvent(10, 20, 0)"); // click some more, but this one should be ignored through PeepEvent emscripten_run_script("simulateMouseEvent(30, 77, -1)"); // move some more emscripten_run_script("simulateMouseEvent(30, 77, 1)"); // trigger the end |