Add fullscreen CVar

This commit is contained in:
Luke Street 2021-03-30 16:43:54 -04:00
parent 97fd035f29
commit 0e0c7139d7
2 changed files with 7 additions and 0 deletions

View File

@ -21,6 +21,7 @@ using namespace std::literals;
struct CVarCommons {
CVarManager& m_mgr;
CVar* m_fullscreen = nullptr;
CVar* m_graphicsApi = nullptr;
CVar* m_drawSamples = nullptr;
CVar* m_texAnisotropy = nullptr;
@ -45,6 +46,10 @@ struct CVarCommons {
CVarCommons(CVarManager& manager);
bool getFullscreen() const { return m_fullscreen->toBoolean(); }
void setFullscreen(bool b) { m_fullscreen->fromBoolean(b); }
std::string getGraphicsApi() const { return m_graphicsApi->toLiteral(); }
void setGraphicsApi(std::string_view api) { m_graphicsApi->fromLiteral(api); }

View File

@ -7,6 +7,8 @@ CVarCommons* m_instance = nullptr;
}
CVarCommons::CVarCommons(CVarManager& manager) : m_mgr(manager) {
m_fullscreen = m_mgr.findOrMakeCVar("fullscreen"sv, "Start in fullscreen"sv, false,
hecl::CVar::EFlags::System | hecl::CVar::EFlags::Archive);
m_graphicsApi = m_mgr.findOrMakeCVar("graphicsApi"sv, "API to use for rendering graphics"sv, DEFAULT_GRAPHICS_API,
hecl::CVar::EFlags::System | hecl::CVar::EFlags::Archive |
hecl::CVar::EFlags::ModifyRestart);