From f187f9fba99a0be2623a2497711d735f70568a01 Mon Sep 17 00:00:00 2001 From: Armin <armin.co@hs-bochum.de> Date: Sun, 31 Jan 2021 12:43:59 +0100 Subject: [PATCH] Refactoring --- App/QPongApp.cpp | 9 ++------- App/Window.hpp | 4 ---- GuiCore/Application.cpp | 7 +++++-- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/App/QPongApp.cpp b/App/QPongApp.cpp index 1c6a6b7..f2953e6 100644 --- a/App/QPongApp.cpp +++ b/App/QPongApp.cpp @@ -3,17 +3,15 @@ /// #include <memory> - #include <GuiCore/Application.hpp> - #include "MainMenuLayer.hpp" #include "GameLayer.hpp" #include "Log.hpp" + class App : public GuiCore::Application { public: - App() - : Application("QPong Application") + App() : Application("QPong Application") { QPong::Log::setup(); pushLayer(std::make_shared<QPong::MainMenuLayer>()); @@ -23,9 +21,6 @@ public: int main() { std::unique_ptr<App> app = std::make_unique<App>(); - - QPong::Log::get()->info("Have fun!"); - app->run(); return 0; } \ No newline at end of file diff --git a/App/Window.hpp b/App/Window.hpp index 8935dc4..2682da4 100644 --- a/App/Window.hpp +++ b/App/Window.hpp @@ -18,14 +18,11 @@ public: virtual ~Window(); void onUpdate() override; - uint32_t getWidth() const override; uint32_t getHeight() const override; - virtual void setEventCallback(const std::function<void(GuiCore::Event&)>) override; void setVSync(bool enabled) override; bool isVSyncEnabled() const override; - void* getNativeWindow() const override; private: @@ -40,7 +37,6 @@ private: uint32_t width; uint32_t height; bool vSyncEnabled; - std::function<void(GuiCore::Event&)> eventCallback; }; Data m_data; diff --git a/GuiCore/Application.cpp b/GuiCore/Application.cpp index 7d2e737..7df6bb2 100644 --- a/GuiCore/Application.cpp +++ b/GuiCore/Application.cpp @@ -19,8 +19,11 @@ namespace GuiCore Log::setup(); s_instance = this; m_window = std::unique_ptr<IWindow>(IWindow::create({name, width, height})); - m_window->setEventCallback([this](auto &&... args) -> decltype(auto) { - return this->onEvent(std::forward<decltype(args)>(args)...); }); + m_window->setEventCallback( + [this](auto &&... args) -> decltype(auto) + { + return this->onEvent(std::forward<decltype(args)>(args)...); + }); m_guiLayer = std::make_shared<ImGuiLayer>(); pushLayer(m_guiLayer); } -- GitLab