added a brightness slider to the assembly debug panel's all red, green, blue, and white modes.

This commit is contained in:
Peter Slattery 2021-02-20 14:14:39 -08:00
parent 3bc51afe73
commit 4deeb2470e
3 changed files with 58 additions and 32 deletions

View File

@ -59,8 +59,10 @@ AssemblyDebug_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Ren
ui_EndLabeledDropdown(Interface); ui_EndLabeledDropdown(Interface);
InterfaceAssert(Interface->PerFrameMemory); InterfaceAssert(Interface->PerFrameMemory);
if (State->AssemblyDebugState.Override == ADS_Override_TagWhite || switch (State->AssemblyDebugState.Override)
State->AssemblyDebugState.Override == ADS_Override_TagStripWhite) {
case ADS_Override_TagWhite:
case ADS_Override_TagStripWhite:
{ {
ui_LabeledTextEntry(Interface, MakeString("Tag Name"), &State->AssemblyDebugState.TagName); ui_LabeledTextEntry(Interface, MakeString("Tag Name"), &State->AssemblyDebugState.TagName);
ui_LabeledTextEntry(Interface, MakeString("Tag Value"), &State->AssemblyDebugState.TagValue); ui_LabeledTextEntry(Interface, MakeString("Tag Value"), &State->AssemblyDebugState.TagValue);
@ -71,8 +73,9 @@ AssemblyDebug_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Ren
State->AssemblyDebugState.TargetStrip = ui_LabeledTextEntryU64(Interface, MakeString("Strip"), State->AssemblyDebugState.TargetStrip); State->AssemblyDebugState.TargetStrip = ui_LabeledTextEntryU64(Interface, MakeString("Strip"), State->AssemblyDebugState.TargetStrip);
} }
} }break;
else if (State->AssemblyDebugState.Override == ADS_Override_ChannelWhite)
case ADS_Override_ChannelWhite:
{ {
u64 Board = 0; u64 Board = 0;
u64 Strip = 0; u64 Strip = 0;
@ -80,8 +83,17 @@ AssemblyDebug_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Ren
Strip = ui_LabeledTextEntryU64(Interface, MakeString("Strip"), Strip); Strip = ui_LabeledTextEntryU64(Interface, MakeString("Strip"), Strip);
State->AssemblyDebugState.TargetChannel = FSC(Board, Strip); State->AssemblyDebugState.TargetChannel = FSC(Board, Strip);
} }break;
else
case ADS_Override_AllRed:
case ADS_Override_AllGreen:
case ADS_Override_AllBlue:
case ADS_Override_AllWhite:
{
State->AssemblyDebugState.Brightness = (u8)ui_LabeledRangeSlider(Interface, MakeString("Brightness"), (r32)State->AssemblyDebugState.Brightness, 0, 255);
}break;
default:
{ {
InterfaceAssert(Interface->PerFrameMemory); InterfaceAssert(Interface->PerFrameMemory);
@ -92,6 +104,7 @@ AssemblyDebug_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Ren
State->AssemblyDebugState.TargetStrip = ui_LabeledTextEntryU64(Interface, MakeString("Strip"), State->AssemblyDebugState.TargetStrip); State->AssemblyDebugState.TargetStrip = ui_LabeledTextEntryU64(Interface, MakeString("Strip"), State->AssemblyDebugState.TargetStrip);
InterfaceAssert(Interface->PerFrameMemory); InterfaceAssert(Interface->PerFrameMemory);
}break;
} }
ui_RangeSlider(Interface, MakeString("Test"), .5f, 0, 1); ui_RangeSlider(Interface, MakeString("Test"), .5f, 0, 1);

View File

@ -51,6 +51,8 @@ struct assembly_debug_state
pixel TargetColor; pixel TargetColor;
u32 TargetChannel; u32 TargetChannel;
u8 Brightness;
}; };
internal assembly_debug_state internal assembly_debug_state
@ -107,6 +109,8 @@ AssemblyDebug_OverrideOutput(assembly_debug_state State, assembly_array Assembli
assembly Assembly = Assemblies.Values[State.TargetAssembly]; assembly Assembly = Assemblies.Values[State.TargetAssembly];
led_buffer LedBuffer = LedSystem.Buffers[Assembly.LedBufferIndex]; led_buffer LedBuffer = LedSystem.Buffers[Assembly.LedBufferIndex];
u8 V = State.Brightness;
switch (State.Override) switch (State.Override)
{ {
case ADS_Override_Strip: case ADS_Override_Strip:
@ -133,17 +137,17 @@ AssemblyDebug_OverrideOutput(assembly_debug_state State, assembly_array Assembli
case ADS_Override_AllRed: case ADS_Override_AllRed:
{ {
AssemblyDebug_OverrideWithColor(Assembly, LedBuffer, pixel{255, 0, 0}); AssemblyDebug_OverrideWithColor(Assembly, LedBuffer, pixel{V, 0, 0});
}break; }break;
case ADS_Override_AllGreen: case ADS_Override_AllGreen:
{ {
AssemblyDebug_OverrideWithColor(Assembly, LedBuffer, pixel{0, 255, 0}); AssemblyDebug_OverrideWithColor(Assembly, LedBuffer, pixel{0, V, 0});
}break; }break;
case ADS_Override_AllBlue: case ADS_Override_AllBlue:
{ {
AssemblyDebug_OverrideWithColor(Assembly, LedBuffer, pixel{0, 0, 255}); AssemblyDebug_OverrideWithColor(Assembly, LedBuffer, pixel{0, 0, V});
}break; }break;
case ADS_Override_AllOff: case ADS_Override_AllOff:
@ -153,7 +157,7 @@ AssemblyDebug_OverrideOutput(assembly_debug_state State, assembly_array Assembli
case ADS_Override_AllWhite: case ADS_Override_AllWhite:
{ {
AssemblyDebug_OverrideWithColor(Assembly, LedBuffer, pixel{255, 255, 255}); AssemblyDebug_OverrideWithColor(Assembly, LedBuffer, pixel{V, V, V});
}break; }break;
case ADS_Override_TagWhite: case ADS_Override_TagWhite:

View File

@ -1564,6 +1564,15 @@ ui_LabeledToggle(ui_interface* Interface, gs_string Label, bool Value)
return Result; return Result;
} }
internal r32
ui_LabeledRangeSlider(ui_interface* Interface, gs_string Label, r32 Value, r32 ValueMin, r32 ValueMax)
{
ui_BeginLabelRow(Interface, Label);
r32 Result = ui_RangeSlider(Interface, Label, Value, ValueMin, ValueMax);
ui_EndRow(Interface);
return Result;
}
internal void internal void
ui_LabeledTextEntry(ui_interface* Interface, gs_string Label, gs_string* Value) ui_LabeledTextEntry(ui_interface* Interface, gs_string Label, gs_string* Value)
{ {