mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
[glass] Split DataSource into type-specific variants (#7588)
This commit is contained in:
@@ -75,14 +75,14 @@ void DisplayDIOImpl(DIOModel* model, int index, bool outputsEnabled) {
|
||||
dioData->LabelText(label, "unknown");
|
||||
ImGui::PopStyleColor();
|
||||
} else if (model->IsReadOnly()) {
|
||||
dioData->LabelText(
|
||||
label, "%s",
|
||||
outputsEnabled ? (dioData->GetValue() != 0 ? "1 (high)" : "0 (low)")
|
||||
: "1 (disabled)");
|
||||
dioData->LabelText(label, "%s",
|
||||
outputsEnabled
|
||||
? (dioData->GetValue() ? "1 (high)" : "0 (low)")
|
||||
: "1 (disabled)");
|
||||
|
||||
} else {
|
||||
static const char* options[] = {"0 (low)", "1 (high)"};
|
||||
int val = dioData->GetValue() != 0 ? 1 : 0;
|
||||
int val = dioData->GetValue() ? 1 : 0;
|
||||
if (dioData->Combo(label, &val, options, 2)) {
|
||||
model->SetValue(val);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <imgui.h>
|
||||
#include <imgui_internal.h>
|
||||
|
||||
#include "glass/Context.h"
|
||||
#include "glass/DataSource.h"
|
||||
|
||||
using namespace glass;
|
||||
|
||||
@@ -58,7 +58,7 @@ void glass::DisplayRelay(RelayModel* model, int index, bool outputsEnabled) {
|
||||
IM_COL32(128, 128, 128, 255)};
|
||||
int values[2] = {reverseData ? (reverse ? 2 : -2) : -3,
|
||||
forwardData ? (forward ? 1 : -1) : -3};
|
||||
DataSource* sources[2] = {reverseData, forwardData};
|
||||
BooleanSource* sources[2] = {reverseData, forwardData};
|
||||
DrawLEDSources(values, sources, 2, 2, colors);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user