mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-12-16 03:15:38 +00:00
testprograms: parse arguments using SDLTest_CommonState
This commit is contained in:
committed by
Anonymous Maarten
parent
8bea41f737
commit
4a6528e3f0
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL_test.h>
|
||||
#include <SDL3/SDL_opengl.h>
|
||||
|
||||
static SDL_Renderer *renderer = NULL;
|
||||
@@ -97,10 +98,22 @@ int main(int argc, char *argv[])
|
||||
Uint64 then, now;
|
||||
Uint32 frames;
|
||||
#endif
|
||||
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);
|
||||
|
||||
/* Parse commandline */
|
||||
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Force the offscreen renderer, if it cannot be created then fail out */
|
||||
SDL_SetHint("SDL_VIDEO_DRIVER", "offscreen");
|
||||
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) {
|
||||
@@ -159,6 +172,7 @@ int main(int argc, char *argv[])
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user