19 #include <emscripten/emscripten.h>
24 #define WINDOW_WIDTH 640
25 #define WINDOW_HEIGHT 480
26 #define NUM_SPRITES 100
107 position = &positions[
i];
108 velocity = &velocities[
i];
109 position->
x += velocity->
x;
110 if ((position->
x < 0) || (position->
x >= (window_w -
sprite_w))) {
111 velocity->
x = -velocity->
x;
112 position->
x += velocity->
x;
114 position->
y += velocity->
y;
115 if ((position->
y < 0) || (position->
y >= (window_h -
sprite_h))) {
116 velocity->
y = -velocity->
y;
117 position->
y += velocity->
y;
139 #ifdef __EMSCRIPTEN__
141 emscripten_cancel_main_loop();
173 while (!velocities[i].
x && !velocities[i].
y) {
182 #ifdef __EMSCRIPTEN__
183 emscripten_set_main_loop(
loop, 0, 1);