19 #include <emscripten/emscripten.h>
25 #define NUM_SPRITES 100
137 (
Uint8) current_color);
207 position = &positions[
i];
208 velocity = &velocities[
i];
209 position->
x += velocity->
x;
210 if ((position->
x < 0) || (position->
x >= (viewport.
w -
sprite_w))) {
211 velocity->
x = -velocity->
x;
212 position->
x += velocity->
x;
214 position->
y += velocity->
y;
215 if ((position->
y < 0) || (position->
y >= (viewport.
h -
sprite_h))) {
216 velocity->
y = -velocity->
y;
217 position->
y += velocity->
y;
234 position = &positions[
i];
259 #ifdef __EMSCRIPTEN__
261 emscripten_cancel_main_loop();
272 const char *icon =
"icon.bmp";
283 for (i = 1; i < argc;) {
323 }
else if (argv[i][0] !=
'-') {
329 SDL_Log(
"Usage: %s %s [--blend none|blend|add|mod] [--cyclecolor] [--cyclealpha] [--iterations N] [num_sprites] [icon.bmp]\n",
358 if (!positions || !velocities) {
379 while (!velocities[i].
x && !velocities[i].
y) {
390 #ifdef __EMSCRIPTEN__
391 emscripten_set_main_loop(
loop, 0, 1);
402 double fps = ((double) frames * 1000) / (now - then);
403 SDL_Log(
"%2.2f frames per second\n", fps);