refactor: remove static variables

This commit is contained in:
2021-11-04 11:43:49 +01:00
parent f74b850444
commit a3712febca
2 changed files with 8 additions and 7 deletions

View File

@@ -6,6 +6,9 @@ namespace td {
namespace gui { namespace gui {
class FrameMenu : public GuiWidget { class FrameMenu : public GuiWidget {
private:
bool m_VSync;
bool m_IsometricView;
public: public:
FrameMenu(client::Client* client); FrameMenu(client::Client* client);

View File

@@ -8,20 +8,18 @@
namespace td { namespace td {
namespace gui { namespace gui {
FrameMenu::FrameMenu(client::Client* client) : GuiWidget(client){ FrameMenu::FrameMenu(client::Client* client) : GuiWidget(client), m_VSync(true), m_IsometricView(true){
} }
void FrameMenu::render() { void FrameMenu::render() {
ImGui::Begin("FPS Counter"); ImGui::Begin("FPS Counter");
ImGui::Text("FPS : %i", (int)ImGui::GetIO().Framerate); ImGui::Text("FPS : %i", (int)ImGui::GetIO().Framerate);
static bool vsync = true; if (ImGui::Checkbox("V-Sync", &m_VSync)) {
if (ImGui::Checkbox("V-Sync", &vsync)) { SDL_GL_SetSwapInterval(m_VSync);
SDL_GL_SetSwapInterval(vsync);
} }
static bool isometric = true; if (ImGui::Checkbox("Vue Isometrique ?", &m_IsometricView)) {
if (ImGui::Checkbox("Vue Isometrique ?", &isometric)) { getClient()->getRenderer()->setIsometricView(m_IsometricView);
getClient()->getRenderer()->setIsometricView(isometric);
} }
ImGui::End(); ImGui::End();
} }