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);
#define SDL_RenderDrawPoint
static SDL_Texture ** sprites
EGLSurface EGLnsecsANDROID time
#define SDL_LoadBMP(file)
GLint GLint GLint GLint GLint x
Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max)
static SDL_Rect * velocities
SDL_BlendMode
The blend mode used in SDL_RenderCopy() and drawing operations.
SDLTest_CommonState * SDLTest_CommonCreateState(char **argv, Uint32 flags)
Parse command line parameters and create common state.
#define SDL_RenderFillRect
int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
Process one common argument.
A collection of pixels used in software blitting.
static SDL_bool cycle_color
#define SDL_SetTextureBlendMode
static SDLTest_CommonState * state
SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
Open test window.
#define SDL_CreateTextureFromSurface
int LoadSprite(const char *file)
void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done)
Common event handler for test windows.
Uint32 SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
static SDL_Renderer * renderer
#define SDL_RenderGetViewport
GLint GLint GLint GLint GLint GLint y
#define SDL_SetTextureColorMod
const char * SDLTest_CommonUsage(SDLTest_CommonState *state)
Returns common usage information.
static SDL_bool cycle_alpha
SDL_Renderer ** renderers
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_ComposeCustomBlendMode
#define SDL_DestroyTexture
static SDL_Texture * sprite
static SDL_Rect * positions
int main(int argc, char *argv[])
#define SDL_SetRenderDrawColor
static int cycle_direction
void SDLTest_FuzzerInit(Uint64 execKey)
void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite)
static SDL_BlendMode blendMode
#define SDL_RenderDrawLine
void SDLTest_CommonQuit(SDLTest_CommonState *state)
Close test window.
A rectangle, with the origin at the upper left.
#define SDL_RenderPresent
#define SDL_SetTextureAlphaMod