diff options
Diffstat (limited to 'src/contrib/SDL-3.2.20/cmake/test/main_lib.c')
-rw-r--r-- | src/contrib/SDL-3.2.20/cmake/test/main_lib.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/contrib/SDL-3.2.20/cmake/test/main_lib.c b/src/contrib/SDL-3.2.20/cmake/test/main_lib.c new file mode 100644 index 0000000..6aec1f6 --- /dev/null +++ b/src/contrib/SDL-3.2.20/cmake/test/main_lib.c | |||
@@ -0,0 +1,34 @@ | |||
1 | #include <SDL3/SDL.h> | ||
2 | #define SDL_MAIN_HANDLED /* don't drag in header-only SDL_main implementation */ | ||
3 | #include <SDL3/SDL_main.h> | ||
4 | |||
5 | #include EXPORT_HEADER | ||
6 | |||
7 | #ifdef _WIN32 | ||
8 | #include <windows.h> | ||
9 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { | ||
10 | return TRUE; | ||
11 | } | ||
12 | #endif | ||
13 | |||
14 | int MYLIBRARY_EXPORT mylibrary_init(void); | ||
15 | void MYLIBRARY_EXPORT mylibrary_quit(void); | ||
16 | int MYLIBRARY_EXPORT mylibrary_work(void); | ||
17 | |||
18 | int mylibrary_init(void) { | ||
19 | SDL_SetMainReady(); | ||
20 | if (!SDL_Init(0)) { | ||
21 | SDL_Log("Could not initialize SDL: %s", SDL_GetError()); | ||
22 | return 1; | ||
23 | } | ||
24 | return 0; | ||
25 | } | ||
26 | |||
27 | void mylibrary_quit(void) { | ||
28 | SDL_Quit(); | ||
29 | } | ||
30 | |||
31 | int mylibrary_work(void) { | ||
32 | SDL_Delay(100); | ||
33 | return 0; | ||
34 | } | ||