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 {
class FrameMenu : public GuiWidget {
private:
bool m_VSync;
bool m_IsometricView;
public:
FrameMenu(client::Client* client);

View File

@@ -8,20 +8,18 @@
namespace td {
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() {
ImGui::Begin("FPS Counter");
ImGui::Text("FPS : %i", (int)ImGui::GetIO().Framerate);
static bool vsync = true;
if (ImGui::Checkbox("V-Sync", &vsync)) {
SDL_GL_SetSwapInterval(vsync);
if (ImGui::Checkbox("V-Sync", &m_VSync)) {
SDL_GL_SetSwapInterval(m_VSync);
}
static bool isometric = true;
if (ImGui::Checkbox("Vue Isometrique ?", &isometric)) {
getClient()->getRenderer()->setIsometricView(isometric);
if (ImGui::Checkbox("Vue Isometrique ?", &m_IsometricView)) {
getClient()->getRenderer()->setIsometricView(m_IsometricView);
}
ImGui::End();
}