Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc8b7e59

Browse files
committed
MenuNumPicker: Wrap increment/decrement when using buttons
This commit also fixes the bug where the tablist could be navigatedwhile doing a continuous press of the increment/decrement buttons.
1 parentf47d138 commitc8b7e59

File tree

4 files changed

+36
-12
lines changed

4 files changed

+36
-12
lines changed

‎RELEASE_NOTES.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ Engine fixes:
117117
* XP gain is now prevented after the initial death frame. This still allows for the player to revive if they die and level up on the same frame.
118118
* Fix bug where new saves were the wrong class and couldn't attack when using a controller.
119119
* Fixed a case where replaced powers were not being enabled when switching equipment sets.
120+
* Item quantity menu now wraps around when using the increment/decrement buttons.
120121
* Android: Fix 'Flare' directory not being automatically created.
121122
* Android: Added a dialog to direct the player to the wiki page for installing if no game data is found.
122123

‎src/MenuNumPicker.cpp‎

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void MenuNumPicker::align() {
128128

129129
voidMenuNumPicker::logic() {
130130
if (visible) {
131-
if (!input_box->edit_mode) {
131+
if (!input_box->edit_mode && spin_ticks ==0) {
132132
tablist.logic();
133133
}
134134

@@ -141,17 +141,15 @@ void MenuNumPicker::logic() {
141141
elseif (button_close->checkClick()) {
142142
cancel_clicked =true;
143143
}
144-
elseif (inpt->pressing[Input::ACCEPT] && !inpt->lock[Input::ACCEPT]) {
145-
inpt->lock[Input::ACCEPT] =true;
146-
confirm_clicked =true;
147-
}
148144
elseif (button_ok->checkClick()) {
149145
confirm_clicked =true;
150146
}
151-
elseif (button_up->checkClick()) {
147+
elseif (button_up->checkClick() && spin_ticks < spin_delay) {
148+
can_wrap = (value == value_max);
152149
increaseValue(1);
153150
}
154-
elseif (button_down->checkClick()) {
151+
elseif (button_down->checkClick() && spin_ticks < spin_delay) {
152+
can_wrap = (value == value_min);
155153
decreaseValue(1);
156154
}
157155
else {
@@ -161,6 +159,7 @@ void MenuNumPicker::logic() {
161159
else {
162160
spin_ticks =0;
163161
spin_increment =1;
162+
can_wrap = (value == value_max || value == value_min);
164163
}
165164

166165
if (spin_ticks >0 && spin_ticks % spin_delay ==0) {
@@ -218,8 +217,19 @@ void MenuNumPicker::increaseValue(int val) {
218217

219218
value += val;
220219

221-
if (value > value_max || value < value_min)
222-
value = value_max;
220+
if (value >= value_max) {
221+
if (can_wrap) {
222+
value = value_min;
223+
}
224+
else {
225+
value = value_max;
226+
}
227+
}
228+
elseif (value <= value_min) {
229+
value = value_min;
230+
}
231+
232+
can_wrap =false;
223233

224234
updateInput();
225235
}
@@ -229,8 +239,19 @@ void MenuNumPicker::decreaseValue(int val) {
229239

230240
value -= val;
231241

232-
if (value > value_max || value < value_min)
233-
value = value_min;
242+
if (value <= value_min) {
243+
if (can_wrap) {
244+
value = value_max;
245+
}
246+
else {
247+
value = value_min;
248+
}
249+
}
250+
elseif (value >= value_max) {
251+
value = value_max;
252+
}
253+
254+
can_wrap =false;
234255

235256
updateInput();
236257
}

‎src/MenuNumPicker.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class MenuNumPicker : public Menu {
4949
int spin_increment;
5050
int spin_delay;
5151

52+
bool can_wrap;
53+
5254
public:
5355
MenuNumPicker();
5456
~MenuNumPicker();

‎src/Version.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ FLARE. If not, see http://www.gnu.org/licenses/
3030

3131
#include<SDL.h>
3232

33-
VersionVersionInfo::ENGINE(1,14,184);
33+
VersionVersionInfo::ENGINE(1,14,185);
3434
VersionVersionInfo::MIN(0,0,0);
3535
VersionVersionInfo::MAX(USHRT_MAX, USHRT_MAX, USHRT_MAX);
3636

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp