Custom entity fields, @Hide for entity member UI, queue
This commit is contained in:
@@ -90,6 +90,8 @@ Entity :: struct {
|
|||||||
|
|
||||||
_locator: Bucket_Locator; @DontSerialize
|
_locator: Bucket_Locator; @DontSerialize
|
||||||
scene: *Scene; @DontSerialize
|
scene: *Scene; @DontSerialize
|
||||||
|
|
||||||
|
using custom_fields: Custom_Entity_Fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_child :: (e: *Entity, child: *Entity, node_name: string = "") {
|
add_child :: (e: *Entity, child: *Entity, node_name: string = "") {
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ Vector2i :: struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vector3i :: struct {
|
Vector3i :: struct {
|
||||||
x: s32;
|
x: int;
|
||||||
y: s32;
|
y: int;
|
||||||
z: s32;
|
z: int;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color :: #type,isa Vector4;
|
Color :: #type,isa Vector4;
|
||||||
|
|||||||
30
core/queue.jai
Normal file
30
core/queue.jai
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -81,9 +81,47 @@ should_serialize :: (type: *Type_Info_Struct, member: Type_Info_Struct_Member) -
|
|||||||
return true;
|
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 = "") {
|
generate_member_ui :: (type: *Type_Info_Struct, builder: *String_Builder, path: string = "") {
|
||||||
for type.members {
|
for type.members {
|
||||||
if should_serialize(type, it) {
|
if should_make_ui(type, it) && should_serialize(type, it) {
|
||||||
new_path : string;
|
new_path : string;
|
||||||
if path.count == 0 {
|
if path.count == 0 {
|
||||||
new_path = it.name;
|
new_path = it.name;
|
||||||
|
|||||||
@@ -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;
|
Action :: action_type;
|
||||||
EDITOR :: WITH_EDITOR;
|
EDITOR :: WITH_EDITOR;
|
||||||
DEBUG :: true;
|
DEBUG :: true;
|
||||||
@@ -184,6 +185,7 @@ switch_engine_mode :: (to_mode: Engine_Mode) {
|
|||||||
#load "core/entity.jai";
|
#load "core/entity.jai";
|
||||||
#load "core/parray.jai";
|
#load "core/parray.jai";
|
||||||
#load "core/static_array.jai";
|
#load "core/static_array.jai";
|
||||||
|
#load "core/queue.jai";
|
||||||
#load "core/scene.jai";
|
#load "core/scene.jai";
|
||||||
#load "core/transform.jai";
|
#load "core/transform.jai";
|
||||||
#load "core/camera.jai";
|
#load "core/camera.jai";
|
||||||
|
|||||||
Reference in New Issue
Block a user