mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Sim GUI: Add support for LED displays (#2138)
LED displays connect the LEDs in various ways (column major vs row major, different starting locations, serpentine connection order), so add configuration parameters for these options.
This commit is contained in:
@@ -11,6 +11,33 @@
|
||||
|
||||
namespace halsimgui {
|
||||
|
||||
/**
|
||||
* DrawLEDs() configuration for 2D arrays.
|
||||
*/
|
||||
struct LEDConfig {
|
||||
/**
|
||||
* Whether the major order is serpentined (e.g. the first row goes left to
|
||||
* right, the second row right to left, the third row left to right, and so
|
||||
* on).
|
||||
*/
|
||||
bool serpentine = false;
|
||||
|
||||
/**
|
||||
* The input array order (row-major or column-major).
|
||||
*/
|
||||
enum Order { RowMajor = 0, ColumnMajor } order = RowMajor;
|
||||
|
||||
/**
|
||||
* The starting location of the array (0 location).
|
||||
*/
|
||||
enum Start {
|
||||
UpperLeft = 0,
|
||||
LowerLeft,
|
||||
UpperRight,
|
||||
LowerRight
|
||||
} start = UpperLeft;
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw a 2D array of LEDs.
|
||||
*
|
||||
@@ -27,8 +54,10 @@ namespace halsimgui {
|
||||
* if 0, defaults to 1/2 of font size
|
||||
* @param spacing spacing between each LED (both horizontal and vertical);
|
||||
* if 0, defaults to 1/3 of font size
|
||||
* @param config 2D array configuration
|
||||
*/
|
||||
void DrawLEDs(const int* values, int numValues, int cols, const ImU32* colors,
|
||||
float size = 0.0f, float spacing = 0.0f);
|
||||
float size = 0.0f, float spacing = 0.0f,
|
||||
const LEDConfig& config = LEDConfig{});
|
||||
|
||||
} // namespace halsimgui
|
||||
|
||||
Reference in New Issue
Block a user