summary refs log tree commit diff stats
path: root/src/menu_system.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2021-03-13 13:10:47 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2021-03-13 15:34:50 -0500
commit8a7d87a312b3dc42877577e99533c96d48714368 (patch)
treed68d614ba817237e347e0982afdae17b7b54e197 /src/menu_system.cpp
parentfce37403bbc29521b2b5bd983291b3730f8ad7b4 (diff)
downloadtanetane-8a7d87a312b3dc42877577e99533c96d48714368.tar.gz
tanetane-8a7d87a312b3dc42877577e99533c96d48714368.tar.bz2
tanetane-8a7d87a312b3dc42877577e99533c96d48714368.zip
Added sliders to the settings menu
#7
Diffstat (limited to 'src/menu_system.cpp')
-rw-r--r--src/menu_system.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/menu_system.cpp b/src/menu_system.cpp index 7ac8af5..e1aca8d 100644 --- a/src/menu_system.cpp +++ b/src/menu_system.cpp
@@ -54,6 +54,12 @@ void MenuSystem::openPauseMenu() {
54 MenuBuilder().Command("Settings") 54 MenuBuilder().Command("Settings")
55 .ActivationFunction([this] (Game&) { 55 .ActivationFunction([this] (Game&) {
56 openSubmenu(Menu({ 56 openSubmenu(Menu({
57 MenuBuilder().Slider("Music Volume: ")
58 .InitialValue(10)
59 .MaxValue(10),
60 MenuBuilder().Slider("Sound Volume: ")
61 .InitialValue(10)
62 .MaxValue(10),
57 MenuBuilder().Command("Back") 63 MenuBuilder().Command("Back")
58 .ActivationFunction([this] (Game& game) { 64 .ActivationFunction([this] (Game& game) {
59 closePauseMenu(); 65 closePauseMenu();
@@ -122,6 +128,28 @@ void MenuSystem::pressedDown() {
122 game_.getMixer().playSound("../res/sfx/vertical_menu.wav"); 128 game_.getMixer().playSound("../res/sfx/vertical_menu.wav");
123} 129}
124 130
131void MenuSystem::pressedLeft() {
132 Menu& curMenu = menus_.back();
133 MenuItem& menuItem = curMenu.getItems()[curMenu.getCursorPosition()];
134
135 if (menuItem.type == MenuType::Slider && menuItem.value > 0) {
136 menuItem.value--;
137
138 game_.getMixer().playSound("../res/sfx/horizontal_menu.wav");
139 }
140}
141
142void MenuSystem::pressedRight() {
143 Menu& curMenu = menus_.back();
144 MenuItem& menuItem = curMenu.getItems()[curMenu.getCursorPosition()];
145
146 if (menuItem.type == MenuType::Slider && menuItem.value < menuItem.maxValue) {
147 menuItem.value++;
148
149 game_.getMixer().playSound("../res/sfx/horizontal_menu.wav");
150 }
151}
152
125void MenuSystem::activateOption() { 153void MenuSystem::activateOption() {
126 Menu& curMenu = menus_.back(); 154 Menu& curMenu = menus_.back();
127 const MenuItem& menuItem = curMenu.getItems()[curMenu.getCursorPosition()]; 155 const MenuItem& menuItem = curMenu.getItems()[curMenu.getCursorPosition()];