diff --git a/core/entity.jai b/core/entity.jai index 06baa36..019cddf 100644 --- a/core/entity.jai +++ b/core/entity.jai @@ -90,6 +90,8 @@ Entity :: struct { _locator: Bucket_Locator; @DontSerialize scene: *Scene; @DontSerialize + + using custom_fields: Custom_Entity_Fields; } add_child :: (e: *Entity, child: *Entity, node_name: string = "") { diff --git a/core/math.jai b/core/math.jai index 0608f4a..a045309 100644 --- a/core/math.jai +++ b/core/math.jai @@ -37,9 +37,9 @@ Vector2i :: struct { } Vector3i :: struct { - x: s32; - y: s32; - z: s32; + x: int; + y: int; + z: int; } Color :: #type,isa Vector4; diff --git a/core/queue.jai b/core/queue.jai new file mode 100644 index 0000000..c60970b --- /dev/null +++ b/core/queue.jai @@ -0,0 +1,30 @@ +Queue :: struct(Value_Type : Type) { + count: s64; + + values: [..] Value_Type; +} + +enqueue :: (queue: *Queue, value: queue.Value_Type) { + array_add(*queue.values, value); + queue.count = queue.values.count; +} + +dequeue :: (queue: *Queue) -> queue.Value_Type { + val : queue.Value_Type; + if queue.values.count > 0 { + val = queue.values[0]; + if queue.values.count > 1 { + memcpy(*queue.values.data[0], *queue.values.data[1], (queue.values.count - 1) * size_of(queue.Value_Type)); + } + + queue.values.count -= 1; + queue.count = queue.values.count; + } + + return val; +} + +is_queue_empty :: (queue: Queue) -> bool { + return queue.count == 0; +} + diff --git a/metaprogram.jai b/metaprogram.jai index 0c4072e..3c45a3a 100644 --- a/metaprogram.jai +++ b/metaprogram.jai @@ -81,9 +81,47 @@ should_serialize :: (type: *Type_Info_Struct, member: Type_Info_Struct_Member) - return true; } +should_make_ui :: (type: *Type_Info_Struct, member: Type_Info_Struct_Member) -> bool { + for member.notes { + if to_lower_copy_new(it,, allocator = temp) == "hide" return false; + } + + if type!= null { + if type.name == { + case "Vector2"; { + if member.name == { + case "x"; #through; + case "y"; #through; + case; return false; + } + } + case "Vector3"; { + if member.name == { + case "x"; #through; + case "y"; #through; + case "z"; return true; + case; return false; + } + } + case "Vector4"; #through; + case "Quaternion"; { + if member.name == { + case "x"; #through; + case "y"; #through; + case "z"; #through; + case "w"; return true; + case; return false; + } + } + } + } + + return true; +} + generate_member_ui :: (type: *Type_Info_Struct, builder: *String_Builder, path: string = "") { for type.members { - if should_serialize(type, it) { + if should_make_ui(type, it) && should_serialize(type, it) { new_path : string; if path.count == 0 { new_path = it.name; diff --git a/module.jai b/module.jai index 86b5fdb..62d8f56 100644 --- a/module.jai +++ b/module.jai @@ -1,5 +1,6 @@ -#module_parameters(WITH_EDITOR := true, WITH_NETWORKING := false, action_type : Type); +#module_parameters(WITH_EDITOR := true, WITH_NETWORKING := false, action_type : Type, entity_fields: Type); +Custom_Entity_Fields :: entity_fields; Action :: action_type; EDITOR :: WITH_EDITOR; DEBUG :: true; @@ -184,6 +185,7 @@ switch_engine_mode :: (to_mode: Engine_Mode) { #load "core/entity.jai"; #load "core/parray.jai"; #load "core/static_array.jai"; +#load "core/queue.jai"; #load "core/scene.jai"; #load "core/transform.jai"; #load "core/camera.jai";