Go to the documentation of this file.
20 #include <emscripten/emscripten.h>
25 #define SWAP(typ,a,b) do{typ t=a;a=b;b=t;}while(0)
26 #define NUM_OBJECTS 100
210 switch (
event.type) {
216 if (
event.button.button == 3)
219 if (
event.button.button == 1)
224 switch (
event.key.keysym.sym) {
229 add_line(rand() % 640, rand() % 480, rand() % 640,
236 add_rect(rand() % 640, rand() % 480, rand() % 640,
260 #ifdef __EMSCRIPTEN__
262 emscripten_cancel_main_loop();
284 for (
i = 1;
i < argc;) {
318 static const char *options[] = {
"[--blend none|blend|add|mod]",
"[--cyclecolor]",
"[--cyclealpha]",
NULL };
343 #ifdef __EMSCRIPTEN__
344 emscripten_set_main_loop(
loop, 0, 1);
357 double fps = ((double)
frames * 1000) / (now - then);
358 SDL_Log(
"%2.2f frames per second\n", fps);
#define SDL_RenderPresent
static void DrawRectLineIntersections(SDL_Renderer *renderer)
#define SDL_RenderDrawPoint
EGLSurface EGLnsecsANDROID time
static int cycle_direction
static void DrawRects(SDL_Renderer *renderer)
void DrawPoints(SDL_Renderer *renderer)
#define SDL_SetRenderDrawBlendMode
GLdouble GLdouble GLdouble r
#define SDL_RenderFillRect
#define SDL_IntersectRect
GLuint GLfloat GLfloat GLfloat x1
GLfloat GLfloat GLfloat GLfloat h
void DrawLines(SDL_Renderer *renderer)
SDL_Renderer ** renderers
SDLTest_CommonState * SDLTest_CommonCreateState(char **argv, Uint32 flags)
Parse command line parameters and create common state.
#define SDL_RenderFillRects
void SDLTest_CommonQuit(SDLTest_CommonState *state)
Close test window.
int main(int argc, char *argv[])
SDL_Rect lines[MAX_LINES]
GLint GLint GLint GLint GLint x
@ SDL_LOG_CATEGORY_APPLICATION
#define SDL_RenderGetViewport
static int add_line(int x1, int y1, int x2, int y2)
int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
Process one common argument.
static SDLTest_CommonState * state
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.
GLint GLint GLint GLint GLint GLint y
static SDL_bool cycle_color
SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
Open test window.
static SDL_Renderer * renderer
#define SDL_LogSetPriority
static SDL_BlendMode blendMode
static SDL_bool cycle_alpha
static void DrawRectRectIntersections(SDL_Renderer *renderer)
A rectangle, with the origin at the upper left (integer).
static int add_rect(int x1, int y1, int x2, int y2)
#define SDL_SetRenderDrawColor
GLfixed GLfixed GLfixed y2
#define SDL_IntersectRectAndLine
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 int in j)
void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done)
Common event handler for test windows.
#define SDL_RenderDrawLine
EGLSurface EGLint * rects
SDL_BlendMode
The blend mode used in SDL_RenderCopy() and drawing operations.
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)
GLubyte GLubyte GLubyte GLubyte w