Go to the documentation of this file.
19 #include <emscripten/emscripten.h>
25 #define NUM_SPRITES 100
211 position->
x += velocity->
x;
213 velocity->
x = -velocity->
x;
214 position->
x += velocity->
x;
216 position->
y += velocity->
y;
218 velocity->
y = -velocity->
y;
219 position->
y += velocity->
y;
262 #ifdef __EMSCRIPTEN__
264 emscripten_cancel_main_loop();
273 const double fps = ((double)
frames * 1000) / (now - then);
274 SDL_Log(
"%2.2f frames per second\n", fps);
286 const char *icon =
"icon.bmp";
297 for (
i = 1;
i < argc;) {
337 }
else if (argv[
i][0] !=
'-') {
343 static const char *options[] = {
"[--blend none|blend|add|mod]",
"[--cyclecolor]",
"[--cyclealpha]",
"[--iterations N]",
"[num_sprites]",
"[icon.bmp]",
NULL };
404 #ifdef __EMSCRIPTEN__
405 emscripten_set_main_loop(
loop, 0, 1);
#define SDL_RenderPresent
static SDL_Texture ** sprites
A collection of pixels used in software blitting.
static SDL_Rect * positions
#define SDL_RenderDrawPoint
EGLSurface EGLnsecsANDROID time
static SDL_Texture * sprite
@ SDL_BLENDFACTOR_SRC_ALPHA
static Uint32 next_fps_check
#define SDL_RenderFillRect
#define SDL_SetTextureBlendMode
SDL_Renderer ** renderers
@ SDL_BLENDOPERATION_SUBTRACT
SDLTest_CommonState * SDLTest_CommonCreateState(char **argv, Uint32 flags)
Parse command line parameters and create common state.
void SDLTest_CommonQuit(SDLTest_CommonState *state)
Close test window.
static SDL_bool cycle_alpha
#define SDL_CreateTextureFromSurface
static SDL_Rect * velocities
GLint GLint GLint GLint GLint x
@ SDL_LOG_CATEGORY_APPLICATION
#define SDL_RenderGetViewport
static const Uint32 fps_check_delay
int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
Process one common argument.
#define SDL_SetTextureColorMod
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.
void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite)
static int cycle_direction
#define SDL_LoadBMP(file)
GLint GLint GLint GLint GLint GLint y
#define SDL_ComposeCustomBlendMode
#define SDL_DestroyTexture
SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
Open test window.
static SDL_Renderer * renderer
static SDL_bool cycle_color
A rectangle, with the origin at the upper left (integer).
int main(int argc, char *argv[])
#define SDL_SetRenderDrawColor
#define SDL_TICKS_PASSED(A, B)
Compare SDL ticks values, and return true if A has passed B.
void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done)
Common event handler for test windows.
static SDL_BlendMode blendMode
#define SDL_RenderDrawLine
void SDLTest_FuzzerInit(Uint64 execKey)
#define SDL_SetTextureAlphaMod
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)
SDL_BlendMode
The blend mode used in SDL_RenderCopy() and drawing operations.
static SDLTest_CommonState * state
int LoadSprite(const char *file)
Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max)