From 5ddca7fbac3d6e2fb16ad223cba5e2ba7f5198c0 Mon Sep 17 00:00:00 2001 From: PS Date: Sat, 27 Mar 2021 17:06:30 -0700 Subject: [PATCH] Scrollable pattern lists --- src/app/editor/interface.h | 4 +++- .../panels/foldhaus_panel_animation_timeline.h | 5 +++++ src/app/patterns/blumen_patterns.h | 15 +-------------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/app/editor/interface.h b/src/app/editor/interface.h index 1c3dfaf..54a956e 100644 --- a/src/app/editor/interface.h +++ b/src/app/editor/interface.h @@ -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) // ui_widget* ViewportLayout = ui_PushLayout(Interface, MakeString("Contents")); + ui_WidgetSetFlag(ViewportLayout, UIWidgetFlag_DrawOutline); ui_WidgetClearFlag(ViewportLayout, UIWidgetFlag_ExpandsToFitChildren); + ViewportLayout->FillDirection = LayoutDirection_TopDown; ViewportLayout->Bounds.Min.y = SliderBounds.Min.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); ui_widget_retained_state* ViewportState = ui_GetOrCreateRetainedState(Interface, ViewportLayout); 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 diff --git a/src/app/editor/panels/foldhaus_panel_animation_timeline.h b/src/app/editor/panels/foldhaus_panel_animation_timeline.h index ca30811..e1dd6b6 100644 --- a/src/app/editor/panels/foldhaus_panel_animation_timeline.h +++ b/src/app/editor/panels/foldhaus_panel_animation_timeline.h @@ -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_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++) { animation_pattern Pattern = State->Patterns.Values[i]; @@ -897,6 +901,7 @@ AnimInfoView_Render(animation_timeline_state* TimelineState, animation* ActiveAn SelectedBlock->AnimationProcHandle = Patterns_IndexToHandle(i); } } + ui_EndList(Interface); } ui_EndLabeledDropdown(Interface); } diff --git a/src/app/patterns/blumen_patterns.h b/src/app/patterns/blumen_patterns.h index d026493..152d86c 100644 --- a/src/app/patterns/blumen_patterns.h +++ b/src/app/patterns/blumen_patterns.h @@ -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++) { u32 I = LedIndex + 1; - Leds->Colors[LedIndex] = {}; - 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; - } - + Leds->Colors[LedIndex] = {0, 255, 0}; } }