Clean-up and deinit proc

This commit is contained in:
2025-06-21 16:48:25 +02:00
parent 201a7ee742
commit 788775b0f3
6 changed files with 84 additions and 22 deletions

View File

@@ -532,8 +532,13 @@ message_loop :: () {
array_add(*deinit_entity_procs, struct_type.name);
} else {
for note: it.expression.notes {
if to_lower_copy(note.text,, allocator = temp) == "newentity" {
array_add(*new_entity_procs, it.expression.name);
if to_lower_copy(note.text,, temp) == {
case "newentity"; {
array_add(*new_entity_procs, it.expression.name);
}
case "engineinit"; {
array_add(*engine_init_procs, it.expression.name);
}
}
}
}
@@ -597,6 +602,17 @@ generate_code :: (w: Workspace) {
add_build_string(build_string, w, message);
}
{
builder: String_Builder;
for engine_init_procs {
print_to_builder(*builder, "%();", it);
}
build_string := sprint(RUN_ENGINE_INIT, builder_to_string(*builder));
add_build_string(build_string, w, message);
}
{
builder: String_Builder;
@@ -708,6 +724,7 @@ generate_code :: (w: Workspace) {
generated_code := false;
entity_type_names: [..] string;
new_entity_procs: [..] string;
engine_init_procs: [..] string;
deinit_entity_procs: [..] string;
// INSERTION_STRING represents the code we want to add to the target program.
@@ -815,6 +832,12 @@ init_scene :: (scene: *Scene) {
}
DONE
RUN_ENGINE_INIT :: #string DONE
run_engine_inits :: () {
%1
}
DONE
EDITOR_UI_ENTITY_CREATION :: #string DONE
#if EDITOR {
@@ -835,6 +858,7 @@ PLACEHOLDER :: #string DONE
#poke_name Coven serialize_entity;
#poke_name Coven new_mesh_entity;
#poke_name Coven call_correct_deinit_entity;
#poke_name Coven run_engine_inits;
#if EDITOR {
#poke_name Coven editor_ui_entity_creation;