Improvements

This commit is contained in:
2024-12-01 17:55:08 +01:00
parent 80de060002
commit 1077800334
6 changed files with 73 additions and 20 deletions

View File

@@ -92,12 +92,22 @@ generate_member_ui :: (type: *Type_Info_Struct, builder: *String_Builder, path:
}
if it.type.type == {
//case .STRUCT; {
// info_struct := cast(*Type_Info_Struct) it.type;
// generate_member_serialization(info_struct, builder, new_path);
//}
case .STRUCT; {
info_struct := cast(*Type_Info_Struct) it.type;
if info_struct.name == "Vector3" {
print_to_builder(builder, "\tui_vector_field(tprint(\"%\"), *e.%);\n", new_path, new_path);
} else {
generate_member_ui(info_struct, builder, new_path);
}
}
//case .BOOL; #through;
//case .FLOAT; #through;
case .STRING; {
print_to_builder(builder, "\tui_textfield(tprint(\"%\"), *e.%);\n", new_path, new_path);
//ui_textfield :: (label: string, text: *string, identifier: s64 = 0, loc := #caller_location) {
}
case .FLOAT; {
print_to_builder(builder, "\tui_float_field(tprint(\"%\"), *e.%);\n", new_path, new_path);
}
//case .ENUM; #through;
case .INTEGER; {
print_to_builder(builder, "\tui_int_field(tprint(\"%\"), *e.%);\n", new_path, new_path);
@@ -122,6 +132,9 @@ generate_member_serialization :: (type: *Type_Info_Struct, builder: *String_Buil
info_struct := cast(*Type_Info_Struct) it.type;
generate_member_serialization(info_struct, builder, new_path);
}
case .STRING; {
print_to_builder(builder, "\tprint_to_builder(builder, \"%: \%\\n\", e.%);\n", new_path, new_path);
}
case .BOOL; #through;
case .FLOAT; #through;
case .ENUM; #through;
@@ -147,6 +160,10 @@ generate_member_deserialization :: (type: *Type_Info_Struct, builder: *String_Bu
info_struct := cast(*Type_Info_Struct) it.type;
generate_member_deserialization(info_struct, builder, new_path);
}
case .STRING; {
print_to_builder(builder, "\t\t\t\tcase \"%\";\n", new_path);
print_to_builder(builder, "\t\t\t\tif values[1].count > 0 { e.%1 = copy_string(trim(values[1])); }\n", new_path);
}
case .BOOL; #through;
case .FLOAT; #through;
case .ENUM; #through;
@@ -428,7 +445,7 @@ generate_code :: (w: Workspace) {
add_build_string(build_string, w);
// We'll print out the added code just to show at compile-time what we are doing:
print("Adding build string:\n%\n", build_string);
//print("Adding build string:\n%\n", build_string);
}
generated_code := false;