Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit d1b0a85

Browse files
committed
Review changes and changelog entry
Also removed three lines from MetagameGUI.cpp, to be done as part of the MetagameGUI.ini in the data repo. Data pr coming soon(tm).
1 parent c385ddf commit d1b0a85

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
135135

136136
- Game window resolution can now be changed without restarting the game.
137137

138+
- GUI sliders (like for music volume) can now be adjusted with the mouse scroll wheel.
139+
138140
### Changed
139141

140142
- Codebase now uses the C++17 standard.

GUI/GUISlider.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,11 @@ void GUISlider::Create(GUIProperties *Props)
118118
Props->GetValue("Minimum", &m_Minimum);
119119
Props->GetValue("Maximum", &m_Maximum);
120120
Props->GetValue("Value", &m_Value);
121-
const bool gotValueRes = Props->GetValue("ValueResolution", &m_ValueResolution);
122-
if (!gotValueRes) {
121+
if (!Props->GetValue("ValueResolution", &m_ValueResolution)) {
123122
m_ValueResolution = std::max((m_Maximum - m_Minimum) / 100, 1);
124123
}
125124

126-
m_Value = std::clamp(m_Value, m_Minimum,m_Maximum);
125+
m_Value = std::clamp(m_Value, m_Minimum, m_Maximum);
127126

128127
// Re-Calculate the knob info
129128
CalculateKnob();
@@ -524,15 +523,16 @@ GUIPanel *GUISlider::GetPanel(void)
524523
// Description: Calculates the knob position and size.
525524

526525
void GUISlider::CalculateKnob(void) {
527-
if (!m_KnobImage)
526+
if (!m_KnobImage) {
528527
return;
528+
}
529529

530530
if (m_Maximum > m_Minimum) {
531-
const bool orientation = (m_Orientation == Horizontal);
532-
m_KnobSize = (orientation) ? m_KnobImage->GetWidth() : m_KnobImage->GetHeight();
533-
const int size = (orientation) ? m_Width : m_Height;
531+
const bool horizontalOrientation = (m_Orientation == Horizontal);
532+
m_KnobSize = (horizontalOrientation) ? m_KnobImage->GetWidth() : m_KnobImage->GetHeight();
533+
const int size = (horizontalOrientation) ? m_Width : m_Height;
534534
const float valueRatio = static_cast<float>(m_Value - m_Minimum) / static_cast<float>(m_Maximum - m_Minimum);
535-
m_KnobPosition = m_EndThickness + static_cast<int>(static_cast<float>(size - m_KnobSize - 2 * m_EndThickness) * valueRatio);
535+
m_KnobPosition = m_EndThickness + static_cast<int>(static_cast<float>(size - m_KnobSize - (m_EndThickness * 2)) * valueRatio);
536536
}
537537
}
538538

Menus/MetagameGUI.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,6 @@ int MetagameGUI::Create(Controller *pController)
546546
m_pGoldSlider = dynamic_cast<GUISlider *>(m_pGUIController->GetControl("GoldSlider"));
547547
m_pLengthLabel = dynamic_cast<GUILabel *>(m_pGUIController->GetControl("LengthLabel"));
548548
m_pLengthSlider = dynamic_cast<GUISlider *>(m_pGUIController->GetControl("LengthSlider"));
549-
m_pLengthSlider->SetMinimum(1);
550-
m_pLengthSlider->SetMaximum(20);
551-
m_pLengthSlider->SetValue(10);
552549
m_pErrorLabel = dynamic_cast<GUILabel *>(m_pGUIController->GetControl("StartErrorLabel"));
553550
m_apPlayerControlButton[Players::PlayerOne] = dynamic_cast<GUIButton *>(m_pGUIController->GetControl("P1ControlButton"));
554551
m_apPlayerControlButton[Players::PlayerTwo] = dynamic_cast<GUIButton *>(m_pGUIController->GetControl("P2ControlButton"));

0 commit comments

Comments
 (0)