metaforce/Runtime/ConsoleVariables/CVarCommons.hpp

97 lines
3.1 KiB
C++
Raw Normal View History

2018-10-07 03:38:44 +00:00
#pragma once
2018-01-10 06:16:18 +00:00
#include <algorithm>
#include <cstdint>
#include <string>
#include "Runtime/ConsoleVariables/CVarManager.hpp"
2018-01-10 06:16:18 +00:00
#undef min
#undef max
namespace metaforce {
2018-01-10 06:16:18 +00:00
using namespace std::literals;
#if defined(__APPLE__)
2018-01-22 02:40:11 +00:00
#define DEFAULT_GRAPHICS_API "Metal"sv
2018-01-10 06:16:18 +00:00
#else
#define DEFAULT_GRAPHICS_API "Vulkan"sv
2018-01-10 06:16:18 +00:00
#endif
2018-12-08 05:18:42 +00:00
struct CVarCommons {
CVarManager& m_mgr;
2021-03-30 20:43:54 +00:00
CVar* m_fullscreen = nullptr;
CVar* m_allowJoystickInBackground = nullptr;
2018-12-08 05:18:42 +00:00
CVar* m_graphicsApi = nullptr;
CVar* m_drawSamples = nullptr;
CVar* m_texAnisotropy = nullptr;
CVar* m_deepColor = nullptr;
2020-04-14 19:20:00 +00:00
CVar* m_variableDt = nullptr;
CVar* m_windowSize = nullptr;
CVar* m_windowPos = nullptr;
2020-04-14 19:20:00 +00:00
CVar* m_debugOverlayPlayerInfo = nullptr;
CVar* m_debugOverlayWorldInfo = nullptr;
CVar* m_debugOverlayAreaInfo = nullptr;
2021-05-31 00:29:27 +00:00
CVar* m_debugOverlayLayerInfo = nullptr;
2020-04-14 19:20:00 +00:00
CVar* m_debugOverlayShowFrameCounter = nullptr;
2021-01-03 19:04:00 +00:00
CVar* m_debugOverlayShowFramerate = nullptr;
2020-04-14 19:20:00 +00:00
CVar* m_debugOverlayShowInGameTime = nullptr;
CVar* m_debugOverlayShowResourceStats = nullptr;
2020-09-13 20:43:15 +00:00
CVar* m_debugOverlayShowRandomStats = nullptr;
CVar* m_debugOverlayShowRoomTimer = nullptr;
CVar* m_debugOverlayPipelineInfo = nullptr;
CVar* m_debugOverlayDrawCallInfo = nullptr;
CVar* m_debugOverlayBufferInfo = nullptr;
CVar* m_debugOverlayShowInput = nullptr;
CVar* m_debugOverlayCorner = nullptr;
CVar* m_debugInputOverlayCorner = nullptr;
2021-01-11 02:41:59 +00:00
CVar* m_debugToolDrawAiPath = nullptr;
CVar* m_debugToolDrawLighting = nullptr;
CVar* m_debugToolDrawCollisionActors = nullptr;
CVar* m_debugToolDrawMazePath = nullptr;
CVar* m_debugToolDrawPlatformCollision = nullptr;
CVar* m_logFile = nullptr;
CVar* m_lastDiscPath = nullptr;
2018-12-08 05:18:42 +00:00
2021-02-28 02:36:43 +00:00
CVarCommons(CVarManager& manager);
2018-12-08 05:18:42 +00:00
2021-03-30 20:43:54 +00:00
bool getFullscreen() const { return m_fullscreen->toBoolean(); }
bool getAllowJoystickInBackground() const { return m_allowJoystickInBackground->toBoolean(); }
2021-03-30 20:43:54 +00:00
void setFullscreen(bool b) { m_fullscreen->fromBoolean(b); }
2018-12-08 05:18:42 +00:00
std::string getGraphicsApi() const { return m_graphicsApi->toLiteral(); }
void setGraphicsApi(std::string_view api) { m_graphicsApi->fromLiteral(api); }
uint32_t getSamples() const { return std::max(1u, m_drawSamples->toUnsigned()); }
2018-12-08 05:18:42 +00:00
void setSamples(uint32_t v) { m_drawSamples->fromInteger(std::max(uint32_t(1), v)); }
2018-01-10 06:16:18 +00:00
uint32_t getAnisotropy() const { return std::max(1u, uint32_t(m_texAnisotropy->toUnsigned())); }
zeus::CVector2i getWindowSize() const { return m_windowSize->toVec2i(); }
zeus::CVector2i getWindowPos() const { return m_windowPos->toVec2i(); }
2018-12-08 05:18:42 +00:00
void setAnisotropy(uint32_t v) { m_texAnisotropy->fromInteger(std::max(1u, v)); }
2018-12-08 05:18:42 +00:00
bool getDeepColor() const { return m_deepColor->toBoolean(); }
void setDeepColor(bool b) { m_deepColor->fromBoolean(b); }
bool getVariableFrameTime() const { return m_variableDt->toBoolean(); }
void setVariableFrameTime(bool b) { m_variableDt->fromBoolean(b); }
std::string getLogFile() const { return m_logFile->toLiteral(); };
void setLogFile(std::string_view log) { m_logFile->fromLiteral(log); }
2018-12-08 05:18:42 +00:00
void serialize() { m_mgr.serialize(); }
2021-02-28 02:36:43 +00:00
static CVarCommons* instance();
2018-12-08 05:18:42 +00:00
};
2018-01-10 06:16:18 +00:00
2018-12-08 05:18:42 +00:00
} // namespace hecl