From 1436b37f49ae9d2bf5f08a7c86fa0eadc98b5fe4 Mon Sep 17 00:00:00 2001 From: benkyd Date: Fri, 13 May 2022 15:04:00 +0000 Subject: [PATCH] ok epic --- Aeon/Aeon.cpp | 2 + CMakeLists.txt | 1 + Game/ExampleGame.cpp | 161 +------------------------------------------ 3 files changed, 6 insertions(+), 158 deletions(-) diff --git a/Aeon/Aeon.cpp b/Aeon/Aeon.cpp index 157d92f..62da020 100644 --- a/Aeon/Aeon.cpp +++ b/Aeon/Aeon.cpp @@ -24,6 +24,7 @@ void App::Run() { while ( !mSIGTERM ) { + // Should do this ONLY on update mInput.PollInput(); // tick through game layers @@ -41,6 +42,7 @@ void App::Run() } // tick through game layers *but timed* + // TODO: Timed event thread (won't allow rendering) for ( const auto& layer : mGameLayers ) { layer->TimeTick(); diff --git a/CMakeLists.txt b/CMakeLists.txt index aea3be0..7848b1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,7 @@ set(THREADS_PREFER_PTHREAD_FLAD ON) find_package(Threads REQUIRED) # Find GL and GLX package +set(OpenGL_GL_PREFERENCE GLVND) find_package(OpenGL REQUIRED) find_package(SDL2 REQUIRED) diff --git a/Game/ExampleGame.cpp b/Game/ExampleGame.cpp index 520ad32..b872e06 100644 --- a/Game/ExampleGame.cpp +++ b/Game/ExampleGame.cpp @@ -6,77 +6,8 @@ #include #include -class BottomestLevel : public Aeon::Core::GameLayer -{ -public: - BottomestLevel() - { - UnshiftThisAsSink("GAME_LOL"); - Aeon::Core::EventManager::GetInstance().DebugPrint(); - } +class BackgroundLevel : public Aeon::Core::GameLayer { - void Attach() override - { - - } - - void FrameTick() override - { - - } - - void TimeTick() override - { - - } - - bool EventRecieved(Aeon::Core::GenericEvent& e) override - { - std::cout << "FROM BOTTOMESTLEVEL " << e.System << " " << e.Type << " " << e.Data << std::endl; - return false; - } - - void Detach() override - { - - } -}; - - -class BottomLevel : public Aeon::Core::GameLayer -{ -public: - BottomLevel() - { - PushThisAsSink("GAME_LOL"); - Aeon::Core::EventManager::GetInstance().DebugPrint(); - } - - void Attach() override - { - - } - - void FrameTick() override - { - - } - - void TimeTick() override - { - - } - - bool EventRecieved(Aeon::Core::GenericEvent& e) override - { - std::cout << "FROM BOTTOMLEVEL " << e.System << " " << e.Type << " " << e.Data << std::endl; - return false; - } - - void Detach() override - { - - } }; class Level : public Aeon::Core::GameLayer @@ -84,54 +15,12 @@ class Level : public Aeon::Core::GameLayer public: Level() { - mEventDispatcher.RegisterAsSource("GAME_LOL"); - PushThisAsSink("GAME_LOL"); + PushThisAsSink("ENGINE_INPUT_KEYBOARD"); Aeon::Core::EventManager::GetInstance().DebugPrint(); } void Attach() override { - - } - - void FrameTick() override - { - mEventDispatcher.Dispatch("Lmao gottem"); - - } - - void TimeTick() override - { - - } - - bool EventRecieved( Aeon::Core::GenericEvent& e ) override - { - std::cout << "FROM LEVEL " << e.System << " " << e.Type << " " << e.Data << std::endl; - return false; - } - - void Detach() override - { - - } - - Aeon::Core::EventDispatcher mEventDispatcher; - -}; - -class TopLevel : public Aeon::Core::GameLayer -{ -public: - TopLevel() - { - PushAndStickThisAsSink("GAME_LOL"); - Aeon::Core::EventManager::GetInstance().DebugPrint(); - } - - void Attach() override - { - } void FrameTick() override @@ -146,43 +35,7 @@ public: bool EventRecieved( Aeon::Core::GenericEvent& e ) override { - std::cout << "FROM TOPLEVEL " << e.System << " " << e.Type << " " << e.Data << std::endl; - return false; - } - - void Detach() override - { - - } -}; - -class ToperLevel : public Aeon::Core::GameLayer -{ -public: - ToperLevel() - { - PushAndStickThisAsSink("GAME_LOL"); - Aeon::Core::EventManager::GetInstance().DebugPrint(); - } - - void Attach() override - { - - } - - void FrameTick() override - { - - } - - void TimeTick() override - { - - } - - bool EventRecieved(Aeon::Core::GenericEvent& e) override - { - std::cout << "FROM TOPERLEVEL " << e.System << " " << e.Type << " " << e.Data << std::endl; + std::cout << "FROM LEVEL " << e.System << " " << (char)e.keyCode << std::endl; return false; } @@ -200,16 +53,8 @@ public: ExampleGame() : App( { "Example" }, { "Game with AEON!" } ) { - BottomestLevel* bottomestLevel = new BottomestLevel; - BottomLevel* bottomLevel = new BottomLevel; Level* level = new Level; - TopLevel* topLevel = new TopLevel; - ToperLevel* toperLevel = new ToperLevel; - PushLayer( (Aeon::Core::GameLayer*)bottomestLevel ); - PushLayer( (Aeon::Core::GameLayer*)bottomLevel ); PushLayer( (Aeon::Core::GameLayer*)level ); - PushLayer( (Aeon::Core::GameLayer*)topLevel ); - PushLayer( (Aeon::Core::GameLayer*)toperLevel); Run(); delete level; }