Go to the documentation of this file.
19 #include <emscripten/emscripten.h>
125 SDL_Log(
"Blended pixel: 0x%8.8X\n", P);
145 s->sprite_rect.w +=
s->scale_direction;
146 s->sprite_rect.h +=
s->scale_direction;
147 if (
s->scale_direction > 0) {
149 s->scale_direction = -1;
152 if (
s->sprite_rect.w <= 1 ||
s->sprite_rect.h <= 1) {
153 s->scale_direction = 1;
156 s->sprite_rect.x = (
viewport.
w -
s->sprite_rect.w) / 2;
157 s->sprite_rect.y = (
viewport.
h -
s->sprite_rect.h) / 2;
200 s->sprite_rect.w +=
s->scale_direction;
201 s->sprite_rect.h +=
s->scale_direction;
202 if (
s->scale_direction > 0) {
204 s->scale_direction = -1;
207 if (
s->sprite_rect.w <= 1 ||
s->sprite_rect.h <= 1) {
208 s->scale_direction = 1;
211 s->sprite_rect.x = (
viewport.
w -
s->sprite_rect.w) / 2;
212 s->sprite_rect.y = (
viewport.
h -
s->sprite_rect.h) / 2;
244 #ifdef __EMSCRIPTEN__
246 emscripten_cancel_main_loop();
266 for (
i = 1;
i < argc;) {
278 static const char *options[] = {
"[--composite]",
NULL };
313 #ifdef __EMSCRIPTEN__
314 emscripten_set_main_loop(
loop, 0, 1);
325 double fps = ((double)
frames * 1000) / (now - then);
326 SDL_Log(
"%2.2f frames per second\n", fps);
SDL_Texture * LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
SDL_bool DrawComposite(DrawState *s)
#define SDL_RenderPresent
#define SDL_SetRenderTarget
A collection of pixels used in software blitting.
static SDL_Texture * sprite
#define SDL_SetRenderDrawBlendMode
#define SDL_RenderFillRect
#define SDL_SetTextureBlendMode
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.
static SDLTest_CommonState * state
#define SDL_CreateTextureFromSurface
EGLSurface EGLNativeWindowType * window
SDL_bool Draw(DrawState *s)
#define SDL_RenderGetViewport
int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
Process one common argument.
Uint32 SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
void SDLTest_CommonLogUsage(SDLTest_CommonState *state, const char *argv0, const char **options)
Logs command line usage info.
#define SDL_LoadBMP(file)
int main(int argc, char *argv[])
#define SDL_DestroyTexture
SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
Open test window.
static SDL_Renderer * renderer
#define SDL_stack_free(data)
#define SDL_LogSetPriority
A rectangle, with the origin at the upper left (integer).
#define SDL_SetRenderDrawColor
void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done)
Common event handler for test windows.
GLenum GLenum GLuint texture
#define SDL_RenderReadPixels
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_CreateTexture