| | 1 | | using static SDL2.SDL; |
| | 2 | | using static SDL2.SDL_version; |
| | 3 | | using static Imagini.Logger; |
| | 4 | |
|
| | 5 | | namespace Imagini |
| | 6 | | { |
| | 7 | | internal static class Lifecycle |
| | 8 | | { |
| | 9 | | private static bool s_initialized = false; |
| | 10 | | internal static void TryInitialize() |
| | 11 | | { |
| 10 | 12 | | if (!s_initialized) |
| | 13 | | { |
| 1 | 14 | | SDL_Init( |
| 0 | 15 | | SDL_INIT_VIDEO | |
| 0 | 16 | | SDL_INIT_JOYSTICK | |
| 0 | 17 | | SDL_INIT_GAMECONTROLLER | |
| 0 | 18 | | SDL_INIT_EVENTS |
| 0 | 19 | | ); |
| 1 | 20 | | s_initialized = true; |
| 1 | 21 | | PrintVersion(); |
| | 22 | | } |
| 10 | 23 | | } |
| | 24 | |
|
| | 25 | | private static void PrintVersion() |
| | 26 | | { |
| 1 | 27 | | SDL_GetVersion(out SDL_Version version); |
| 0 | 28 | | Log.Information("Using SDL version {major}.{minor}.{patch}", |
| 0 | 29 | | version.major, version.minor, version.patch); |
| 1 | 30 | | } |
| | 31 | | } |
| | 32 | | } |