summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2021-03-13 09:41:52 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2021-03-13 15:34:50 -0500
commit7b0ac7fc096b2dadb47780e9afd141395b6a111b (patch)
tree2a8d47e5448d5c7f389c6ab19ab4cdc63727553a /src
parentb5327496baf28f0c5fefaa631fe586569b7f8dec (diff)
downloadtanetane-7b0ac7fc096b2dadb47780e9afd141395b6a111b.tar.gz
tanetane-7b0ac7fc096b2dadb47780e9afd141395b6a111b.tar.bz2
tanetane-7b0ac7fc096b2dadb47780e9afd141395b6a111b.zip
Added cursor wrapping to pause menu
#7
Diffstat (limited to 'src')
-rw-r--r--src/menu_system.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/menu_system.cpp b/src/menu_system.cpp index aaaa0e1..a6fd566 100644 --- a/src/menu_system.cpp +++ b/src/menu_system.cpp
@@ -53,21 +53,27 @@ void MenuSystem::closePauseMenu() {
53} 53}
54 54
55void MenuSystem::pressedUp() { 55void MenuSystem::pressedUp() {
56 if (cursor_ > 0) { 56 cursor_--;
57 cursor_--;
58 cursorBob_ = 0;
59 cursorBobDown_ = true;
60 57
61 game_.getMixer().playSound("../res/sfx/vertical_menu.wav"); 58 if (cursor_ < 0) {
59 cursor_ = menu_.size() - 1;
62 } 60 }
61
62 cursorBob_ = 0;
63 cursorBobDown_ = true;
64
65 game_.getMixer().playSound("../res/sfx/vertical_menu.wav");
63} 66}
64 67
65void MenuSystem::pressedDown() { 68void MenuSystem::pressedDown() {
66 if (cursor_ < menu_.size() - 1) { 69 cursor_++;
67 cursor_++;
68 cursorBob_ = 0;
69 cursorBobDown_ = true;
70 70
71 game_.getMixer().playSound("../res/sfx/vertical_menu.wav"); 71 if (cursor_ >= menu_.size()) {
72 cursor_ = 0;
72 } 73 }
74
75 cursorBob_ = 0;
76 cursorBobDown_ = true;
77
78 game_.getMixer().playSound("../res/sfx/vertical_menu.wav");
73} 79}