85dbe33a77
Co-authored-by: Copilot <copilot@github.com>
33 lines
541 B
C++
33 lines
541 B
C++
#pragma once
|
|
|
|
#include <SDL3/SDL.h>
|
|
|
|
#include <cstdlib>
|
|
|
|
inline void hdk_set_headless_video_driver() {
|
|
#if defined(_WIN32)
|
|
_putenv_s("SDL_VIDEODRIVER", "dummy");
|
|
#else
|
|
setenv("SDL_VIDEODRIVER", "dummy", 1);
|
|
#endif
|
|
}
|
|
|
|
class SDLSession {
|
|
public:
|
|
SDLSession() {
|
|
hdk_set_headless_video_driver();
|
|
initialized = SDL_Init(SDL_INIT_VIDEO);
|
|
}
|
|
|
|
~SDLSession() {
|
|
if (initialized) {
|
|
SDL_Quit();
|
|
}
|
|
}
|
|
|
|
bool IsInitialized() const { return initialized; }
|
|
|
|
private:
|
|
bool initialized = false;
|
|
};
|