Scrollable pattern lists

This commit is contained in:
PS 2021-03-27 17:06:30 -07:00
parent 3f9a8dfe85
commit 5ddca7fbac
3 changed files with 9 additions and 15 deletions

View File

@ -1524,7 +1524,9 @@ ui_BeginList(ui_interface* Interface, gs_string Text, u32 ViewportRows, u32 Elem
// Create the viewport that offsets list contents (and at render time determines what is visible) // Create the viewport that offsets list contents (and at render time determines what is visible)
// //
ui_widget* ViewportLayout = ui_PushLayout(Interface, MakeString("Contents")); ui_widget* ViewportLayout = ui_PushLayout(Interface, MakeString("Contents"));
ui_WidgetSetFlag(ViewportLayout, UIWidgetFlag_DrawOutline);
ui_WidgetClearFlag(ViewportLayout, UIWidgetFlag_ExpandsToFitChildren); ui_WidgetClearFlag(ViewportLayout, UIWidgetFlag_ExpandsToFitChildren);
ViewportLayout->FillDirection = LayoutDirection_TopDown;
ViewportLayout->Bounds.Min.y = SliderBounds.Min.y; ViewportLayout->Bounds.Min.y = SliderBounds.Min.y;
ViewportLayout->Bounds.Max.y = SliderBounds.Max.y; ViewportLayout->Bounds.Max.y = SliderBounds.Max.y;
@ -1532,7 +1534,7 @@ ui_BeginList(ui_interface* Interface, gs_string Text, u32 ViewportRows, u32 Elem
s32 ScrollableElements = Max(0, ElementCount - ViewportRows); s32 ScrollableElements = Max(0, ElementCount - ViewportRows);
ui_widget_retained_state* ViewportState = ui_GetOrCreateRetainedState(Interface, ViewportLayout); ui_widget_retained_state* ViewportState = ui_GetOrCreateRetainedState(Interface, ViewportLayout);
ViewportState->ChildrenDrawOffset.x = 0; ViewportState->ChildrenDrawOffset.x = 0;
ViewportState->ChildrenDrawOffset.y = ((1.0f - State->InitialValueR32) * (r32)(ScrollableElements)) * ViewportLayout->RowHeight; ViewportState->ChildrenDrawOffset.y = ((1.0f - State->InitialValueR32) * (r32)(ScrollableElements + 1)) * ViewportLayout->RowHeight;
} }
internal void internal void

View File

@ -889,6 +889,10 @@ AnimInfoView_Render(animation_timeline_state* TimelineState, animation* ActiveAn
//if (ui_BeginLabeledDropdown(Interface, MakeString("Selected Pattern"), MakeString(BlockPattern.Name, BlockPattern.NameLength))) //if (ui_BeginLabeledDropdown(Interface, MakeString("Selected Pattern"), MakeString(BlockPattern.Name, BlockPattern.NameLength)))
if (ui_BeginDropdown(Interface, MakeString(BlockPattern.Name, BlockPattern.NameLength))) if (ui_BeginDropdown(Interface, MakeString(BlockPattern.Name, BlockPattern.NameLength)))
{ {
Interface->ActiveLayout->Bounds.Max.x += 128.0f;
Interface->ActiveLayout->Columns[0].XMax += 128.0f;
ui_BeginList(Interface, MakeString("Patterns List"), 5, State->Patterns.Count);
for (u32 i = 0; i < State->Patterns.Count; i++) for (u32 i = 0; i < State->Patterns.Count; i++)
{ {
animation_pattern Pattern = State->Patterns.Values[i]; animation_pattern Pattern = State->Patterns.Values[i];
@ -897,6 +901,7 @@ AnimInfoView_Render(animation_timeline_state* TimelineState, animation* ActiveAn
SelectedBlock->AnimationProcHandle = Patterns_IndexToHandle(i); SelectedBlock->AnimationProcHandle = Patterns_IndexToHandle(i);
} }
} }
ui_EndList(Interface);
} }
ui_EndLabeledDropdown(Interface); ui_EndLabeledDropdown(Interface);
} }

View File

@ -753,20 +753,7 @@ Pattern_AllGreen(led_buffer* Leds, led_buffer_range Range, assembly Assembly, r3
for (u32 LedIndex = Range.First; LedIndex < Range.OnePastLast; LedIndex++) for (u32 LedIndex = Range.First; LedIndex < Range.OnePastLast; LedIndex++)
{ {
u32 I = LedIndex + 1; u32 I = LedIndex + 1;
Leds->Colors[LedIndex] = {}; Leds->Colors[LedIndex] = {0, 255, 0};
if (I % 3 == 0)
{
Leds->Colors[LedIndex].R = 255;
}
else if (I % 3 == 1)
{
Leds->Colors[LedIndex].G = 255;
}
else if (I % 3 == 2)
{
Leds->Colors[LedIndex].B = 255;
}
} }
} }