mirror of https://github.com/libsdl-org/SDL
Replaced tabs with spaces in test programs.
This commit is contained in:
parent
2e525193ef
commit
11d98995da
|
@ -159,7 +159,7 @@ loop()
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
case SDL_KEYUP:
|
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;
|
break;
|
||||||
case SDL_TEXTEDITING:
|
case SDL_TEXTEDITING:
|
||||||
PrintText("EDIT", event.text.text);
|
PrintText("EDIT", event.text.text);
|
||||||
|
@ -187,13 +187,13 @@ int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
SDL_Window *window;
|
SDL_Window *window;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* 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 */
|
/* Initialize SDL */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
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);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -344,7 +344,7 @@ main(int argc, char *argv[])
|
||||||
SDL_Joystick *joystick;
|
SDL_Joystick *joystick;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* 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) */
|
/* Initialize SDL (Note: video is required to start event loop) */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
|
||||||
|
|
|
@ -93,8 +93,8 @@ main(int argc, char *argv[])
|
||||||
int i;
|
int i;
|
||||||
char filename[4096];
|
char filename[4096];
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
|
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
|
||||||
|
@ -129,7 +129,7 @@ main(int argc, char *argv[])
|
||||||
/* Show the list of available drivers */
|
/* Show the list of available drivers */
|
||||||
SDL_Log("Available audio drivers:");
|
SDL_Log("Available audio drivers:");
|
||||||
for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
|
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 */
|
/* Initialize fillerup() variables */
|
||||||
|
|
|
@ -77,8 +77,8 @@ main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char filename[4096];
|
char filename[4096];
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
|
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
|
||||||
|
|
|
@ -596,8 +596,8 @@ static void RunFIFOTest(SDL_bool lock_free)
|
||||||
Uint32 start, end;
|
Uint32 start, end;
|
||||||
int i, j;
|
int i, j;
|
||||||
int grand_total;
|
int grand_total;
|
||||||
char textBuffer[1024];
|
char textBuffer[1024];
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
SDL_Log("\nFIFO test---------------------------------------\n\n");
|
SDL_Log("\nFIFO test---------------------------------------\n\n");
|
||||||
SDL_Log("Mode: %s\n", lock_free ? "LockFree" : "Mutex");
|
SDL_Log("Mode: %s\n", lock_free ? "LockFree" : "Mutex");
|
||||||
|
@ -686,10 +686,10 @@ static void RunFIFOTest(SDL_bool lock_free)
|
||||||
}
|
}
|
||||||
grand_total += total;
|
grand_total += total;
|
||||||
SDL_Log("Reader %d read %d events, had %d waits\n", i, total, readerData[i].waits);
|
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) {
|
for (j = 0; j < NUM_WRITERS; ++j) {
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
len = SDL_strlen(textBuffer);
|
len = SDL_strlen(textBuffer);
|
||||||
SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, ", ");
|
SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, ", ");
|
||||||
}
|
}
|
||||||
len = SDL_strlen(textBuffer);
|
len = SDL_strlen(textBuffer);
|
||||||
|
@ -697,7 +697,7 @@ static void RunFIFOTest(SDL_bool lock_free)
|
||||||
}
|
}
|
||||||
len = SDL_strlen(textBuffer);
|
len = SDL_strlen(textBuffer);
|
||||||
SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, " }\n");
|
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);
|
SDL_Log("Readers read %d total events\n", grand_total);
|
||||||
}
|
}
|
||||||
|
@ -708,8 +708,8 @@ static void RunFIFOTest(SDL_bool lock_free)
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
RunBasicTest();
|
RunBasicTest();
|
||||||
RunEpicTest();
|
RunEpicTest();
|
||||||
|
|
|
@ -122,8 +122,8 @@ main(int argc, char *argv[])
|
||||||
int i;
|
int i;
|
||||||
char filename[4096];
|
char filename[4096];
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
|
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 */
|
/* Show the list of available drivers */
|
||||||
SDL_Log("Available audio drivers:");
|
SDL_Log("Available audio drivers:");
|
||||||
for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
|
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());
|
SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
|
||||||
|
|
|
@ -34,8 +34,8 @@ main(int argc, char *argv[])
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
int num_displays, dpy;
|
int num_displays, dpy;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||||
|
|
|
@ -211,8 +211,8 @@ main(int argc, char *argv[])
|
||||||
int i;
|
int i;
|
||||||
Uint32 then, now, frames;
|
Uint32 then, now, frames;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* 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 parameters */
|
/* Initialize parameters */
|
||||||
num_objects = NUM_OBJECTS;
|
num_objects = NUM_OBJECTS;
|
||||||
|
|
|
@ -30,28 +30,28 @@ int done;
|
||||||
void
|
void
|
||||||
DrawChessBoard(SDL_Renderer * renderer)
|
DrawChessBoard(SDL_Renderer * renderer)
|
||||||
{
|
{
|
||||||
int row = 0,column = 0,x = 0;
|
int row = 0,column = 0,x = 0;
|
||||||
SDL_Rect rect, darea;
|
SDL_Rect rect, darea;
|
||||||
|
|
||||||
/* Get the Size of drawing surface */
|
/* Get the Size of drawing surface */
|
||||||
SDL_RenderGetViewport(renderer, &darea);
|
SDL_RenderGetViewport(renderer, &darea);
|
||||||
|
|
||||||
for( ; row < 8; row++)
|
for( ; row < 8; row++)
|
||||||
{
|
{
|
||||||
column = row%2;
|
column = row%2;
|
||||||
x = column;
|
x = column;
|
||||||
for( ; column < 4+(row%2); column++)
|
for( ; column < 4+(row%2); column++)
|
||||||
{
|
{
|
||||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF);
|
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF);
|
||||||
|
|
||||||
rect.w = darea.w/8;
|
rect.w = darea.w/8;
|
||||||
rect.h = darea.h/8;
|
rect.h = darea.h/8;
|
||||||
rect.x = x * rect.w;
|
rect.x = x * rect.w;
|
||||||
rect.y = row * rect.h;
|
rect.y = row * rect.h;
|
||||||
x = x + 2;
|
x = x + 2;
|
||||||
SDL_RenderFillRect(renderer, &rect);
|
SDL_RenderFillRect(renderer, &rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -59,77 +59,77 @@ loop()
|
||||||
{
|
{
|
||||||
SDL_Event e;
|
SDL_Event e;
|
||||||
while (SDL_PollEvent(&e)) {
|
while (SDL_PollEvent(&e)) {
|
||||||
if (e.type == SDL_QUIT) {
|
if (e.type == SDL_QUIT) {
|
||||||
done = 1;
|
done = 1;
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
emscripten_cancel_main_loop();
|
emscripten_cancel_main_loop();
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((e.type == SDL_KEYDOWN) && (e.key.keysym.sym == SDLK_ESCAPE)) {
|
if ((e.type == SDL_KEYDOWN) && (e.key.keysym.sym == SDLK_ESCAPE)) {
|
||||||
done = 1;
|
done = 1;
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
emscripten_cancel_main_loop();
|
emscripten_cancel_main_loop();
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawChessBoard(renderer);
|
DrawChessBoard(renderer);
|
||||||
|
|
||||||
/* Got everything on rendering surface,
|
/* Got everything on rendering surface,
|
||||||
now Update the drawing image on window screen */
|
now Update the drawing image on window screen */
|
||||||
SDL_UpdateWindowSurface(window);
|
SDL_UpdateWindowSurface(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
SDL_Surface *surface;
|
SDL_Surface *surface;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* 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 */
|
/* Initialize SDL */
|
||||||
if(SDL_Init(SDL_INIT_VIDEO) != 0)
|
if(SDL_Init(SDL_INIT_VIDEO) != 0)
|
||||||
{
|
{
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Create window and renderer for given surface */
|
/* Create window and renderer for given surface */
|
||||||
window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN);
|
window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN);
|
||||||
if(!window)
|
if(!window)
|
||||||
{
|
{
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
surface = SDL_GetWindowSurface(window);
|
surface = SDL_GetWindowSurface(window);
|
||||||
renderer = SDL_CreateSoftwareRenderer(surface);
|
renderer = SDL_CreateSoftwareRenderer(surface);
|
||||||
if(!renderer)
|
if(!renderer)
|
||||||
{
|
{
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s\n",SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s\n",SDL_GetError());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear the rendering surface with the specified color */
|
/* Clear the rendering surface with the specified color */
|
||||||
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
|
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
|
|
||||||
|
|
||||||
/* Draw the Image on rendering surface */
|
/* Draw the Image on rendering surface */
|
||||||
done = 0;
|
done = 0;
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
emscripten_set_main_loop(loop, 0, 1);
|
emscripten_set_main_loop(loop, 0, 1);
|
||||||
#else
|
#else
|
||||||
while (!done) {
|
while (!done) {
|
||||||
loop();
|
loop();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ main(int argc, char *argv[])
|
||||||
int i, done;
|
int i, done;
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* 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 test framework */
|
/* Initialize test framework */
|
||||||
|
|
|
@ -69,7 +69,7 @@ main(int argc, char *argv[])
|
||||||
char test_buf[30];
|
char test_buf[30];
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* 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();
|
cleanup();
|
||||||
|
|
||||||
|
|
|
@ -247,7 +247,7 @@ main(int argc, char *argv[])
|
||||||
SDL_GameController *gamecontroller;
|
SDL_GameController *gamecontroller;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* 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) */
|
/* Initialize SDL (Note: video is required to start event loop) */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER ) < 0) {
|
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;
|
SDL_Event event;
|
||||||
int device = atoi(argv[1]);
|
int device = atoi(argv[1]);
|
||||||
if (device >= SDL_NumJoysticks()) {
|
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;
|
retcode = 1;
|
||||||
} else {
|
} else {
|
||||||
SDL_JoystickGetGUIDString(SDL_JoystickGetDeviceGUID(device),
|
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,
|
SDL_Log("SDL_GL_ACCELERATED_VISUAL: requested %d, got %d\n", accel,
|
||||||
value);
|
value);
|
||||||
} else {
|
} 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());
|
SDL_GetError());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ perspective_matrix(float fovy, float aspect, float znear, float zfar, float *r)
|
||||||
static void
|
static void
|
||||||
multiply_matrix(float *lhs, float *rhs, float *r)
|
multiply_matrix(float *lhs, float *rhs, float *r)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
float tmp[16];
|
float tmp[16];
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
|
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
|
||||||
|
|
||||||
|
@ -134,10 +134,10 @@ main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
SDL_HapticRumblePlay(haptic, 0.25, 250);
|
SDL_HapticRumblePlay(haptic, 0.25, 250);
|
||||||
}
|
}
|
||||||
if (event.jbutton.button == 0) {
|
if (event.jbutton.button == 0) {
|
||||||
SDL_Log("Exiting due to button press of button 0\n");
|
SDL_Log("Exiting due to button press of button 0\n");
|
||||||
keepGoing = SDL_FALSE;
|
keepGoing = SDL_FALSE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_JOYBUTTONUP:
|
case SDL_JOYBUTTONUP:
|
||||||
SDL_Log("Button Release: %d\n", event.jbutton.button);
|
SDL_Log("Button Release: %d\n", event.jbutton.button);
|
||||||
|
|
|
@ -246,7 +246,7 @@ main(int argc, char *argv[])
|
||||||
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
|
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* 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) */
|
/* Initialize SDL (Note: video is required to start event loop) */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
|
||||||
|
|
|
@ -95,7 +95,7 @@ main(int argc, char *argv[])
|
||||||
int i;
|
int i;
|
||||||
int maxproc = 6;
|
int maxproc = 6;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
|
|
|
@ -85,7 +85,7 @@ main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int success;
|
int success;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
success = SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
success = SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||||
|
|
|
@ -166,7 +166,7 @@ main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int devcount = 0;
|
int devcount = 0;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
|
|
|
@ -131,7 +131,7 @@ main(int argc, char *argv[])
|
||||||
int sprite_w, sprite_h;
|
int sprite_w, sprite_h;
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
if (SDL_VideoInit(NULL) < 0) {
|
if (SDL_VideoInit(NULL) < 0) {
|
||||||
|
|
|
@ -166,7 +166,7 @@ main(int argc, char *argv[])
|
||||||
int frames;
|
int frames;
|
||||||
Uint32 then, now;
|
Uint32 then, now;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* 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 test framework */
|
/* Initialize test framework */
|
||||||
|
|
|
@ -25,7 +25,7 @@ main(int argc, char **argv)
|
||||||
int avgbytes = 0;
|
int avgbytes = 0;
|
||||||
SDL_RWops *io = NULL;
|
SDL_RWops *io = NULL;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
if (argc != 4) {
|
if (argc != 4) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ main(int argc, char **argv)
|
||||||
char *name;
|
char *name;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
name = NULL;
|
name = NULL;
|
||||||
|
|
|
@ -82,7 +82,7 @@ main(int argc, char **argv)
|
||||||
uintptr_t i;
|
uintptr_t i;
|
||||||
int init_sem;
|
int init_sem;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
|
|
|
@ -421,7 +421,7 @@ int main(int argc, char **argv)
|
||||||
GLuint texture;
|
GLuint texture;
|
||||||
GLfloat texcoords[4];
|
GLfloat texcoords[4];
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* 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 for video output */
|
/* Initialize SDL for video output */
|
||||||
|
|
|
@ -60,7 +60,7 @@ int main(int argc,char** argv)
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
if(argc < 2) {
|
if(argc < 2) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Shape requires at least one bitmap file as argument.");
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Shape requires at least one bitmap file as argument.");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -203,13 +203,13 @@ MoveSprites(SDL_Renderer * renderer, SDL_Texture * sprite)
|
||||||
velocity = &velocities[i];
|
velocity = &velocities[i];
|
||||||
position->x += velocity->x;
|
position->x += velocity->x;
|
||||||
if ((position->x < 0) || (position->x >= (viewport.w - sprite_w))) {
|
if ((position->x < 0) || (position->x >= (viewport.w - sprite_w))) {
|
||||||
velocity->x = -velocity->x;
|
velocity->x = -velocity->x;
|
||||||
position->x += velocity->x;
|
position->x += velocity->x;
|
||||||
}
|
}
|
||||||
position->y += velocity->y;
|
position->y += velocity->y;
|
||||||
if ((position->y < 0) || (position->y >= (viewport.h - sprite_h))) {
|
if ((position->y < 0) || (position->y >= (viewport.h - sprite_h))) {
|
||||||
velocity->y = -velocity->y;
|
velocity->y = -velocity->y;
|
||||||
position->y += velocity->y;
|
position->y += velocity->y;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ MoveSprites(SDL_Renderer * renderer, SDL_Texture * sprite)
|
||||||
/* Draw sprites */
|
/* Draw sprites */
|
||||||
for (i = 0; i < num_sprites; ++i) {
|
for (i = 0; i < num_sprites; ++i) {
|
||||||
position = &positions[i];
|
position = &positions[i];
|
||||||
|
|
||||||
/* Blit the sprite onto the screen */
|
/* Blit the sprite onto the screen */
|
||||||
SDL_RenderCopy(renderer, sprite, NULL, position);
|
SDL_RenderCopy(renderer, sprite, NULL, position);
|
||||||
}
|
}
|
||||||
|
@ -263,7 +263,7 @@ main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Uint32 then, now, frames;
|
Uint32 then, now, frames;
|
||||||
Uint64 seed;
|
Uint64 seed;
|
||||||
const char *icon = "icon.bmp";
|
const char *icon = "icon.bmp";
|
||||||
|
|
||||||
/* Initialize parameters */
|
/* Initialize parameters */
|
||||||
|
|
|
@ -150,7 +150,7 @@ main(int argc, char *argv[])
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
if (SDL_CreateWindowAndRenderer(WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer) < 0) {
|
if (SDL_CreateWindowAndRenderer(WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer) < 0) {
|
||||||
|
|
|
@ -129,7 +129,7 @@ main(int argc, char **argv)
|
||||||
SDL_Window *window;
|
SDL_Window *window;
|
||||||
SDL_RWops *handle;
|
SDL_RWops *handle;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
SDL_Thread *thread;
|
SDL_Thread *thread;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
|
|
|
@ -45,7 +45,7 @@ main(int argc, char *argv[])
|
||||||
Uint32 start32, now32;
|
Uint32 start32, now32;
|
||||||
Uint64 start, now;
|
Uint64 start, now;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_TIMER) < 0) {
|
if (SDL_Init(SDL_INIT_TIMER) < 0) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ main(int argc, char *argv[])
|
||||||
SDL_version compiled;
|
SDL_version compiled;
|
||||||
SDL_version linked;
|
SDL_version linked;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
|
|
|
@ -112,7 +112,7 @@ main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
SDL_assert(SDL_arraysize(cursorNames) == SDL_NUM_SYSTEM_CURSORS);
|
SDL_assert(SDL_arraysize(cursorNames) == SDL_NUM_SYSTEM_CURSORS);
|
||||||
|
|
|
@ -79,7 +79,7 @@ main(int argc, char *argv[])
|
||||||
SDL_Thread *threads[NUMTHREADS];
|
SDL_Thread *threads[NUMTHREADS];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
|
|
Loading…
Reference in New Issue