mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-26 12:27:44 +00:00
testprograms: parse arguments using SDLTest_CommonState
This commit is contained in:
committed by
Anonymous Maarten
parent
8bea41f737
commit
4a6528e3f0
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL_test.h>
|
||||
|
||||
static const char *GetSensorTypeString(SDL_SensorType type)
|
||||
{
|
||||
@@ -59,10 +60,26 @@ int main(int argc, char **argv)
|
||||
{
|
||||
SDL_SensorID *sensors;
|
||||
int i, num_sensors, num_opened;
|
||||
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);
|
||||
|
||||
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||
SDLTest_CommonDestroyState(state);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Load the SDL library */
|
||||
if (SDL_Init(SDL_INIT_SENSOR) < 0) {
|
||||
SDL_Log("Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
SDLTest_CommonDestroyState(state);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -119,5 +136,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user