Skip to content
Permalink
Browse files

Replaced tabs with spaces in test programs.

  • Loading branch information
philippwiesemann committed Nov 25, 2015
1 parent 2e52519 commit 11d98995da77ce0756cac1c792fe58a0473a5ee2
@@ -159,7 +159,7 @@ loop()
switch (event.type) {
case SDL_KEYDOWN:
case SDL_KEYUP:
PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE);
PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE);
break;
case SDL_TEXTEDITING:
PrintText("EDIT", event.text.text);
@@ -187,13 +187,13 @@ int
main(int argc, char *argv[])
{
SDL_Window *window;
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

/* Initialize SDL */
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
return (1);
}

@@ -344,7 +344,7 @@ main(int argc, char *argv[])
SDL_Joystick *joystick;

/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

/* Initialize SDL (Note: video is required to start event loop) */
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
@@ -93,8 +93,8 @@ main(int argc, char *argv[])
int i;
char filename[4096];

/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

/* Load the SDL library */
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
@@ -129,7 +129,7 @@ main(int argc, char *argv[])
/* Show the list of available drivers */
SDL_Log("Available audio drivers:");
for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
}

/* Initialize fillerup() variables */
@@ -77,8 +77,8 @@ main(int argc, char *argv[])
{
char filename[4096];

/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

/* Load the SDL library */
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
@@ -596,8 +596,8 @@ static void RunFIFOTest(SDL_bool lock_free)
Uint32 start, end;
int i, j;
int grand_total;
char textBuffer[1024];
int len;
char textBuffer[1024];
int len;

SDL_Log("\nFIFO test---------------------------------------\n\n");
SDL_Log("Mode: %s\n", lock_free ? "LockFree" : "Mutex");
@@ -686,18 +686,18 @@ static void RunFIFOTest(SDL_bool lock_free)
}
grand_total += total;
SDL_Log("Reader %d read %d events, had %d waits\n", i, total, readerData[i].waits);
SDL_snprintf(textBuffer, sizeof(textBuffer), " { ");
SDL_snprintf(textBuffer, sizeof(textBuffer), " { ");
for (j = 0; j < NUM_WRITERS; ++j) {
if (j > 0) {
len = SDL_strlen(textBuffer);
len = SDL_strlen(textBuffer);
SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, ", ");
}
len = SDL_strlen(textBuffer);
SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, "%d", readerData[i].counters[j]);
}
len = SDL_strlen(textBuffer);
SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, " }\n");
SDL_Log("%s", textBuffer);
SDL_Log("%s", textBuffer);
}
SDL_Log("Readers read %d total events\n", grand_total);
}
@@ -708,8 +708,8 @@ static void RunFIFOTest(SDL_bool lock_free)
int
main(int argc, char *argv[])
{
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

RunBasicTest();
RunEpicTest();
@@ -122,8 +122,8 @@ main(int argc, char *argv[])
int i;
char filename[4096];

/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

/* Load the SDL library */
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
@@ -160,7 +160,7 @@ main(int argc, char *argv[])
/* Show the list of available drivers */
SDL_Log("Available audio drivers:");
for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
}

SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
@@ -34,8 +34,8 @@ main(int argc, char *argv[])
SDL_DisplayMode mode;
int num_displays, dpy;

/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

/* Load the SDL library */
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
@@ -211,8 +211,8 @@ main(int argc, char *argv[])
int i;
Uint32 then, now, frames;

/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

/* Initialize parameters */
num_objects = NUM_OBJECTS;
@@ -30,106 +30,106 @@ int done;
void
DrawChessBoard(SDL_Renderer * renderer)
{
int row = 0,column = 0,x = 0;
SDL_Rect rect, darea;

/* Get the Size of drawing surface */
SDL_RenderGetViewport(renderer, &darea);

for( ; row < 8; row++)
{
column = row%2;
x = column;
for( ; column < 4+(row%2); column++)
{
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF);

rect.w = darea.w/8;
rect.h = darea.h/8;
rect.x = x * rect.w;
rect.y = row * rect.h;
x = x + 2;
SDL_RenderFillRect(renderer, &rect);
}
}
int row = 0,column = 0,x = 0;
SDL_Rect rect, darea;

/* Get the Size of drawing surface */
SDL_RenderGetViewport(renderer, &darea);

