Demos update

-added some new types to gui manager + some fixes
-TexCoordsManager now working (probably)
-added CRenderDefault components which makes entities without texcoords possible to draw
-makes better way of binding demos to launcher
-moved some registration related to rendering to one function (basic components + draw system)
-added Sandbox demo (demo which takes all demos to one demo)
-extends ParticlesDemo play area
-added BirckBreaker demo (WIP)
-added special material to additive particles
-added whole bunch of rendering code to rendering module
-added ability to show filtered entities (blinking)
This commit is contained in:
Mergul 2020-07-01 19:45:53 +02:00
parent ef4faf2755
commit b0b64b965f
12 changed files with 1122 additions and 74 deletions

View file

@ -93,9 +93,13 @@ struct GUIManager
void addSystem(ushort id, const (char)* name, bool enabled = true)
{
foreach(ref sys; systems)
{
if(sys.id == id)return;
}
System* system = launcher.manager.getSystem(id);
//const (char)* name =
systems.add(SystemGUI(name,system,enabled));
systems.add(SystemGUI(name,id,enabled));
}
void addTemplate(ushort[] components, const (char)* name)
@ -143,7 +147,23 @@ struct GUIManager
//pragma(msg,member_type);
//pragma(msg,__traits(getMember, T, member).offsetof);
ushort offset = member.offsetof;//cast(ushort)__traits(getMember, T, member).offsetof;
static if(__traits(isIntegral,member_type))
static if(is(member_type == vec2))
{
comp_edit.variables[comp_edit.used++] = VariableGUI(VariableGUI.Type.vec2,member_str,offset);
}
else static if(is(member_type == ivec2))
{
comp_edit.variables[comp_edit.used++] = VariableGUI(VariableGUI.Type.ivec2,member_str,offset);
}
else static if(is(member_type == vec4))
{
comp_edit.variables[comp_edit.used++] = VariableGUI(VariableGUI.Type.vec4,member_str,offset);
}
else static if(is(member_type == ivec4))
{
comp_edit.variables[comp_edit.used++] = VariableGUI(VariableGUI.Type.ivec4,member_str,offset);
}
else static if(__traits(isIntegral,member_type))
{
static if(__traits(isUnsigned, member_type))
{
@ -227,14 +247,15 @@ struct GUIManager
{
if(igCollapsingHeader("Systems", ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_DefaultOpen))
{
bool true_ = true;
//bool true_ = true;
igIndent(8);
foreach(ref SystemGUI system;systems)
{
if(igCheckbox(system.name,&system.enabled))
{
if(system.enabled)system.system.enable();
else system.system.disable();
System* sys = launcher.manager.getSystem(system.id);
if(system.enabled)sys.enable();
else sys.disable();
}
}
igUnindent(8);
@ -347,6 +368,18 @@ struct GUIManager
if(igColorEdit4(var.name, color.data, ImGuiColorEditFlags_None))
*cast(uint*)(data_ptr+var.offset) = colorVec4ToUint(color);
break;
case VariableGUI.Type.vec2:
igDragFloat2(var.name, (cast(float*)(data_ptr+var.offset))[0..2], 0.1, -float.max, float.max, null, 1);
break;
case VariableGUI.Type.ivec2:
igDragInt2(var.name, (cast(int*)(data_ptr+var.offset))[0..2], 0.1, int.min, int.max, null);
break;
case VariableGUI.Type.vec4:
igDragFloat4(var.name, (cast(float*)(data_ptr+var.offset))[0..4], 0.1, -float.max, float.max, null, 1);
break;
case VariableGUI.Type.ivec4:
igDragInt4(var.name, (cast(int*)(data_ptr+var.offset))[0..4], 0.1, int.min, int.max, null);
break;
default:break;
}
igPopID();
@ -359,6 +392,7 @@ struct GUIManager
void entityComponentsGUI()
{
if(selected_template >= templates.length)return;
EntityTemplate* tmpl = templates[selected_template].tmpl;
EntityManager.EntityInfo* info = tmpl.info;
foreach(comp_id; info.components)
@ -416,7 +450,7 @@ struct GUIManager
if(igIsItemHovered(0))igSetTooltip("Select component to add/remove (SHIFT + Scroll)");
}
style.Colors[ImGuiCol_Header] = col;
componentGUI(components[selected_component].component_id, components[selected_component].data);
if(selected_component < components.length)componentGUI(components[selected_component].component_id, components[selected_component].data);
break;
case Tool.selector:
break;