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);
EGLSurface EGLnsecsANDROID time
int LoadSprite(char *file, SDL_Renderer *renderer)
#define SDL_LoadBMP(file)
GLint GLint GLint GLint GLint x
static SDL_Rect velocities[NUM_SPRITES]
A collection of pixels used in software blitting.
void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite)
static SDL_Rect positions[NUM_SPRITES]
#define SDL_CreateTextureFromSurface
GLint GLint GLint GLint GLint GLint y
int main(int argc, char *argv[])
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
#define SDL_LogSetPriority
EGLSurface EGLNativeWindowType * window
static SDL_Texture * sprite
The type used to identify a window.
#define SDL_CreateWindowAndRenderer
#define SDL_SetRenderDrawColor
A rectangle, with the origin at the upper left.
#define SDL_RenderPresent