mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[glass] Add more widgets (#2947)
This adds the following widgets: - Speed Controller - Gyroscope - Command - Subsystem - PIDController - Scheduler
This commit is contained in:
committed by
GitHub
parent
581b7ec553
commit
27b67deca6
32
glass/src/lib/native/cpp/other/Subsystem.cpp
Normal file
32
glass/src/lib/native/cpp/other/Subsystem.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "glass/other/Subsystem.h"
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include "glass/Context.h"
|
||||
#include "glass/DataSource.h"
|
||||
|
||||
using namespace glass;
|
||||
|
||||
void glass::DisplaySubsystem(SubsystemModel* m) {
|
||||
if (auto name = m->GetName()) {
|
||||
ImGui::Text("%s", name);
|
||||
ImGui::Separator();
|
||||
}
|
||||
if (m->Exists()) {
|
||||
std::string defaultCommand = m->GetDefaultCommand();
|
||||
std::string currentCommand = m->GetCurrentCommand();
|
||||
ImGui::Text("%s", ("Default Command: " + defaultCommand).c_str());
|
||||
ImGui::Text("%s", ("Current Command: " + currentCommand).c_str());
|
||||
} else {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(96, 96, 96, 255));
|
||||
ImGui::Text("Unknown Subsystem");
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user