5
5
#include " glass/other/FMS.h"
6
6
7
7
#include < imgui.h>
8
+ #include < imgui_stdlib.h>
8
9
#include < wpi/SmallString.h>
9
10
10
11
#include " glass/DataSource.h"
@@ -58,8 +59,7 @@ void glass::DisplayFMS(FMSModel* model, bool editableDsAttached) {
58
59
if (auto data = model->GetMatchTimeData ()) {
59
60
double val = data->GetValue ();
60
61
ImGui::SetNextItemWidth (ImGui::GetFontSize () * 8 );
61
- if (ImGui::InputDouble (" Match Time" , &val, 0 , 0 , " %.1f" ,
62
- ImGuiInputTextFlags_EnterReturnsTrue)) {
62
+ if (ImGui::InputDouble (" Match Time" , &val, 0 , 0 , " %.1f" )) {
63
63
model->SetMatchTime (val);
64
64
}
65
65
data->EmitDrag ();
@@ -78,16 +78,12 @@ void glass::DisplayFMS(FMSModel* model, bool editableDsAttached) {
78
78
}
79
79
80
80
// Game Specific Message
81
- // make buffer full 64 width, null terminated, for editability
82
- wpi::SmallString<64 > gameSpecificMessage;
83
- model->GetGameSpecificMessage (gameSpecificMessage);
84
- gameSpecificMessage.resize (63 );
85
- gameSpecificMessage.push_back (' \0 ' );
81
+ wpi::SmallString<64 > gameSpecificMessageBuf;
82
+ std::string gameSpecificMessage{
83
+ model->GetGameSpecificMessage (gameSpecificMessageBuf)};
86
84
ImGui::SetNextItemWidth (ImGui::GetFontSize () * 8 );
87
- if (ImGui::InputText (" Game Specific" , gameSpecificMessage.data (),
88
- gameSpecificMessage.size (),
89
- ImGuiInputTextFlags_EnterReturnsTrue)) {
90
- model->SetGameSpecificMessage (gameSpecificMessage.data ());
85
+ if (ImGui::InputText (" Game Specific" , &gameSpecificMessage)) {
86
+ model->SetGameSpecificMessage (gameSpecificMessage);
91
87
}
92
88
}
93
89
@@ -151,9 +147,10 @@ void glass::DisplayFMSReadOnly(FMSModel* model) {
151
147
}
152
148
}
153
149
154
- wpi::SmallString<64 > gameSpecificMessage;
155
- model->GetGameSpecificMessage (gameSpecificMessage);
156
- ImGui::Text (" Game Specific: %s" , exists ? gameSpecificMessage.c_str () : " ?" );
150
+ wpi::SmallString<64 > gameSpecificMessageBuf;
151
+ std::string_view gameSpecificMessage =
152
+ model->GetGameSpecificMessage (gameSpecificMessageBuf);
153
+ ImGui::Text (" Game Specific: %s" , exists ? gameSpecificMessage.data () : " ?" );
157
154
158
155
if (!exists) {
159
156
ImGui::PopStyleColor ();
0 commit comments