diff --git a/SakuraVNE/src/AppLayer.cpp b/SakuraVNE/src/AppLayer.cpp index c4aa74d..cf64c51 100644 --- a/SakuraVNE/src/AppLayer.cpp +++ b/SakuraVNE/src/AppLayer.cpp @@ -1,8 +1,13 @@ #include "AppLayer.h" #include "Application.h" +#include "Event.h" +#include "InputEvents.h" #include "Layer.h" +#include "Log.h" #include "TestLayer.h" +#include "WindowEvents.h" #include "imgui.h" +#include AppLayer::AppLayer() : Layer("AppLayer", true) {} @@ -14,7 +19,7 @@ void AppLayer::OnImGuiRender() { ImGui::Text("Application avg %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); if (ImGui::Button("Quit")) { - Application::Get().SetRunningState(false); + SakuraVNE::Application::Get().SetRunningState(false); } ImGui::End(); @@ -24,3 +29,15 @@ void AppLayer::OnImGuiRender() { } ImGui::End(); } + +void AppLayer::OnEvent(SakuraVNE::Event &event) { + LOG_INFO("{}", event.ToString()); + SakuraVNE::EventDispatcher dispatcher(event); + dispatcher.Dispatch([this](SakuraVNE::MouseButtonPressedEvent &e) { return OnMouseButtonPressed(e); }); + dispatcher.Dispatch([this](SakuraVNE::MouseMovedEvent &e) { return OnMouseMoved(e); }); + dispatcher.Dispatch([this](SakuraVNE::WindowClosedEvent &e) { return OnWindowClosed(e); }); +} + +bool AppLayer::OnMouseButtonPressed(SakuraVNE::MouseButtonPressedEvent &event) { return false; } +bool AppLayer::OnMouseMoved(SakuraVNE::MouseMovedEvent &event) { return false; } +bool AppLayer::OnWindowClosed(SakuraVNE::WindowClosedEvent &event) { return false; } diff --git a/SakuraVNE/src/AppLayer.h b/SakuraVNE/src/AppLayer.h index 1a5ab8b..f30b64a 100644 --- a/SakuraVNE/src/AppLayer.h +++ b/SakuraVNE/src/AppLayer.h @@ -1,13 +1,18 @@ +#include "Event.h" +#include "InputEvents.h" #include "Layer.h" +#include "WindowEvents.h" class AppLayer : public SakuraVNE::Layer { public: AppLayer(); virtual ~AppLayer() = default; virtual void OnImGuiRender() override; + virtual void OnEvent(SakuraVNE::Event &event) override; private: - // bool OnMouseButtonPressed(Core::MouseButtonPressedEvent &event); - // bool OnMouseMoved(Core::MouseMovedEvent &event); - // bool OnWindowClosed(Core::WindowClosedEvent &event); + bool OnMouseButtonPressed(SakuraVNE::MouseButtonPressedEvent &event); + bool OnMouseMoved(SakuraVNE::MouseMovedEvent &event); + bool OnWindowClosed(SakuraVNE::WindowClosedEvent &event); + int m_ClickCounter = 0; }; diff --git a/SakuraVNE/src/Overlay.cpp b/SakuraVNE/src/Overlay.cpp index f3f0cb8..37d92a2 100644 --- a/SakuraVNE/src/Overlay.cpp +++ b/SakuraVNE/src/Overlay.cpp @@ -12,11 +12,11 @@ void Overlay::OnImGuiRender() { ImGui::Begin("Overlay Transition"); if (ImGui::Button("Overlay Transition")) { - auto testLayer = Application::Get().GetLayer(); + auto testLayer = SakuraVNE::Application::Get().GetLayer(); if (testLayer) { testLayer->TransitionTo(); } else { - auto appLayer = Application::Get().GetLayer(); + auto appLayer = SakuraVNE::Application::Get().GetLayer(); appLayer->TransitionTo(); } } diff --git a/SakuraVNE/src/main.cpp b/SakuraVNE/src/main.cpp index cf82e68..bd8ddf0 100644 --- a/SakuraVNE/src/main.cpp +++ b/SakuraVNE/src/main.cpp @@ -3,13 +3,13 @@ #include "Overlay.h" int main(int argc, char *argv[]) { - AppData appData; + SakuraVNE::AppData appData; appData.name = "Sakura Visual Novel Creator"; appData.windowdata.title = appData.name; appData.windowdata.width = 1280; appData.windowdata.height = 720; - Application app(appData); + SakuraVNE::Application app(appData); app.PushLayer(); app.PushOverlay(); app.Run(); diff --git a/imgui.ini b/imgui.ini index c4c3920..4d08f5b 100644 --- a/imgui.ini +++ b/imgui.ini @@ -9,8 +9,8 @@ Size=311,180 Collapsed=0 [Window][Dear ImGui Demo] -Pos=592,0 -Size=688,720 +Pos=584,0 +Size=696,720 Collapsed=0 DockId=0x00000006,0 @@ -36,7 +36,7 @@ Collapsed=0 [Window][Framerate] Pos=0,0 -Size=590,364 +Size=582,364 Collapsed=0 DockId=0x00000009,0 @@ -47,19 +47,20 @@ Collapsed=0 DockId=0x00000008,0 [Window][Overlay Transition] -Pos=506,251 -Size=365,165 +Pos=272,366 +Size=310,354 Collapsed=0 +DockId=0x0000000C,0 [Window][To TestLayer Transition] Pos=0,366 -Size=590,354 +Size=270,354 Collapsed=0 -DockId=0x0000000A,0 +DockId=0x0000000B,0 [Window][To AppLayer Transition] Pos=0,0 -Size=1280,720 +Size=1280,364 Collapsed=0 DockId=0x00000009,0 @@ -134,15 +135,17 @@ Column 1 Width=86 Column 2 Width=86 [Docking][Data] -DockSpace ID=0x08BD597D Window=0x1BBC0F80 Pos=0,0 Size=1280,720 Split=Y - DockNode ID=0x00000003 Parent=0x08BD597D SizeRef=1280,101 Split=X Selected=0xAA1D0058 - DockNode ID=0x00000001 Parent=0x00000003 SizeRef=618,101 Selected=0xAA1D0058 - DockNode ID=0x00000002 Parent=0x00000003 SizeRef=660,101 Selected=0x561EDE67 - DockNode ID=0x00000004 Parent=0x08BD597D SizeRef=1280,617 Split=X - DockNode ID=0x00000005 Parent=0x00000004 SizeRef=590,724 Split=Y Selected=0x0FC82981 - DockNode ID=0x00000007 Parent=0x00000005 SizeRef=590,360 Split=Y Selected=0x0FC82981 - DockNode ID=0x00000009 Parent=0x00000007 SizeRef=590,364 CentralNode=1 Selected=0xB300D6F1 - DockNode ID=0x0000000A Parent=0x00000007 SizeRef=590,354 Selected=0x4443B0A2 - DockNode ID=0x00000008 Parent=0x00000005 SizeRef=590,358 Selected=0x5259B841 - DockNode ID=0x00000006 Parent=0x00000004 SizeRef=688,724 Selected=0x5E5F7166 +DockSpace ID=0x08BD597D Window=0x1BBC0F80 Pos=0,0 Size=1280,720 Split=Y + DockNode ID=0x00000003 Parent=0x08BD597D SizeRef=1280,101 Split=X Selected=0xAA1D0058 + DockNode ID=0x00000001 Parent=0x00000003 SizeRef=618,101 Selected=0xAA1D0058 + DockNode ID=0x00000002 Parent=0x00000003 SizeRef=660,101 Selected=0x561EDE67 + DockNode ID=0x00000004 Parent=0x08BD597D SizeRef=1280,617 Split=X + DockNode ID=0x00000005 Parent=0x00000004 SizeRef=582,724 Split=Y Selected=0x0FC82981 + DockNode ID=0x00000007 Parent=0x00000005 SizeRef=590,360 Split=Y Selected=0x0FC82981 + DockNode ID=0x00000009 Parent=0x00000007 SizeRef=590,364 CentralNode=1 Selected=0x0FC82981 + DockNode ID=0x0000000A Parent=0x00000007 SizeRef=590,354 Split=X Selected=0x4443B0A2 + DockNode ID=0x0000000B Parent=0x0000000A SizeRef=270,354 Selected=0x4443B0A2 + DockNode ID=0x0000000C Parent=0x0000000A SizeRef=310,354 Selected=0xD66F58E1 + DockNode ID=0x00000008 Parent=0x00000005 SizeRef=590,358 Selected=0x5259B841 + DockNode ID=0x00000006 Parent=0x00000004 SizeRef=696,724 Selected=0x5E5F7166 diff --git a/libs/SakuraCore b/libs/SakuraCore index 3925ccc..5b40377 160000 --- a/libs/SakuraCore +++ b/libs/SakuraCore @@ -1 +1 @@ -Subproject commit 3925ccc52029e52f6674df04aaa2b930eca9e0bd +Subproject commit 5b40377d0468ac4a9dda4b95d0ee831b378e1e5b