for( ; row < 8; row++)
{
column = row%2;
x = column;
for( ; column < 4+(row%2); column++)
{
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF);

rect.w = darea.w/8;
rect.h = darea.h/8;
rect.x = x * rect.w;
rect.y = row * rect.h;
x = x + 2;
SDL_RenderFillRect(renderer, &rect);
}
}
}

void
loop()
{
SDL_Event e;
while (SDL_PollEvent(&e)) {
if (e.type == SDL_QUIT) {
done = 1;
if (e.type == SDL_QUIT) {
done = 1;
#ifdef __EMSCRIPTEN__
emscripten_cancel_main_loop();
emscripten_cancel_main_loop();
#endif
return;
}
return;
}

if ((e.type == SDL_KEYDOWN) && (e.key.keysym.sym == SDLK_ESCAPE)) {
done = 1;
if ((e.type == SDL_KEYDOWN) && (e.key.keysym.sym == SDLK_ESCAPE)) {
done = 1;
#ifdef __EMSCRIPTEN__
emscripten_cancel_main_loop();
emscripten_cancel_main_loop();
#endif
return;
}
}
DrawChessBoard(renderer);
/* Got everything on rendering surface,
now Update the drawing image on window screen */
SDL_UpdateWindowSurface(window);
return;
}
}

DrawChessBoard(renderer);

/* Got everything on rendering surface,
now Update the drawing image on window screen */
SDL_UpdateWindowSurface(window);
}

int
main(int argc, char *argv[])
{
SDL_Surface *surface;
SDL_Surface *surface;

/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

/* Initialize SDL */
if(SDL_Init(SDL_INIT_VIDEO) != 0)
{
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError());
return 1;
}


/* Create window and renderer for given surface */
window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN);
if(!window)
{
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError());
return 1;
}
surface = SDL_GetWindowSurface(window);
renderer = SDL_CreateSoftwareRenderer(surface);
if(!renderer)
{
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s\n",SDL_GetError());
return 1;
}

/* Clear the rendering surface with the specified color */
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
SDL_RenderClear(renderer);


/* Draw the Image on rendering surface */
done = 0;
/* Initialize SDL */
if(SDL_Init(SDL_INIT_VIDEO) != 0)
{
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError());
return 1;
}


/* Create window and renderer for given surface */
window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN);
if(!window)
{
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError());
return 1;
}
surface = SDL_GetWindowSurface(window);
renderer = SDL_CreateSoftwareRenderer(surface);
if(!renderer)
{
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s\n",SDL_GetError());
return 1;
}

/* Clear the rendering surface with the specified color */
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
SDL_RenderClear(renderer);


/* Draw the Image on rendering surface */
done = 0;
#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(loop, 0, 1);
#else
while (!done) {
loop();
}
}
#endif

SDL_Quit();
return 0;
return 0;
}

@@ -31,7 +31,7 @@ main(int argc, char *argv[])
int i, done;
SDL_Event event;

/* Enable standard application logging */
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

/* Initialize test framework */
@@ -69,7 +69,7 @@ main(int argc, char *argv[])
char test_buf[30];

/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

cleanup();

@@ -247,7 +247,7 @@ main(int argc, char *argv[])
SDL_GameController *gamecontroller;

/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

/* Initialize SDL (Note: video is required to start event loop) */
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER ) < 0) {
@@ -284,7 +284,7 @@ main(int argc, char *argv[])
SDL_Event event;
int device = atoi(argv[1]);
if (device >= SDL_NumJoysticks()) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%i is an invalid joystick index.\n", device);
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%i is an invalid joystick index.\n", device);
retcode = 1;
} else {
SDL_JoystickGetGUIDString(SDL_JoystickGetDeviceGUID(device),
@@ -357,7 +357,7 @@ main(int argc, char *argv[])
SDL_Log("SDL_GL_ACCELERATED_VISUAL: requested %d, got %d\n", accel,
value);
} else {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n",
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n",
SDL_GetError());
}
}
@@ -169,7 +169,7 @@ perspective_matrix(float fovy, float aspect, float znear, float zfar, float *r)
static void
multiply_matrix(float *lhs, float *rhs, float *r)
{
int i, j, k;
int i, j, k;
float tmp[16];

for (i = 0; i < 4; i++) {

0 comments on commit 11d9899

Please sign in to comment.