diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-05-01 13:28:40 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-05-01 13:28:40 -0700 |
commit | 50d59708df29324c9c913310b49db93241ca1e48 (patch) | |
tree | 28a26b68120f0bd783b8d3d3e68835d807cb5113 /tests/emscripten_api_browser.cpp | |
parent | 34a0667d67e4f4679b438277212a446c3d3f3996 (diff) |
use requestAnimationFrame
Diffstat (limited to 'tests/emscripten_api_browser.cpp')
-rw-r--r-- | tests/emscripten_api_browser.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/emscripten_api_browser.cpp b/tests/emscripten_api_browser.cpp index 0226eae5..a2a19359 100644 --- a/tests/emscripten_api_browser.cpp +++ b/tests/emscripten_api_browser.cpp @@ -9,12 +9,25 @@ int last = 0; extern "C" { +void mainey() { + static int counter = 0; + printf("mainey: %d\n", counter++); + if (counter == 10) { + int result = 1; + REPORT_RESULT(); + } +} + +void four() { + printf("four!\n"); + emscripten_set_main_loop(mainey, 0); +} + void __attribute__((used)) third() { int now = SDL_GetTicks(); printf("thard! %d\n", now); assert(fabs(now - last - 1000) < 500); - int result = 1; - REPORT_RESULT(); + emscripten_async_call(four, -1); // triggers requestAnimationFrame } void second() { |