~kameliya/kyuubey

1ec6adc3f11d7a23aee30d27b244a31bfef8a391 — Yuki Izumi 6 years ago f23ad51
Disable the cursor while the menu is focussed.
3 files changed, 6 insertions(+), 4 deletions(-)

M qb.c
M text.c
M text.h
M qb.c => qb.c +3 -3
@@ 434,10 434,10 @@ void qb_keyup(SDL_Keycode sym) {
        alt_held = 0;

        if (!menubar_focus) {
            menubar_focus = 1;
            screen_cursor_disable = menubar_focus = 1;
            selected_menu = 0;
        } else {
            menubar_focus = 0;
            screen_cursor_disable = menubar_focus = 0;
        }

        render();


@@ 452,7 452,7 @@ void qb_keypress(SDL_Keycode sym, Uint16 mod) {
        } else if (sym == SDLK_RIGHT) {
            ++selected_menu;
        } else if (sym == SDLK_ESCAPE) {
            menubar_focus = 0;
            screen_cursor_disable = menubar_focus = 0;
        }

        if (selected_menu < 0) {

M text.c => text.c +2 -1
@@ 5,6 5,7 @@
unsigned short screen[80 * 25];
int screen_cursor_x;
int screen_cursor_y;
int screen_cursor_disable = 0;

static int cursor_on = 1;



@@ 17,7 18,7 @@ void text_refresh(void) {
        }
    }

    if (cursor_on) {
    if (cursor_on && !screen_cursor_disable) {
        text_draw_cursor(screen_cursor_x, screen_cursor_y);
    }


M text.h => text.h +1 -0
@@ 9,6 9,7 @@ void text_cursor_toggle(void);
extern unsigned short screen[80 * 25];
extern int screen_cursor_x;
extern int screen_cursor_y;
extern int screen_cursor_disable;

#endif