Files
CosmicEngine/src/Engine/Core/Graphics/CContext.cpp

42 lines
780 B
C++

#include "CContext.hpp"
#include "API/GraphicsAPI.hpp"
#include <SDL3/SDL_init.h>
#include <SDL3_image/SDL_image.h>
bool CContext::m_screenSaver = false;
void CContext::init(SDL_InitFlags sdlFlags) {
// Log initialisation.
initLog();
// SDL Initialization.
if (SDL_Init(sdlFlags)) {
SDL_Quit();
//HandleException(CLibException(std::string("Unable to initialize SDL: ") + SDL_GetError()), true);
}
GraphicsAPI::initAPI();
}
bool CContext::isScreenSaverEnable(void) {
return m_screenSaver;
}
void CContext::setScreenSaverEnable(bool newScreenSaver) {
m_screenSaver = newScreenSaver;
if (m_screenSaver) {
SDL_EnableScreenSaver();
}
else {
SDL_DisableScreenSaver();
}
}
void CContext::quit(void) {
SDL_Quit();
}
void CContext::initLog(void) {
//todo
}