Made entity hierarchy more compact

This commit is contained in:
Simon Lübeß
2024-03-17 18:08:39 +01:00
parent 96609a6c31
commit 2dd826fc36
3 changed files with 15 additions and 3 deletions
@@ -648,9 +648,11 @@ namespace GlitchyEditor.EditWindows
ImGui.EndDragDropTarget(); ImGui.EndDragDropTarget();
} }
if (ImGui.BeginTable("entityTable", 2, .RowBg | .NoBordersInBody | .SizingFixedFit)) ImGui.PushStyleVar(.FramePadding, float2(0, 0));
if (ImGui.BeginTable("entityTable", 2, .RowBg | .SizingFixedFit | .NoPadInnerX))
{ {
ImGui.TableSetupColumn("", .IndentDisable | .NoResize); ImGui.TableSetupColumn("Visibility", .IndentDisable | .NoResize);
ImGui.TableSetupColumn("Entities", .IndentEnable | .WidthStretch); ImGui.TableSetupColumn("Entities", .IndentEnable | .WidthStretch);
for(var child in root.Children) for(var child in root.Children)
@@ -660,6 +662,8 @@ namespace GlitchyEditor.EditWindows
ImGui.EndTable(); ImGui.EndTable();
} }
ImGui.PopStyleVar(1);
} }
/// Shows a list of entities that match the search query. /// Shows a list of entities that match the search query.
@@ -667,7 +671,9 @@ namespace GlitchyEditor.EditWindows
{ {
List<StringView> searchTokens = scope .(searchString.Split(' ', .RemoveEmptyEntries)); List<StringView> searchTokens = scope .(searchString.Split(' ', .RemoveEmptyEntries));
if (ImGui.BeginTable("entityTable", 2, .RowBg | .NoBordersInBody | .SizingFixedFit)) ImGui.PushStyleVar(.FramePadding, float2(0, 0));
if (ImGui.BeginTable("entityTable", 2, .RowBg | .SizingFixedFit | .NoPadInnerX))
{ {
ImGui.TableSetupColumn("Visibility", .IndentDisable | .NoResize); ImGui.TableSetupColumn("Visibility", .IndentDisable | .NoResize);
ImGui.TableSetupColumn("Entities", .IndentEnable | .WidthStretch); ImGui.TableSetupColumn("Entities", .IndentEnable | .WidthStretch);
@@ -706,6 +712,7 @@ namespace GlitchyEditor.EditWindows
ImGui.EndTable(); ImGui.EndTable();
} }
ImGui.PopStyleVar(1);
} }
/// Shows the entity hierarchy either as tree or as filtered list. /// Shows the entity hierarchy either as tree or as filtered list.
@@ -78,6 +78,8 @@ namespace ImGui
return IsItemActive(); return IsItemActive();
}*/ }*/
public static void PushStyleVar(StyleVar styleVar, float2 value) => PushStyleVar(styleVar, (Vec2)value);
// TODO: Color-functions // TODO: Color-functions
public static bool ColorEdit3(char* label, ref ColorRGB col, ColorEditFlags flags = (ColorEditFlags) 0) => ColorEdit3Impl(label, *(float[3]*)&col, flags); public static bool ColorEdit3(char* label, ref ColorRGB col, ColorEditFlags flags = (ColorEditFlags) 0) => ColorEdit3Impl(label, *(float[3]*)&col, flags);
public static bool ColorEdit3(char* label, ref ColorRGBA col, ColorEditFlags flags = (ColorEditFlags) 0) => ColorEdit3Impl(label, *(float[3]*)&col, flags); public static bool ColorEdit3(char* label, ref ColorRGBA col, ColorEditFlags flags = (ColorEditFlags) 0) => ColorEdit3Impl(label, *(float[3]*)&col, flags);
+3
View File
@@ -126,9 +126,12 @@ namespace GlitchyEngine.ImGui
style.FrameRounding = 4; style.FrameRounding = 4;
style.TabRounding = 8; style.TabRounding = 8;
style.ScrollbarSize = 20; style.ScrollbarSize = 20;
style.ScrollbarRounding = 3;
style.WindowMinSize = ImGui.Vec2(100, 100); style.WindowMinSize = ImGui.Vec2(100, 100);
style.SeparatorTextAlign = ImGui.Vec2(0.5f, 0.5f);
colors[(.)ImGui.Col.WindowBg] = ImGui.Vec4(0.118f, 0.118f, 0.118f, 1.00f); colors[(.)ImGui.Col.WindowBg] = ImGui.Vec4(0.118f, 0.118f, 0.118f, 1.00f);
colors[(.)ImGui.Col.FrameBg] = ImGui.Vec4(0.289f, 0.387f, 0.533f, 1.00f); colors[(.)ImGui.Col.FrameBg] = ImGui.Vec4(0.289f, 0.387f, 0.533f, 1.00f);
colors[(.)ImGui.Col.MenuBarBg] = ImGui.Vec4(0.21f, 0.21f, 0.21f, 1.00f); colors[(.)ImGui.Col.MenuBarBg] = ImGui.Vec4(0.21f, 0.21f, 0.21f, 1.00f);