testprograms: parse arguments using SDLTest_CommonState
This commit is contained in:
committed by
Anonymous Maarten
parent
8bea41f737
commit
4a6528e3f0
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL_test.h>
|
||||
|
||||
#define NUMTHREADS 10
|
||||
|
||||
@@ -76,6 +77,13 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
SDL_Thread *threads[NUMTHREADS];
|
||||
int i;
|
||||
SDLTest_CommonState *state;
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, 0);
|
||||
if (state == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Enable standard application logging */
|
||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||
@@ -86,6 +94,11 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||
SDLTest_CommonDestroyState(state);
|
||||
return 1;
|
||||
}
|
||||
|
||||
(void)signal(SIGSEGV, SIG_DFL);
|
||||
for (i = 0; i < NUMTHREADS; i++) {
|
||||
char name[64];
|
||||
@@ -107,5 +120,6 @@ int main(int argc, char *argv[])
|
||||
SDL_WaitThread(threads[i], NULL);
|
||||
}
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user