ui_DrawString -> ui_Label

This commit is contained in:
PS 2020-11-14 23:44:06 -08:00
parent 1db26150ba
commit 50b6980bec
5 changed files with 23 additions and 21 deletions

View File

@ -241,7 +241,7 @@ Editor_Render(app_state* State, context* Context, render_command_buffer* RenderB
PushRenderOrthographic(RenderBuffer, State->WindowBounds);
PushRenderClearScreen(RenderBuffer);
#if 1
#if 0
TestRender(State, Context, RenderBuffer);
//ui_widget_id IdTwo = TestRender(State, Context, RenderBuffer);
//Assert(ui_WidgetIdsEqual(IdOne, IdTwo));

View File

@ -798,7 +798,7 @@ AnimInfoView_Render(animation_timeline_state* TimelineState, rect2 Bounds, rende
ui_StartRow(&State->Interface, 2);
{
ui_DrawString(Interface, MakeString("Active Animation"));
ui_Label(Interface, MakeString("Active Animation"));
if (ui_BeginDropdown(Interface, ActiveAnim->Name))
{
for (u32 i = 0; i < AnimSystem->Animations.Count; i++)

View File

@ -96,7 +96,7 @@ FileView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* RenderBu
}
// Header
ui_DrawString(&State->Interface, FileViewState->WorkingDirectory);
ui_Label(&State->Interface, FileViewState->WorkingDirectory);
// File Display
for (u32 i = 0; i < FileViewState->FileNames.Count; i++)

View File

@ -84,7 +84,7 @@ RenderProfiler_ScopeVisualization(ui_interface* Interface, ui_widget* Layout, de
PrintF(&String, "%S : %d - %d", HotRecordName->Name, HotRecord->StartCycles, HotRecord->EndCycles);
rect2 TextBounds = MakeRect2MinDim(Interface->Mouse.Pos, v2{256, 32});
ui_DrawString(Interface, String, TextBounds);
ui_Label(Interface, String, TextBounds);
}
}
@ -97,11 +97,11 @@ RenderProfiler_ListVisualization(ui_interface* Interface, ui_widget* Layout, deb
r32 ColumnWidths[] = {256, 128, 128, 128, 128};
ui_StartRow(Interface, 5, &ColumnWidths[0]);
{
ui_DrawString(Interface, MakeString("Procedure"));
ui_DrawString(Interface, MakeString("% Frame"));
ui_DrawString(Interface, MakeString("Seconds"));
ui_DrawString(Interface, MakeString("Cycles"));
ui_DrawString(Interface, MakeString("Calls"));
ui_Label(Interface, MakeString("Procedure"));
ui_Label(Interface, MakeString("% Frame"));
ui_Label(Interface, MakeString("Seconds"));
ui_Label(Interface, MakeString("Cycles"));
ui_Label(Interface, MakeString("Calls"));
}
ui_EndRow(Interface);
@ -115,19 +115,19 @@ RenderProfiler_ListVisualization(ui_interface* Interface, ui_widget* Layout, deb
ui_StartRow(Interface, 5, &ColumnWidths[0]);
{
PrintF(&String, "%S", NameEntry.Name);
ui_DrawString(Interface, String);
ui_Label(Interface, String);
PrintF(&String, "%f%%", CollatedRecord->PercentFrameTime);
ui_DrawString(Interface, String);
ui_Label(Interface, String);
PrintF(&String, "%fs", CollatedRecord->TotalSeconds);
ui_DrawString(Interface, String);
ui_Label(Interface, String);
PrintF(&String, "%dcy", CollatedRecord->TotalCycles);
ui_DrawString(Interface, String);
ui_Label(Interface, String);
PrintF(&String, "%d", CollatedRecord->CallCount);
ui_DrawString(Interface, String);
ui_Label(Interface, String);
}
ui_EndRow(Interface);
}
@ -187,10 +187,10 @@ ProfilerView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Rend
s64 FrameTotalCycles = VisibleFrame->FrameEndCycles - VisibleFrame->FrameStartCycles;
u32 CurrentDebugFrame = GlobalDebugServices->CurrentDebugFrame - 1;
PrintF(&String, "Frame %d", CurrentDebugFrame);
ui_DrawString(&State->Interface, String);
ui_Label(&State->Interface, String);
PrintF(&String, "Total Cycles: %lld", FrameTotalCycles);
ui_DrawString(&State->Interface, String);
ui_Label(&State->Interface, String);
// NOTE(NAME): Skipping a space for aesthetic reasons, not functional, and could
// be removed, or used for something else

View File

@ -666,19 +666,20 @@ ui_OutlineRect(ui_interface* Interface, rect2 Bounds, r32 Thickness, v4 Color)
}
internal void
ui_DrawString(ui_interface* Interface, gs_string String, rect2 Bounds, gs_string_alignment Alignment = Align_Left)
ui_Label(ui_interface* Interface, gs_string String, rect2 Bounds, gs_string_alignment Alignment = Align_Left)
{
DEBUG_TRACK_FUNCTION;
ui_widget* Widget = ui_CreateWidget(Interface, String);
Widget->Bounds = Bounds;
ui_EvaluateWidget(Interface, Widget);
ui_WidgetSetFlag(Widget, UIWidgetFlag_DrawString);
ui_EvaluateWidget(Interface, Widget, Bounds);
}
internal void
ui_DrawString(ui_interface* Interface, gs_string String, gs_string_alignment Alignment = Align_Left)
ui_Label(ui_interface* Interface, gs_string String, gs_string_alignment Alignment = Align_Left)
{
DEBUG_TRACK_FUNCTION;
ui_widget* Widget = ui_CreateWidget(Interface, String);
ui_WidgetSetFlag(Widget, UIWidgetFlag_DrawString);
ui_EvaluateWidget(Interface, Widget);
}
@ -756,7 +757,8 @@ internal bool
ui_EvaluateDropdown(ui_interface* Interface, ui_widget* Widget, ui_eval_result EvalResult)
{
ui_widget_retained_state* State = ui_GetRetainedState(Interface, Widget->Id);
if (!State) {
if (!State)
{
State = ui_CreateRetainedState(Interface, Widget);
}