Compiles again

This commit is contained in:
2024-10-13 00:54:26 +02:00
parent 8f2dad9cec
commit 9939c84f09
9 changed files with 172 additions and 147 deletions

View File

@@ -13,7 +13,7 @@ build :: (main_path: string, game_name: string, working_dir: string = #filepath)
opts.output_type = .EXECUTABLE;
opts.output_executable_name = game_name;
opts.output_path = "bin/";
opts.output_path = "../../bin/";
new_path: [..] string;
array_add(*new_path, ..opts.import_path);
@@ -30,6 +30,7 @@ build :: (main_path: string, game_name: string, working_dir: string = #filepath)
set_build_options(opts, w);
add_build_string(tprint("GAME_NAME :: \"%\";", game_name), w);
add_build_string("#import \"Bucket_Array\";", w);
add_build_file(main_path, w);
message_loop();
@@ -164,7 +165,6 @@ generate_serialize_procedure_for_entity :: (code_struct: *Code_Struct) {
}
note_struct :: (code_struct: *Code_Struct) {
print("Type: %\n", code_struct.defined_type.name);
if is_subclass_of(code_struct.defined_type, "Entity") {
name := code_struct.defined_type.name;
@@ -260,7 +260,7 @@ generate_code :: (w: Workspace) {
builder: String_Builder;
for entity_type_names {
print_to_builder(*builder, "new_%1 :: (scene: *Scene = null) -> *%2 { _scene := scene;\nif _scene == null { \n_scene = game_state.current_scene; }\np, locator := find_and_occupy_empty_slot(*_scene.by_type._%2); p._locator = locator; register_entity(_scene, p); p.transform = create_identity_transform(); init_entity(p); return p; }\n", to_lower_copy_new(it,, allocator=temp), it);
print_to_builder(*builder, "new_%1 :: (scene: *Scene = null) -> *%2 { _scene := scene;\nif _scene == null { \n_scene = current_scene; }\np, locator := find_and_occupy_empty_slot(*_scene.by_type._%2); p._locator = locator; register_entity(_scene, p); p.transform = create_identity_transform(); init_entity(p); return p; }\n", to_lower_copy_new(it,, allocator=temp), it);
}
add_build_string(builder_to_string(*builder), w);
@@ -308,13 +308,13 @@ serialize_entity :: (e: *Entity, path: string) {
%1
}
write_entire_file(tprint("%%/%%.ent", path, e.id), builder_to_string(*builder));
File.write_entire_file(tprint("%%/%%.ent", path, e.id), builder_to_string(*builder));
}
DONE
DESERIALIZE_ENTITY :: #string DONE
deserialize_entity :: (scene: *Scene, path: string) -> *Entity {
content := read_entire_file(path);
content := File.read_entire_file(path);
if content.count == 0 return null;
lines := split(content, "\n");