summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/editor.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp
index db97802..bb19b70 100644
--- a/editor/editor.cpp
+++ b/editor/editor.cpp
@@ -98,7 +98,8 @@ void PkeEditor_Tick(double delta) {
if (shouldRunCurrentScene) {
shouldRunCurrentScene = false;
subProgramRunning = true;
- PkeThreads_Enqueue(threadPoolHandle, std::packaged_task<void()>( [] {
+ auto *task = Pke_New<std::packaged_task<void()>>();
+ new (task) std::packaged_task<void()>( [] {
auto pid = fork();
if (pid == 0) {
int status = -1;
@@ -121,7 +122,8 @@ void PkeEditor_Tick(double delta) {
fprintf(stdout, "pke_runtime (parent) exited with a status of %i (0x%08X)\n", status, status);
subProgramRunning = false;
}
- }));
+ });
+ PkeThreads_Enqueue(threadPoolHandle, task);
}
if (shouldSetupEditor) {
PkeEditor_Setup();
@@ -144,7 +146,8 @@ void PkeEditor_Tick(double delta) {
}
if (shouldOpenLoadSceneDialog) {
shouldOpenLoadSceneDialog = false;
- PkeThreads_Enqueue(threadPoolHandle, std::packaged_task<void()>( [] {
+ auto *task = Pke_New<std::packaged_task<void()>>();
+ new (task) std::packaged_task<void()>( [] {
const char * patterns[1] = {"*.pstf"};
char *selectedScene = tinyfd_openFileDialog(nullptr, "cafebabe.pstf", 1, patterns, "Pke Scene Text File", 0);
if (selectedScene != nullptr) {
@@ -152,19 +155,22 @@ void PkeEditor_Tick(double delta) {
pkeSettings.rt.shouldLoadScene = true;
ActiveCamera = &NullCamera;
}
- }));
+ });
+ PkeThreads_Enqueue(threadPoolHandle, task);
}
if (shouldOpenSaveSceneDialog) {
shouldOpenSaveSceneDialog = false;
- PkeThreads_Enqueue(threadPoolHandle, std::packaged_task<void()>( [] {
+ auto *task = Pke_New<std::packaged_task<void()>>();
+ new (task) std::packaged_task<void()>( [] {
const char * patterns[1] = {"*.pstf"};
char *selectedScene = tinyfd_saveFileDialog(nullptr, pkeSettings.rt.sceneName, 1, patterns, "Pke Scene Text File");
if (selectedScene != nullptr) {
pkeSettings.rt.sceneName = selectedScene;
pkeSettings.rt.shouldSaveScene = true;
}
- }));
+ });
+ PkeThreads_Enqueue(threadPoolHandle, task);
}
if (pkeSettings.rt.shouldSaveScene && pkeSettings.rt.sceneName) {
pkeSettings.rt.shouldSaveScene = false;