Go to the documentation of this file.
19 #include <emscripten/emscripten.h>
24 #define WINDOW_WIDTH 640
25 #define WINDOW_HEIGHT 480
110 s->sprite_rect.w +=
s->scale_direction;
111 s->sprite_rect.h +=
s->scale_direction;
112 if (
s->scale_direction > 0) {
114 s->scale_direction = -1;
117 if (
s->sprite_rect.w <= 1 ||
s->sprite_rect.h <= 1) {
118 s->scale_direction = 1;
121 s->sprite_rect.x = (
viewport.
w -
s->sprite_rect.w) / 2;
122 s->sprite_rect.y = (
viewport.
h -
s->sprite_rect.h) / 2;
145 #ifdef __EMSCRIPTEN__
147 emscripten_cancel_main_loop();
194 #ifdef __EMSCRIPTEN__
195 emscripten_set_main_loop(
loop, 0, 1);
206 double fps = ((double)
frames * 1000) / (now - then);
207 SDL_Log(
"%2.2f frames per second\n", fps);
#define SDL_RenderPresent
A collection of pixels used in software blitting.
static SDL_Texture * sprite
@ SDL_LOG_CATEGORY_APPLICATION
SDL_Renderer ** renderers
SDLTest_CommonState * SDLTest_CommonCreateState(char **argv, Uint32 flags)
Parse command line parameters and create common state.
The type used to identify a window.
#define SDL_stack_alloc(type, count)
void SDLTest_CommonQuit(SDLTest_CommonState *state)
Close test window.
#define SDL_CreateTextureFromSurface
SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, char **argv)
Easy argument handling when test app doesn't need any custom args.
EGLSurface EGLNativeWindowType * window
#define SDL_RenderGetViewport
Uint32 SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
#define SDL_LoadBMP(file)
SDL_Texture * LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
Open test window.
static SDL_Renderer * renderer
#define SDL_stack_free(data)
int main(int argc, char *argv[])
#define SDL_LogSetPriority
A rectangle, with the origin at the upper left (integer).
void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done)
Common event handler for test windows.
GLenum GLenum GLuint texture
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)
static SDLTest_CommonState * state