new core version, using events
This commit is contained in:
@@ -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 <string>
|
||||
|
||||
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<SakuraVNE::MouseButtonPressedEvent>([this](SakuraVNE::MouseButtonPressedEvent &e) { return OnMouseButtonPressed(e); });
|
||||
dispatcher.Dispatch<SakuraVNE::MouseMovedEvent>([this](SakuraVNE::MouseMovedEvent &e) { return OnMouseMoved(e); });
|
||||
dispatcher.Dispatch<SakuraVNE::WindowClosedEvent>([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; }
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -12,11 +12,11 @@ void Overlay::OnImGuiRender() {
|
||||
|
||||
ImGui::Begin("Overlay Transition");
|
||||
if (ImGui::Button("Overlay Transition")) {
|
||||
auto testLayer = Application::Get().GetLayer<TestLayer>();
|
||||
auto testLayer = SakuraVNE::Application::Get().GetLayer<TestLayer>();
|
||||
if (testLayer) {
|
||||
testLayer->TransitionTo<AppLayer>();
|
||||
} else {
|
||||
auto appLayer = Application::Get().GetLayer<AppLayer>();
|
||||
auto appLayer = SakuraVNE::Application::Get().GetLayer<AppLayer>();
|
||||
appLayer->TransitionTo<TestLayer>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<AppLayer>();
|
||||
app.PushOverlay<Overlay>();
|
||||
app.Run();
|
||||
|
||||
41
imgui.ini
41
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
|
||||
|
||||
|
||||
Submodule libs/SakuraCore updated: 3925ccc520...5b40377d04
Reference in New Issue
Block a user