// // Created by darman on 9/24/26. // #include "SdlContext.h" #include #include namespace SiegeDeck::Engine { SdlContext::SdlContext(const string& appName, const string& appVersion) { // Must precede SDL_Init: some platforms read it during init (audio stream names, Wayland app id). SDL_SetAppMetadata(appName.c_str(), appVersion.c_str(), nullptr); // If this throws, the destructor doesn't run, and SDL_Init has cleaned up after itself. if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMEPAD)) throw std::runtime_error(std::format("SDL_Init failed: {}", SDL_GetError())); int version = SDL_GetVersion(); spdlog::info("SDL {}.{}.{} ({} video)", SDL_VERSIONNUM_MAJOR(version), SDL_VERSIONNUM_MINOR(version), SDL_VERSIONNUM_MICRO(version), SDL_GetCurrentVideoDriver()); } SdlContext::~SdlContext() { SDL_Quit(); } }