summaryrefslogtreecommitdiff
path: root/editor/editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor.cpp')
-rw-r--r--editor/editor.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp
index af05781..48e5cc1 100644
--- a/editor/editor.cpp
+++ b/editor/editor.cpp
@@ -1,5 +1,7 @@
#include "editor.hpp"
+#include "editor-io.hpp"
+#include "editor-types.hpp"
#include "BulletCollision/NarrowPhaseCollision/btRaycastCallback.h"
#include "asset-manager.hpp"
@@ -16,6 +18,7 @@
#include "msdfgen.h"
#include "player-input.hpp"
#include "plugins.hpp"
+#include "project-settings.hpp"
#include "project.hpp"
#include "scene.hpp"
#include "static-ui.hpp"
@@ -54,14 +57,6 @@ const char* const dbgCtrl_ClearSelection = "debug-clear-selection";
const char* const dbgCtrl_DeleteSelectedItem = "debug-delete-selected-item";
const char* const dbgCtrl_ImGui_Toggle = "debug-imgui-toggle";
-// TODO editor state (scene vs level)
-struct editor_master {
- pke_scene *active_scene;
- pk_str target_scene_path;
- bool shouldLoadScene = false;
- bool shouldSaveScene = false;
-} editor_mstr;
-
ThreadPoolHandle threadPoolHandle = ThreadPoolHandle_MAX;
InputActionSetHandle debugControlsHandle = InputActionSetHandle_MAX;
@@ -194,7 +189,7 @@ void PkeEditor_Tick(double delta) {
} else {
sprintf(file_path, "%.16s", editor_mstr.active_scene->name);
}
- Game_SaveSceneFile(file_path);
+ pke_editor_scene_save(file_path);
shouldRebuildProjectDir = true;
}
if (editor_mstr.target_scene_path.val != nullptr) {
@@ -202,7 +197,7 @@ void PkeEditor_Tick(double delta) {
pke_scene_remove(editor_mstr.active_scene->scene_handle);
}
ActiveCamera = &NullCamera;
- Game_LoadSceneFile(editor_mstr.target_scene_path.val);
+ pke_editor_scene_load(editor_mstr.target_scene_path.val);
std::filesystem::path p(editor_mstr.target_scene_path.val);
editor_mstr.active_scene = pke_scene_get_by_name(p.stem().c_str());
if (editor_mstr.active_scene) {
@@ -318,7 +313,7 @@ void PkeEditor_Tick(double delta) {
// reinterpret_cast<void(*)()>(et->createInstanceCallback.func)();
fprintf(stderr, "[%s] Attempted to call EntityType::createInstanceCallback without a function signature", __FILE__);
} else {
- EntityType_CreateGenericInstance(et, PkeLevel_Get(pkeSettings.rt.activeLevel), nullptr);
+ EntityType_CreateGenericInstance(et, editor_mstr.active_scene, nullptr);
}
}