Skip to content

Commit

Permalink
Show field type in inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
fLindahl committed Nov 17, 2024
1 parent 4ee9362 commit 51d1e6c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion code/application/game/componentinspection.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,18 @@ InspectorDrawField(ComponentId component, void* data, bool* commit)
fieldName.CamelCaseToWords();
fieldName.Capitalize();
ImGui::TableSetColumnIndex(0);
ImGui::AlignTextToFramePadding();
ImGui::Text(fieldName.AsCharPtr());
ImGui::TableSetColumnIndex(1);
ComponentDrawFuncT<field_type>(component, (byte*)data + TYPE::Traits::field_byte_offsets[i], commit);


ImGui::SameLine();
ImGuiStyle const& style = ImGui::GetStyle();
float widthNeeded = ImGui::CalcTextSize(TYPE::Traits::field_typenames[i]).x + style.FramePadding.x * 2.f + style.ItemSpacing.x;
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - widthNeeded);
ImGui::AlignTextToFramePadding();
ImGui::TextDisabled(TYPE::Traits::field_typenames[i]);

if constexpr (i < TYPE::Traits::num_fields - 1)
{
ImGui::TableNextRow();
Expand Down

0 comments on commit 51d1e6c

Please sign in to comment.