r/o

f23ad51a28d493a57d907429095adcaf797b6891 parent 6db72968

authored by Yuki Izumi <yuki@kivikakk.ee> 10 years ago

Menubar selection movement.

qb.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/qb.c b/qb.c
index 4496c07..7310e84 100644
--- a/qb.c
+++ b/qb.c
@@ -446,6 +446,26 @@ void qb_keyup(SDL_Keycode sym) {
}
void qb_keypress(SDL_Keycode sym, Uint16 mod) {
+ if (menubar_focus) {
+ if (sym == SDLK_LEFT) {
+ --selected_menu;
+ } else if (sym == SDLK_RIGHT) {
+ ++selected_menu;
+ } else if (sym == SDLK_ESCAPE) {
+ menubar_focus = 0;
+ }
+
+ if (selected_menu < 0) {
+ selected_menu += 9;
+ } else if (selected_menu > 8) {
+ selected_menu -= 9;
+ }
+
+ render();
+ text_refresh();
+ return;
+ }
+
if (sym == SDLK_ESCAPE) {
qb_running = 0;
return;