diff --git a/src/app/editor/foldhaus_editor.cpp b/src/app/editor/foldhaus_editor.cpp index 595d53c..39460fd 100644 --- a/src/app/editor/foldhaus_editor.cpp +++ b/src/app/editor/foldhaus_editor.cpp @@ -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)); diff --git a/src/app/editor/panels/foldhaus_panel_animation_timeline.h b/src/app/editor/panels/foldhaus_panel_animation_timeline.h index 253f42e..e9ec1c8 100644 --- a/src/app/editor/panels/foldhaus_panel_animation_timeline.h +++ b/src/app/editor/panels/foldhaus_panel_animation_timeline.h @@ -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++) diff --git a/src/app/editor/panels/foldhaus_panel_file_view.h b/src/app/editor/panels/foldhaus_panel_file_view.h index fdf8b54..8183829 100644 --- a/src/app/editor/panels/foldhaus_panel_file_view.h +++ b/src/app/editor/panels/foldhaus_panel_file_view.h @@ -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++) diff --git a/src/app/editor/panels/foldhaus_panel_profiler.h b/src/app/editor/panels/foldhaus_panel_profiler.h index d58b3fb..80b7890 100644 --- a/src/app/editor/panels/foldhaus_panel_profiler.h +++ b/src/app/editor/panels/foldhaus_panel_profiler.h @@ -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 diff --git a/src/app/interface.h b/src/app/interface.h index 785c620..c2c0b22 100644 --- a/src/app/interface.h +++ b/src/app/interface.h @@ -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); }