diff --git a/Aeon/Aeon.cpp b/Aeon/Aeon.cpp index e2fc6d1..4260ffa 100644 --- a/Aeon/Aeon.cpp +++ b/Aeon/Aeon.cpp @@ -5,11 +5,11 @@ #include "Aeon/Rendering/ImGui.hpp" -using Aeon::Core::App; -using Aeon::Core::Display; -using Aeon::Core::DisplayProperties; +using Core::App; +using Core::Display; +using Core::DisplayProperties; -using Aeon::Input::Input; +using Input::Input; App::App( const AppProperties& props, const DisplayProperties& dispProps ) : mDisplay() diff --git a/Aeon/Aeon.hpp b/Aeon/Aeon.hpp index 6ace866..0ae89d2 100644 --- a/Aeon/Aeon.hpp +++ b/Aeon/Aeon.hpp @@ -9,7 +9,7 @@ #include "Aeon/Core/GameLayer.hpp" #include "Aeon/Input/Input.hpp" -namespace Aeon::Core { +namespace Core { // NOTE: Derivations / children of "App" cannot attatch // event listeners to themselves, the programmer must @@ -39,7 +39,7 @@ public: private: Display mDisplay; - Aeon::Input::Input mInput; + Input mInput; // Game layers from z orderxko285132046 std::vector mGameLayers; diff --git a/Aeon/Core/Display.cpp b/Aeon/Core/Display.cpp index 6e7cd3c..0fcf906 100644 --- a/Aeon/Core/Display.cpp +++ b/Aeon/Core/Display.cpp @@ -5,7 +5,7 @@ #include "Aeon/Assert.hpp" #include "Aeon/Rendering/ImGui.hpp" -using Aeon::Core::Display; +using Core::Display; Display::Display() : mWindow( nullptr ) @@ -58,7 +58,7 @@ bool Display::Create( const DisplayProperties& properties ) mWidth = properties.Width; mHeight = properties.Height; - Aeon::Rendering::SetupImGui( mWindow, mContext ); + Rendering::SetupImGui( mWindow, mContext ); // Make sure ImGUI is ready to be used on the first frame ImGui_ImplOpenGL3_NewFrame(); @@ -113,7 +113,7 @@ void Display::EndFrame() void Display::Destroy() { - Aeon::Rendering::CleanupImGui(); + Rendering::CleanupImGui(); SDL_DestroyWindow( mWindow ); // dangly balls mWindow = nullptr; diff --git a/Aeon/Core/Display.hpp b/Aeon/Core/Display.hpp index f455a2a..e6d8e93 100644 --- a/Aeon/Core/Display.hpp +++ b/Aeon/Core/Display.hpp @@ -11,7 +11,9 @@ extern "C" { #include "Aeon/Core/EngineConfig.hpp" #include "Aeon/Core/Events.hpp" -namespace Aeon::Core { +class Rendering::Rendermaster; + +namespace Core { class Display : public EventListener { @@ -39,6 +41,8 @@ private: SDL_Window* mWindow; SDL_GLContext mContext; + + unsigned int mWidth, mHeight; unsigned int mX, mY; float mClearColour[4]; diff --git a/Aeon/Core/EngineConfig.hpp b/Aeon/Core/EngineConfig.hpp index 5f838de..b29c005 100644 --- a/Aeon/Core/EngineConfig.hpp +++ b/Aeon/Core/EngineConfig.hpp @@ -1,7 +1,7 @@ #ifndef AEON_CORE_ENGINECONFIG_H_ #define AEON_CORE_ENGINECONFIG_H_ -namespace Aeon::Core +namespace Core { // TODO: this diff --git a/Aeon/Core/Events.cpp b/Aeon/Core/Events.cpp index 55e32e8..dbb6ca5 100644 --- a/Aeon/Core/Events.cpp +++ b/Aeon/Core/Events.cpp @@ -2,10 +2,10 @@ #include "Aeon/Assert.hpp" -using Aeon::Core::GenericEvent; -using Aeon::Core::EventListener; -using Aeon::Core::EventDispatcher; -using Aeon::Core::EventManager; +using Core::GenericEvent; +using Core::EventListener; +using Core::EventDispatcher; +using Core::EventManager; EventListener::EventListener() { diff --git a/Aeon/Core/Events.hpp b/Aeon/Core/Events.hpp index fbb5187..394ba0d 100644 --- a/Aeon/Core/Events.hpp +++ b/Aeon/Core/Events.hpp @@ -22,7 +22,7 @@ #include "Aeon/Singleton.hpp" #include "Aeon/Input/InputMap.hpp" -namespace Aeon::Core { +namespace Core { /* * Engine event systems / type @@ -74,7 +74,7 @@ struct GenericEvent int dx, dy; // KEYBOARD_KEYDOWN KEYBOARD_KEYUP KEYBOARD_PRESSED - Aeon::Input::EKeyCode keyCode; + Input::EKeyCode keyCode; uint16_t keyMods; bool Handled = false; @@ -131,7 +131,7 @@ private: friend class EventManager; }; -class EventManager : public Aeon::Helpers::Singleton +class EventManager : public Helpers::Singleton { public: EventManager(); diff --git a/Aeon/Core/GameLayer.hpp b/Aeon/Core/GameLayer.hpp index db56666..b12f6c9 100644 --- a/Aeon/Core/GameLayer.hpp +++ b/Aeon/Core/GameLayer.hpp @@ -3,7 +3,7 @@ #include "Aeon/Core/Events.hpp" -namespace Aeon::Core +namespace Core { class GameLayer : public EventListener diff --git a/Aeon/Input/Input.cpp b/Aeon/Input/Input.cpp index af08238..23a4ea7 100644 --- a/Aeon/Input/Input.cpp +++ b/Aeon/Input/Input.cpp @@ -10,7 +10,7 @@ #include "Aeon/Input/InputMap.hpp" #include "Aeon/Rendering/ImGui.hpp" -using Aeon::Input::Input; +using Input::Input; Input::Input() : mEvent() @@ -96,7 +96,7 @@ void Input::mPollDisplay() } case SDL_WINDOWEVENT_MOVED: { - Aeon::Core::GenericEvent e; + Core::GenericEvent e; e.x = mEvent.window.data1; e.y = mEvent.window.data2; e.Type = "DISPLAY_MOVE"; @@ -105,7 +105,7 @@ void Input::mPollDisplay() } case SDL_WINDOWEVENT_RESIZED: { - Aeon::Core::GenericEvent e; + Core::GenericEvent e; e.x = mEvent.window.data1; e.y = mEvent.window.data2; e.Type = "DISPLAY_RESIZE"; @@ -152,7 +152,7 @@ void Input::mPollDisplay() void Input::mPollMouse() { - Aeon::Core::GenericEvent e; + Core::GenericEvent e; e.x = mEvent.motion.x; e.y = mEvent.motion.y; e.dx = mEvent.motion.xrel; @@ -163,7 +163,7 @@ void Input::mPollMouse() void Input::mPollScroll() { - Aeon::Core::GenericEvent e; + Core::GenericEvent e; e.y = mEvent.wheel.y; e.Type = "MOUSE_SCROLL"; mMouseEventDispatcher.Dispatch( e ); @@ -218,7 +218,7 @@ void Input::mPollClick() void Input::mPollKeyboard() { EKeyCode keycode = KeyCodeFromSDL( mEvent.key.keysym.sym ); - Aeon::Core::GenericEvent e; + Core::GenericEvent e; e.keyCode = KeyCodeFromSDL(keycode); if ( mEvent.key.state == SDL_PRESSED ) { @@ -247,7 +247,7 @@ void Input::mPollScanKeyboard() { EKeyCode whatKeyPressed = KeyCodeFromScanCode( (SDL_Scancode)i ); - Aeon::Core::GenericEvent e; + Core::GenericEvent e; e.keyCode = whatKeyPressed; e.keyMods = mModKeyState; e.Type = "KEYBOARD_KEYPRESS"; diff --git a/Aeon/Input/Input.hpp b/Aeon/Input/Input.hpp index 35f24ca..4cfbba4 100644 --- a/Aeon/Input/Input.hpp +++ b/Aeon/Input/Input.hpp @@ -8,7 +8,7 @@ #include "Aeon/Singleton.hpp" #include "Aeon/Core/Events.hpp" -namespace Aeon::Input { +namespace Input { class Input { @@ -33,9 +33,9 @@ private: const uint8_t* mKbdState; uint16_t mModKeyState = 0x0; - Aeon::Core::EventDispatcher mDisplayEventDispatcher; - Aeon::Core::EventDispatcher mKeyboardEventDispatcher; - Aeon::Core::EventDispatcher mMouseEventDispatcher; + Core::EventDispatcher mDisplayEventDispatcher; + Core::EventDispatcher mKeyboardEventDispatcher; + Core::EventDispatcher mMouseEventDispatcher; }; } diff --git a/Aeon/Input/InputMap.hpp b/Aeon/Input/InputMap.hpp index 8f695bd..c0d956e 100644 --- a/Aeon/Input/InputMap.hpp +++ b/Aeon/Input/InputMap.hpp @@ -3,7 +3,7 @@ #include -namespace Aeon::Input +namespace Input { enum EModCode { diff --git a/Aeon/Rendering/Device/OpenGL/Shader.hpp b/Aeon/Rendering/Device/OpenGL/New File similarity index 100% rename from Aeon/Rendering/Device/OpenGL/Shader.hpp rename to Aeon/Rendering/Device/OpenGL/New File diff --git a/Aeon/Rendering/ImGui.hpp b/Aeon/Rendering/ImGui.hpp index 6bd40c3..3ba2de4 100644 --- a/Aeon/Rendering/ImGui.hpp +++ b/Aeon/Rendering/ImGui.hpp @@ -12,7 +12,7 @@ extern "C" { #include #include -namespace Aeon::Rendering +namespace Rendering { inline void SetupImGui( const SDL_Window* window, const SDL_GLContext& context ) diff --git a/Aeon/Rendering/RenderMaster.hpp b/Aeon/Rendering/RenderMaster.hpp index dbc5273..3715193 100644 --- a/Aeon/Rendering/RenderMaster.hpp +++ b/Aeon/Rendering/RenderMaster.hpp @@ -3,10 +3,10 @@ #include "Aeon/Singleton.hpp" -namespace Aeon::Rendering +namespace Rendering { -class RenderMaster : public Aeon::Helpers::Singleton +class RenderMaster : public Helpers::Singleton { }; diff --git a/Aeon/Rendering/Renderable.hpp b/Aeon/Rendering/Renderable.hpp new file mode 100644 index 0000000..139597f --- /dev/null +++ b/Aeon/Rendering/Renderable.hpp @@ -0,0 +1,2 @@ + + diff --git a/Aeon/Singleton.hpp b/Aeon/Singleton.hpp index e905bd5..5ae6774 100644 --- a/Aeon/Singleton.hpp +++ b/Aeon/Singleton.hpp @@ -1,7 +1,7 @@ #ifndef AEON_SINGLETON_H_ #define AEON_SINGLETON_H_ -namespace Aeon::Helpers { +namespace Helpers { template class Singleton diff --git a/Game/ExampleGame.cpp b/Game/ExampleGame.cpp index f51222e..1f16131 100644 --- a/Game/ExampleGame.cpp +++ b/Game/ExampleGame.cpp @@ -3,21 +3,21 @@ #include #include -class BackgroundLevel : public Aeon::Core::GameLayer { +class BackgroundLevel : public Core::GameLayer { }; -class Level : public Aeon::Core::GameLayer +class Level : public Core::GameLayer { public: Level() - { - PushThisAsSink("ENGINE_INPUT_KEYBOARD"); - Aeon::Core::EventManager::GetInstance().DebugPrint(); + { + Core::EventManager::GetInstance().DebugPrint(); } void Attach() override { + } void FrameTick() override @@ -30,13 +30,8 @@ public: } - bool EventRecieved( Aeon::Core::GenericEvent& e ) override + bool EventRecieved( Core::GenericEvent& e ) override { - std::cout << "FROM LEVEL " << e.Type << " " << (char)e.keyCode << std::endl; - - if ( e.keyMods & Aeon::Input::EModCode::SHIFT ) { - std::cout << "Shift" << std::endl; - } return false; } @@ -47,14 +42,14 @@ public: } }; -class ExampleGame : public Aeon::Core::App +class ExampleGame : public Core::App { public: ExampleGame() : App( { "Example" }, { "Game with AEON!" } ) { Level* level = new Level; - PushLayer( (Aeon::Core::GameLayer*)level ); + PushLayer( (Core::GameLayer*)level ); Run(); delete level; }