Initial Video, Render, and Properties implementations.
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#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;
|
||||
};
|
||||
Reference in New Issue
Block a user