From 2d2a854f0f293612d927766f4ba68f756c45c153 Mon Sep 17 00:00:00 2001 From: mitchellhansen Date: Thu, 5 Oct 2017 22:51:02 -0700 Subject: [PATCH] This is going to require a major rewrite of every component of this program. Going to revert back to the linear game loop for now --- config/general_settings | 6 +- config/graphics_settings | 6 +- include/Gui.h | 132 ++++++++++++------------- include/Input.h | 14 +-- src/Gui.cpp | 6 +- src/Input.cpp | 202 +++++++++++++++++++-------------------- 6 files changed, 183 insertions(+), 183 deletions(-) diff --git a/config/general_settings b/config/general_settings index c66b9c2..0793864 100644 --- a/config/general_settings +++ b/config/general_settings @@ -1,3 +1,3 @@ -[LOGGING] -log_level = 0 # INFO, WARN, ERROR -log_dest = 0 # STDOUT, FILE +[LOGGING] +log_level = 0 # INFO, WARN, ERROR +log_dest = 0 # STDOUT, FILE diff --git a/config/graphics_settings b/config/graphics_settings index ffa7620..f1d84cf 100644 --- a/config/graphics_settings +++ b/config/graphics_settings @@ -1,3 +1,3 @@ -[GRAPHICS] -x_resolution = 800 -y_resolution = 800 +[GRAPHICS] +x_resolution = 800 +y_resolution = 800 diff --git a/include/Gui.h b/include/Gui.h index 783c462..e68f533 100644 --- a/include/Gui.h +++ b/include/Gui.h @@ -1,66 +1,66 @@ -#pragma once -#include -#include -#include - -class Gui { - -public: - - Gui() { - container_lock.lock(); - renderable_container.push_back(this); - container_lock.unlock(); - }; - virtual ~Gui() { - container_lock.lock(); - renderable_container.remove(this); - container_lock.unlock(); - }; - - virtual void render_gui() = 0; - virtual void update_gui() = 0; - - // Instead of rendering nil, we can pass our render call if we would like - bool renderable() { return rendering; }; - -private: - - // Whatever class that wants to call this must be a friend!!! - friend class Application; - static void do_render() { - for (auto i : renderable_container) { - i->update_gui(); - if (i->renderable()) - i->render_gui(); - } - }; - - - - static std::mutex container_lock; - static std::list renderable_container; - -protected: - bool rendering = true; - // Derived class will handle imgui calls - -}; - - - - - - - - - - - - - - - - - - +#pragma once +#include +#include +#include + +class Gui { + +public: + + Gui() { + container_lock.lock(); + renderable_container.push_back(this); + container_lock.unlock(); + }; + virtual ~Gui() { + container_lock.lock(); + renderable_container.remove(this); + container_lock.unlock(); + }; + + virtual void render_gui() = 0; + virtual void update_gui() = 0; + + // Instead of rendering nil, we can pass our render call if we would like + bool renderable() { return rendering; }; + +private: + + // Whatever class that wants to call this must be a friend!!! + friend class Application; + static void do_render() { + for (auto i : renderable_container) { + i->update_gui(); + if (i->renderable()) + i->render_gui(); + } + }; + + + + static std::mutex container_lock; + static std::list renderable_container; + +protected: + bool rendering = true; + // Derived class will handle imgui calls + +}; + + + + + + + + + + + + + + + + + + diff --git a/include/Input.h b/include/Input.h index 57cf61c..46729e6 100644 --- a/include/Input.h +++ b/include/Input.h @@ -55,13 +55,13 @@ public: if (event.get()->type == vr::Event::Closed) { window_ref->close(); - } else if (event.get()->type == vr::Event::KeyPressed) { - - vr::KeyPressed *key_event = static_cast(event.get()); - - if (key_event->code == sf::Keyboard::Escape) { - window_ref->close(); - } + } else if (event.get()->type == vr::Event::KeyPressed) { + + vr::KeyPressed *key_event = static_cast(event.get()); + + if (key_event->code == sf::Keyboard::Escape) { + window_ref->close(); + } } }; diff --git a/src/Gui.cpp b/src/Gui.cpp index c2174e6..6861ce9 100644 --- a/src/Gui.cpp +++ b/src/Gui.cpp @@ -1,4 +1,4 @@ -#include "Gui.h" - -std::mutex Gui::container_lock; +#include "Gui.h" + +std::mutex Gui::container_lock; std::list Gui::renderable_container; \ No newline at end of file diff --git a/src/Input.cpp b/src/Input.cpp index 4f0b292..61e6906 100644 --- a/src/Input.cpp +++ b/src/Input.cpp @@ -282,107 +282,107 @@ void Input::transpose_sf_events(std::list sf_event_queue) { } } -const std::vector Input::key_strings = { - "A", - "B", - "C", - "D", - "E", - "F", - "G", - "H", - "I", - "J", - "K", - "L", - "M", - "N", - "O", - "P", - "Q", - "R", - "S", - "T", - "U", - "V", - "W", - "X", - "Y", - "Z", - "Num0", - "Num1", - "Num2", - "Num3", - "Num4", - "Num5", - "Num6", - "Num7", - "Num8", - "Num9", - "Escape", - "LControl", - "LShift", - "LAlt", - "LSystem", - "RControl", - "RShift", - "RAlt", - "RSystem", - "Menu", - "LBracket", - "RBracket", - "SemiColon", - "Comma", - "Period", - "Quote", - "Slash", - "BackSlash", - "Tilde", - "Equal", - "Dash", - "Space", - "Return", - "BackSpace", - "Tab", - "PageUp", - "PageDown", - "End", - "Home", - "Insert", - "Delete", - "Add", - "Subtract", - "Multiply", - "Divide", - "Left", - "Right", - "Up", - "Down", - "Numpad0", - "Numpad1", - "Numpad2", - "Numpad3", - "Numpad4", - "Numpad5", - "Numpad6", - "Numpad7", - "Numpad8", - "Numpad9", - "F1" , - "F2" , - "F3" , - "F4" , - "F5" , - "F6" , - "F7" , - "F8" , - "F9" , - "F10", - "F11", - "F12", - "F13", - "F14", - "F15", +const std::vector Input::key_strings = { + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L", + "M", + "N", + "O", + "P", + "Q", + "R", + "S", + "T", + "U", + "V", + "W", + "X", + "Y", + "Z", + "Num0", + "Num1", + "Num2", + "Num3", + "Num4", + "Num5", + "Num6", + "Num7", + "Num8", + "Num9", + "Escape", + "LControl", + "LShift", + "LAlt", + "LSystem", + "RControl", + "RShift", + "RAlt", + "RSystem", + "Menu", + "LBracket", + "RBracket", + "SemiColon", + "Comma", + "Period", + "Quote", + "Slash", + "BackSlash", + "Tilde", + "Equal", + "Dash", + "Space", + "Return", + "BackSpace", + "Tab", + "PageUp", + "PageDown", + "End", + "Home", + "Insert", + "Delete", + "Add", + "Subtract", + "Multiply", + "Divide", + "Left", + "Right", + "Up", + "Down", + "Numpad0", + "Numpad1", + "Numpad2", + "Numpad3", + "Numpad4", + "Numpad5", + "Numpad6", + "Numpad7", + "Numpad8", + "Numpad9", + "F1" , + "F2" , + "F3" , + "F4" , + "F5" , + "F6" , + "F7" , + "F8" , + "F9" , + "F10", + "F11", + "F12", + "F13", + "F14", + "F15", "Pause" };