clean up after debugging lights

This commit is contained in:
Peter Slattery 2021-02-06 14:25:43 -08:00
parent 45f0b39679
commit 63d204364a
3 changed files with 28 additions and 8 deletions

View File

@ -43,9 +43,14 @@ HierarchyView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Ren
ui_PushLayout(&State->Interface, PanelBounds, LayoutDirection_TopDown, MakeString("Hierarchy Layout")); ui_PushLayout(&State->Interface, PanelBounds, LayoutDirection_TopDown, MakeString("Hierarchy Layout"));
ui_BeginList(&State->Interface, MakeString("Hierarchy List"), 10, State->Assemblies.Count + 1); ui_BeginList(&State->Interface, MakeString("Hierarchy List"), 10, State->Assemblies.Count + 1);
{ {
ui_BeginRow(&State->Interface, 2); ui_column_spec Cols[2] = {
ui_column_spec{ UIColumnSize_Fill, 0 },
ui_column_spec{ UIColumnSize_MaxWidth, 128 }
};
for (u32 i = 0; i < State->Assemblies.Count; i++) for (u32 i = 0; i < State->Assemblies.Count; i++)
{ {
ui_BeginRow(&State->Interface, 2, &Cols[0]);
assembly Assembly = State->Assemblies.Values[i]; assembly Assembly = State->Assemblies.Values[i];
PrintF(&TempString, "%S", Assembly.Name); PrintF(&TempString, "%S", Assembly.Name);
@ -54,8 +59,12 @@ HierarchyView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Ren
{ {
UnloadAssembly(i, State, Context); UnloadAssembly(i, State, Context);
} }
ui_EndRow(&State->Interface);
} }
ui_BeginRow(&State->Interface, 2, &Cols[0]);
ui_Label(&State->Interface, MakeString(" ")); ui_Label(&State->Interface, MakeString(" "));
if (ui_Button(&State->Interface, MakeString("+ Add Assembly"))) if (ui_Button(&State->Interface, MakeString("+ Add Assembly")))
{ {
@ -63,7 +72,6 @@ HierarchyView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Ren
FileView_SetMode(FileBrowser, FileViewMode_Save); FileView_SetMode(FileBrowser, FileViewMode_Save);
Panel_PushModalOverride(Panel, FileBrowser, LoadAssemblyCallback); Panel_PushModalOverride(Panel, FileBrowser, LoadAssemblyCallback);
} }
ui_EndRow(&State->Interface); ui_EndRow(&State->Interface);
} }
ui_EndList(&State->Interface); ui_EndList(&State->Interface);

View File

@ -6,7 +6,7 @@
#ifndef FOLDHAUS_UART_CPP #ifndef FOLDHAUS_UART_CPP
internal uart_header* internal void
UART_SetChannelBuffer_Create(gs_memory_cursor* WriteCursor, uart_channel ChannelSettings, v2_strip Strip, led_buffer LedBuffer) UART_SetChannelBuffer_Create(gs_memory_cursor* WriteCursor, uart_channel ChannelSettings, v2_strip Strip, led_buffer LedBuffer)
{ {
// NOTE(pjs): This is just here because the information is duplicated and I want to be sure // NOTE(pjs): This is just here because the information is duplicated and I want to be sure
@ -48,8 +48,6 @@ UART_SetChannelBuffer_Create(gs_memory_cursor* WriteCursor, uart_channel Channel
uart_footer* Footer = PushStructOnCursor(WriteCursor, uart_footer); uart_footer* Footer = PushStructOnCursor(WriteCursor, uart_footer);
UART_FillFooter(Footer, (u8*)Header); UART_FillFooter(Footer, (u8*)Header);
return Header;
} }
internal void internal void
@ -167,9 +165,7 @@ UART_BuildOutputData(addressed_data_buffer_list* Output, assembly_array Assembli
v2_strip StripAt = Assembly.Strips[StripIdx]; v2_strip StripAt = Assembly.Strips[StripIdx];
ChannelSettings.PixelsCount = StripAt.LedCount; ChannelSettings.PixelsCount = StripAt.LedCount;
uart_header* Header = UART_SetChannelBuffer_Create(&WriteCursor, ChannelSettings, StripAt, *LedBuffer); UART_SetChannelBuffer_Create(&WriteCursor, ChannelSettings, StripAt, *LedBuffer);
//At->Header[i] = Header;
} }
UART_DrawAll_Create(&WriteCursor); UART_DrawAll_Create(&WriteCursor);

View File

@ -847,6 +847,7 @@ enum ui_column_size_rule
UIColumnSize_Fixed, UIColumnSize_Fixed,
UIColumnSize_Percent, UIColumnSize_Percent,
UIColumnSize_Fill, UIColumnSize_Fill,
UIColumnSize_MaxWidth,
}; };
struct ui_column_spec struct ui_column_spec
@ -893,6 +894,20 @@ ui_BeginRow(ui_interface* Interface, u32 ColumnsMax, ui_column_spec* ColumnRules
{ {
FillColumnsCount += 1; FillColumnsCount += 1;
}break; }break;
case UIColumnSize_MaxWidth:
{
if (RemainingSpace >= Spec.Width)
{
Column->XMax = Spec.Width;
}
else
{
Column->XMax = RemainingSpace;
}
RemainingSpace -= Column->XMax;
}break;
InvalidDefaultCase; InvalidDefaultCase;
} }
} }
@ -911,6 +926,7 @@ ui_BeginRow(ui_interface* Interface, u32 ColumnsMax, ui_column_spec* ColumnRules
{ {
case UIColumnSize_Fixed: case UIColumnSize_Fixed:
case UIColumnSize_Percent: case UIColumnSize_Percent:
case UIColumnSize_MaxWidth:
{ {
ColumnWidth = Column->XMax; ColumnWidth = Column->XMax;
}break; }break;