summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2023-11-30 11:31:45 -0500
committerJonathan Bradley <jcb@pikum.xyz>2023-11-30 11:31:45 -0500
commit6e498a3781f5ccbbaa6cf5e407cf67722624760f (patch)
tree8a4e95e4d962b3102d8d348a0f292f8ef8ee30df /editor
parent9830bc2425385de6e666251fa9df6318605c639c (diff)
prefer explicit callback system over events
Diffstat (limited to 'editor')
-rw-r--r--editor/editor.cpp7
-rw-r--r--editor/editor.hpp1
-rw-r--r--editor/main.cpp11
3 files changed, 8 insertions, 11 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp
index 6f887ed..23a748f 100644
--- a/editor/editor.cpp
+++ b/editor/editor.cpp
@@ -650,25 +650,24 @@ void RecordImGuiSceneEditor() {
}
}
-void RecordImGuiEditor() {
+void PkeEditor_RecordImGui() {
if (pkeSettings.isShowingEditor) {
RecordImGuiEditorWrapper();
RecordImGuiEntityList();
RecordImGuiSceneEditor();
RecordImGuiUBO();
+ Game_RecordImGui();
}
}
void PkeEditor_Setup() {
shouldSetupEditor = false;
PkeInput_ActivateSet(debugControlsHandle);
- Event_RegisterCallback("RenderImGui", RecordImGuiEditor);
}
void PkeEditor_Disable() {
shouldDisableEditor = false;
PkeInput_DeactivateSet(debugControlsHandle);
- Event_UnregisterCallback("RenderImGui", RecordImGuiEditor);
}
void PkeEditor_Teardown() {
@@ -748,6 +747,4 @@ void PkeEditor_Init() {
ActiveCamera = &cameraDefault;
threadPoolHandle = PkeThreads_Init(1, 1);
-
- Event_RegisterCallback<TickEvent>("GAME_TICK", PkeEditor_Tick);
}
diff --git a/editor/editor.hpp b/editor/editor.hpp
index 3cfb2df..e790259 100644
--- a/editor/editor.hpp
+++ b/editor/editor.hpp
@@ -2,6 +2,7 @@
#define PKE_EDITOR_HPP
void PkeEditor_Tick(double delta);
+void PkeEditor_RecordImGui();
void PkeEditor_Init();
void PkeEditor_Setup();
void PkeEditor_Disable();
diff --git a/editor/main.cpp b/editor/main.cpp
index 7400583..54c7607 100644
--- a/editor/main.cpp
+++ b/editor/main.cpp
@@ -11,20 +11,19 @@ void signal_handler(int signal_num) {
pkeSettings.isGameRunning = false;
}
-PKEWindowProperties windowProps{};
-
int main() {
signal(SIGTERM, signal_handler);
fprintf(stdout, "PKE_EDITOR ENTERING\n");
// setup
{
pkeSettings.isShowingEditor = true;
- Event_RegisterCallback<EventHandler>("GAME_INIT", PkeEditor_Init);
-
- Event_RegisterCallback<EventHandler>("GAME_TEARDOWN", PkeEditor_Teardown);
+ pkeGameCallbacks.OnInit = PkeEditor_Init;
+ pkeGameCallbacks.OnTick = PkeEditor_Tick;
+ pkeGameCallbacks.OnTeardown = PkeEditor_Teardown;
+ pkeGameCallbacks.OnImGuiRender = PkeEditor_RecordImGui;
}
// run
- Game_Main(&windowProps);
+ Game_Main({});
fprintf(stdout, "PKE_EDITOR EXITING\n");
return 0;
}