Skip to content

Commit e7f1d3b

Browse files
committed
Remove usage of SavedVar.Get()
1 parent 603db5f commit e7f1d3b

5 files changed

Lines changed: 35 additions & 35 deletions

File tree

Applications/Dice/Dice.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ void Dice::Settings() {
102102

103103
UIButton rollingColorSelectorBtn;
104104
rollingColorSelectorBtn.SetName("Rolling Color");
105-
rollingColorSelectorBtn.SetColorFunc([&]() -> Color { return rolling_rainbow_mode ? ColorEffects::Rainbow() : rolling_color.Get(); });
105+
rollingColorSelectorBtn.SetColorFunc([&]() -> Color { return rolling_rainbow_mode ? ColorEffects::Rainbow() : rolling_color; });
106106
rollingColorSelectorBtn.SetSize(Dimension(1, 4));
107107
rollingColorSelectorBtn.OnPress([&]() -> void {
108108
if (!rolling_rainbow_mode)
109109
{
110-
MatrixOS::UIUtility::ColorPicker(rolling_color.Get());
110+
MatrixOS::UIUtility::ColorPicker(rolling_color);
111111
rolling_color.Save();
112112
}
113113
});
@@ -123,19 +123,19 @@ void Dice::Settings() {
123123

124124
UIButton rollingUnderglowEffectMenuBtn;
125125
rollingUnderglowEffectMenuBtn.SetName("Rolling Underglow Effect");
126-
rollingUnderglowEffectMenuBtn.SetColorFunc([&]() -> Color { return ApplyColorEffect(rolling_rainbow_mode ? ColorEffects::Rainbow() : rolling_color.Get(), rolling_underglow_mode, rolling_underglow_effect_period, timestamp); });
126+
rollingUnderglowEffectMenuBtn.SetColorFunc([&]() -> Color { return ApplyColorEffect(rolling_rainbow_mode ? ColorEffects::Rainbow() : rolling_color, rolling_underglow_mode, rolling_underglow_effect_period, timestamp); });
127127
rollingUnderglowEffectMenuBtn.OnPress([&]() -> void { UnderglowEffectModeAndSpeedMenu(Rolling); });
128128
rollingUnderglowEffectMenuBtn.SetEnabled(underglow_enabled);
129129
settingsUI.AddUIComponent(rollingUnderglowEffectMenuBtn, Point(0, 7));
130130

131131
UIButton confirmedColorSelectorBtn;
132132
confirmedColorSelectorBtn.SetName("Confirmed Color");
133-
confirmedColorSelectorBtn.SetColorFunc([&]() -> Color { return confirmed_rainbow_mode ? ColorEffects::Rainbow() : confirmed_color.Get(); });
133+
confirmedColorSelectorBtn.SetColorFunc([&]() -> Color { return confirmed_rainbow_mode ? ColorEffects::Rainbow() : confirmed_color; });
134134
confirmedColorSelectorBtn.SetSize(Dimension(1, 4));
135135
confirmedColorSelectorBtn.OnPress([&]() -> void {
136136
if (!confirmed_rainbow_mode)
137137
{
138-
MatrixOS::UIUtility::ColorPicker(confirmed_color.Get());
138+
MatrixOS::UIUtility::ColorPicker(confirmed_color);
139139
confirmed_color.Save();
140140
}
141141
});
@@ -151,7 +151,7 @@ void Dice::Settings() {
151151

152152
UIButton confirmedUnderglowEffectMenuBtn;
153153
confirmedUnderglowEffectMenuBtn.SetName("Confirmed Underglow Effect");
154-
confirmedUnderglowEffectMenuBtn.SetColorFunc([&]() -> Color { return ApplyColorEffect(confirmed_rainbow_mode ? ColorEffects::Rainbow() : confirmed_color.Get(), confirmed_underglow_mode, confirmed_underglow_effect_period, timestamp); });
154+
confirmedUnderglowEffectMenuBtn.SetColorFunc([&]() -> Color { return ApplyColorEffect(confirmed_rainbow_mode ? ColorEffects::Rainbow() : confirmed_color, confirmed_underglow_mode, confirmed_underglow_effect_period, timestamp); });
155155
confirmedUnderglowEffectMenuBtn.OnPress([&]() -> void { UnderglowEffectModeAndSpeedMenu(Confirmed); });
156156
confirmedUnderglowEffectMenuBtn.SetEnabled(underglow_enabled);
157157
settingsUI.AddUIComponent(confirmedUnderglowEffectMenuBtn, Point(7, 7));
@@ -377,7 +377,7 @@ Color Dice::ApplyColorEffect(Color color, UnderglowEffectMode effect, uint16_t p
377377
}
378378

379379
void Dice::DotFaceSelector() {
380-
int32_t dot_faces_num = dot_faces.Get();
380+
int32_t dot_faces_num = dot_faces;
381381
int32_t selector_dot_faces = dot_faces_num - 2;
382382
UI dotFaceSelector("Face Selector", Color(0x00FFFF));
383383

@@ -409,14 +409,14 @@ void Dice::UnderglowEffectModeAndSpeedMenu(DicePhase phase) {
409409

410410
if (phase == Rolling)
411411
{
412-
color = rolling_color.Get();
412+
color = rolling_color;
413413
rainbow = rolling_rainbow_mode;
414414
period = rolling_underglow_effect_period;
415415
effectMode = rolling_underglow_mode;
416416
}
417417
else if (phase == Confirmed)
418418
{
419-
color = confirmed_color.Get();
419+
color = confirmed_color;
420420
rainbow = confirmed_rainbow_mode;
421421
period = confirmed_underglow_effect_period;
422422
effectMode = confirmed_underglow_mode;

Applications/Lighting/Lighting.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@ void Lighting::Update()
2424
{
2525
case RGB:
2626
{
27-
uint16_t period = 60000 / rgb_effect_bpm.Get(); // Convert BPM to period in ms
28-
Color color = ApplyColorEffect(this->color.Get(), rgb_effect, period, start_time);
27+
uint16_t period = 60000 / rgb_effect_bpm; // Convert BPM to period in ms
28+
Color color = ApplyColorEffect(this->color, rgb_effect, period, start_time);
2929
Render(color);
3030
break;
3131
}
3232
case Temperature:
3333
{
34-
uint16_t period = 60000 / temperature_effect_bpm.Get(); // Convert BPM to period in ms
34+
uint16_t period = 60000 / temperature_effect_bpm; // Convert BPM to period in ms
3535
Color color = ApplyColorEffect(temperature_color, temperature_effect, period, start_time);
3636
Render(color);
3737
break;
3838
}
3939
// case Animation:
4040
// {
41-
// Color color = GetAnimationColor(animation.Get(), start_time);
41+
// Color color = GetAnimationColor(animation, start_time);
4242
// Render(color);
4343
// break;
4444
// }
@@ -144,14 +144,14 @@ void Lighting::Settings() {
144144
colorBtn.SetName("Color");
145145
colorBtn.SetColorFunc([&]() -> Color { return color; });
146146
colorBtn.SetSize(Dimension(8,2));
147-
colorBtn.OnPress([&]() -> void { if(MatrixOS::UIUtility::ColorPicker(color.Get())) { color.Save(); } });
147+
colorBtn.OnPress([&]() -> void { if(MatrixOS::UIUtility::ColorPicker(color)) { color.Save(); } });
148148
colorBtn.SetEnableFunc([&]() -> bool { return mode == RGB; });
149149
settingsUI.AddUIComponent(colorBtn, Point(0, 6));
150150

151151
// Mode & Speed
152152
UIButton rgbEffectBtn;
153153
rgbEffectBtn.SetName("Effect & Speed");
154-
rgbEffectBtn.SetColorFunc([&]() -> Color { return ApplyColorEffect(color, rgb_effect, 60000 / rgb_effect_bpm.Get(), start_time); });
154+
rgbEffectBtn.SetColorFunc([&]() -> Color { return ApplyColorEffect(color, rgb_effect, 60000 / rgb_effect_bpm, start_time); });
155155
rgbEffectBtn.OnPress([&]() -> void { EffectModeAndSpeedMenu(RGB); });
156156
rgbEffectBtn.SetEnableFunc([&]() -> bool { return mode == RGB; });
157157
rgbEffectBtn.SetSize(Dimension(1, 2));
@@ -163,14 +163,14 @@ void Lighting::Settings() {
163163
temperatureBtn.SetName("Temperature");
164164
temperatureBtn.SetColorFunc([&]() -> Color { return temperature_color; });
165165
temperatureBtn.SetSize(Dimension(8,2));
166-
temperatureBtn.OnPress([&]() -> void { if(MatrixOS::UIUtility::TemperatureColorPicker(temperature_color.Get())) { temperature_color.Save(); } });
166+
temperatureBtn.OnPress([&]() -> void { if(MatrixOS::UIUtility::TemperatureColorPicker(temperature_color)) { temperature_color.Save(); } });
167167
temperatureBtn.SetEnableFunc([&]() -> bool { return mode == Temperature; });
168168
settingsUI.AddUIComponent(temperatureBtn, Point(0, 6));
169169

170170
// Mode & Speed
171171
UIButton temperatureEffectBtn;
172172
temperatureEffectBtn.SetName("Effect & Speed");
173-
temperatureEffectBtn.SetColorFunc([&]() -> Color { return ApplyColorEffect(temperature_color, temperature_effect, 60000 / temperature_effect_bpm.Get(), start_time); });
173+
temperatureEffectBtn.SetColorFunc([&]() -> Color { return ApplyColorEffect(temperature_color, temperature_effect, 60000 / temperature_effect_bpm, start_time); });
174174
temperatureEffectBtn.OnPress([&]() -> void { EffectModeAndSpeedMenu(Temperature); });
175175
temperatureEffectBtn.SetEnableFunc([&]() -> bool { return mode == Temperature; });
176176
temperatureEffectBtn.SetSize(Dimension(1, 2));
@@ -215,11 +215,11 @@ void Lighting::EffectModeAndSpeedMenu(LightingMode mode)
215215

216216
if(mode == RGB)
217217
{
218-
color = this->color.Get();
218+
color = this->color;
219219
}
220220
else if(mode == Temperature)
221221
{
222-
color = temperature_color.Get();
222+
color = temperature_color;
223223
}
224224

225225
UI effectUI("Effect Mode", Color(color), true);

Applications/Note/Note.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void Note::Setup(const vector<string>& args) {
4040
// Initialize runtimes
4141
for(uint8_t i = 0; i < 2; i++)
4242
{
43-
runtimes[i].config = &notePadConfigs[(activeConfig.Get() == 0) ? i : (1 - i)];
43+
runtimes[i].config = &notePadConfigs[(activeConfig == 0) ? i : (1 - i)];
4444
runtimes[i].arpeggiator = Arpeggiator(&runtimes[i].config->arpConfig);
4545
runtimes[i].midiPipeline.AddEffect("NoteLatch", &runtimes[i].noteLatch);
4646
runtimes[i].noteLatch.SetEnabled(false);
@@ -111,7 +111,7 @@ void Note::Setup(const vector<string>& args) {
111111
UIButton notepad1SelectBtn;
112112
notepad1SelectBtn.SetName("Note Pad 1");
113113
notepad1SelectBtn.SetSize(Dimension(2, 1));
114-
notepad1SelectBtn.SetColorFunc([&]() -> Color { return notePadConfigs[0].color.DimIfNot(activeConfig.Get() == 0); });
114+
notepad1SelectBtn.SetColorFunc([&]() -> Color { return notePadConfigs[0].color.DimIfNot(activeConfig == 0); });
115115
notepad1SelectBtn.OnPress([&]() -> void {
116116
activeConfig = 0;
117117
runtimes[0].config = &notePadConfigs[0];
@@ -122,7 +122,7 @@ void Note::Setup(const vector<string>& args) {
122122
UIButton notepad2SelectBtn;
123123
notepad2SelectBtn.SetName("Note Pad 2");
124124
notepad2SelectBtn.SetSize(Dimension(2, 1));
125-
notepad2SelectBtn.SetColorFunc([&]() -> Color { return notePadConfigs[1].color.DimIfNot(activeConfig.Get() == 1); });
125+
notepad2SelectBtn.SetColorFunc([&]() -> Color { return notePadConfigs[1].color.DimIfNot(activeConfig == 1); });
126126
notepad2SelectBtn.OnPress([&]() -> void {
127127
activeConfig = 1;
128128
runtimes[0].config = &notePadConfigs[1];
@@ -251,17 +251,17 @@ void Note::PlayView() {
251251

252252

253253
// Update runtime config pointers based on activeConfig
254-
runtimes[0].config = &notePadConfigs[activeConfig.Get() == 1];
255-
runtimes[1].config = &notePadConfigs[activeConfig.Get() == 0];
254+
runtimes[0].config = &notePadConfigs[(activeConfig == 1) ? 1 : 0];
255+
runtimes[1].config = &notePadConfigs[(activeConfig == 0) ? 1 : 0];
256256

257257
NotePad notePad1(padSize, &runtimes[0]);
258258
playView.AddUIComponent(notePad1, Point(0, 0));
259259

260-
UnderglowLight underglow1(underglowSize, notePadConfigs[activeConfig.Get() == 1].color);
260+
UnderglowLight underglow1(underglowSize, notePadConfigs[(activeConfig == 1) ? 1 : 0].color);
261261
playView.AddUIComponent(underglow1, Point(-1, -1));
262262

263263
NotePad notePad2(padSize, &runtimes[1]);
264-
UnderglowLight underglow2(underglowSize, notePadConfigs[activeConfig.Get() == 0].color);
264+
UnderglowLight underglow2(underglowSize, notePadConfigs[(activeConfig == 0) ? 1 : 0].color);
265265

266266
if (splitView == VERT_SPLIT) {
267267
playView.AddUIComponent(notePad2, Point(4, 0));
@@ -955,7 +955,7 @@ void Note::ArpConfigMenu() {
955955
bpmTextDisplay.SetEnableFunc([&]() -> bool { return page == ARP_BPM; });
956956
arpConfigMenu.AddUIComponent(bpmTextDisplay, Point(0, 2));
957957

958-
int32_t bpmValue = bpm.Get();
958+
int32_t bpmValue = bpm;
959959

960960
UI4pxNumber bpmDisplay;
961961
bpmDisplay.SetColor(arpConfigColor[ARP_BPM]);

Applications/Note/NoteControlBar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void NoteControlBar::SwapActiveConfig() {
2222
if(notePad[1]) {
2323
notePad[1]->SetPadRuntime(padData1);
2424
}
25-
note->activeConfig = note->activeConfig.Get() == 0 ? 1 : 0;
25+
note->activeConfig = note->activeConfig == 0 ? 1 : 0;
2626
if(underglow[0]) {
2727
underglow[0]->SetColor(notePad[0]->rt->config->color);
2828
}

Applications/Reversi/Reversi.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ bool Reversi::ResetGame(bool confirmed)
548548

549549
firstPlayer.Load(); // For some reason, the firstPlayer is not auto loaded correctly
550550

551-
uint8_t secondPlayer = (firstPlayer.Get() == 1) ? 2 : 1;
551+
uint8_t secondPlayer = (firstPlayer == 1) ? 2 : 1;
552552

553553
board[3][3].player = firstPlayer;
554554
board[3][3].wasPlayer = firstPlayer;
@@ -625,26 +625,26 @@ void Reversi::Settings() {
625625
player1ColorSelector.SetName("Player 1 Color");
626626
player1ColorSelector.SetColorFunc([&]() -> Color { return player1Color; });
627627
player1ColorSelector.SetSize(Dimension(8,1));
628-
player1ColorSelector.OnPress([&]() -> void { if(MatrixOS::UIUtility::ColorPicker(player1Color.Get())) { player1Color.Save(); } });
628+
player1ColorSelector.OnPress([&]() -> void { if(MatrixOS::UIUtility::ColorPicker(player1Color)) { player1Color.Save(); } });
629629
settingsUI.AddUIComponent(player1ColorSelector, Point(0, 7));
630630

631631
UIButton player2ColorSelector;
632632
player2ColorSelector.SetName("Player 2 Color");
633633
player2ColorSelector.SetColorFunc([&]() -> Color { return player2Color; });
634634
player2ColorSelector.SetSize(Dimension(8,1));
635-
player2ColorSelector.OnPress([&]() -> void { if(MatrixOS::UIUtility::ColorPicker(player2Color.Get())) { player2Color.Save(); } });
635+
player2ColorSelector.OnPress([&]() -> void { if(MatrixOS::UIUtility::ColorPicker(player2Color)) { player2Color.Save(); } });
636636
settingsUI.AddUIComponent(player2ColorSelector, Point(0, 0));
637637

638638
UIButton player1FirstHand;
639639
player1FirstHand.SetName("Player 1 First Hand");
640-
player1FirstHand.SetColorFunc([&]() -> Color { return Color(0xFFFFFF).DimIfNot(firstPlayer.Get() == 1); });
641-
player1FirstHand.OnPress([&]() -> void { if(firstPlayer.Get() == 1) {return;} if (gameState == Ended || !started || ConfirmMenu()) { firstPlayer = 1; ResetGame(true);} });
640+
player1FirstHand.SetColorFunc([&]() -> Color { return Color(0xFFFFFF).DimIfNot(firstPlayer == 1); });
641+
player1FirstHand.OnPress([&]() -> void { if(firstPlayer == 1) {return;} if (gameState == Ended || !started || ConfirmMenu()) { firstPlayer = 1; ResetGame(true);} });
642642
settingsUI.AddUIComponent(player1FirstHand, Point(7, 6));
643643

644644
UIButton player2FirstHand;
645645
player2FirstHand.SetName("Player 2 First Hand");
646-
player2FirstHand.SetColorFunc([&]() -> Color { return Color(0xFFFFFF).DimIfNot(firstPlayer.Get() == 2); });
647-
player2FirstHand.OnPress([&]() -> void { if(firstPlayer.Get() == 2) {return;} if (gameState == Ended || !started || ConfirmMenu()) { firstPlayer = 2; ResetGame(true);} });
646+
player2FirstHand.SetColorFunc([&]() -> Color { return Color(0xFFFFFF).DimIfNot(firstPlayer == 2); });
647+
player2FirstHand.OnPress([&]() -> void { if(firstPlayer == 2) {return;} if (gameState == Ended || !started || ConfirmMenu()) { firstPlayer = 2; ResetGame(true);} });
648648
settingsUI.AddUIComponent(player2FirstHand, Point(0, 1));
649649

650650
UIToggle hintToggle;

0 commit comments

Comments
 (0)