Prevent selection when cursor is out of menu window

This commit is contained in:
kichikuou
2017-04-30 18:54:22 +09:00
parent 54bea213d3
commit 71728db664
+7 -1
View File
@@ -182,6 +182,8 @@ int NACT::menu_select(int num_items)
int height = ags->menu_font_size + 4; int height = ags->menu_font_size + 4;
set_cursor(mx, my); set_cursor(mx, my);
bool selectable = true;
// メニュー選択 // メニュー選択
for(;;) { for(;;) {
// 入力待機 // 入力待機
@@ -219,6 +221,9 @@ int NACT::menu_select(int num_items)
if(sx <= mx && mx <= ex && 0 <= index && index < num_items) { if(sx <= mx && mx <= ex && 0 <= index && index < num_items) {
current_index = index; current_index = index;
ags->redraw_menu_window(menu_window, current_index); ags->redraw_menu_window(menu_window, current_index);
selectable = true;
} else {
selectable = false;
} }
} else if(val == 1 || val == 2 || val == 4 || val == 8) { } else if(val == 1 || val == 2 || val == 4 || val == 8) {
if(val == 1) { if(val == 1) {
@@ -231,7 +236,8 @@ int NACT::menu_select(int num_items)
current_index = num_items - 1; current_index = num_items - 1;
} }
ags->redraw_menu_window(menu_window, current_index); ags->redraw_menu_window(menu_window, current_index);
} else if(val == 16) { selectable = true;
} else if(val == 16 && selectable) {
break; break;
} else if(val == 32) { } else if(val == 32) {
current_index = -1; current_index = -1;