diff options
author | Michael Pavone <pavone@retrodev.com> | 2018-03-25 12:01:49 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2018-03-25 12:01:49 -0700 |
commit | a5d5c017589945008024f111c06894f5724d6c3b (patch) | |
tree | a06db423e81d53aee66cfa0b0ca366bd57d71dc8 /io.c | |
parent | 15af9462392967b6adf7ba6ff4f7ff778cf10eb3 (diff) | |
parent | b6feecb6c12566e9ea826cb67701008f9e423eea (diff) |
Merged nuklear_ui into default
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -23,6 +23,10 @@ #include "render.h" #include "util.h" #include "menu.h" +#include "saves.h" +#ifndef DISABLE_NUKLEAR +#include "nuklear_ui/blastem_nuklear.h" +#endif #define CYCLE_NEVER 0xFFFFFFFF #define MIN_POLL_INTERVAL 6840 @@ -356,6 +360,9 @@ void store_key_event(uint16_t code) void handle_keydown(int keycode, uint8_t scancode) { + if (!current_io) { + return; + } int bucket = keycode >> 15 & 0xFFFF; int idx = keycode & 0x7FFF; keybinding * binding = bindings[bucket] ? bindings[bucket] + idx : NULL; @@ -377,6 +384,9 @@ void handle_joydown(int joystick, int button) void handle_mousedown(int mouse, int button) { + if (!current_io) { + return; + } if (current_io->mouse_mode == MOUSE_CAPTURE && !current_io->mouse_captured) { current_io->mouse_captured = 1; render_relative_mouse(1); @@ -532,6 +542,11 @@ void handle_binding_up(keybinding * binding) break; } case UI_EXIT: +#ifndef DISABLE_NUKLEAR + if (is_nuklear_active()) { + show_pause_menu(); + } else { +#endif current_system->request_exit(current_system); if (current_system->type == SYSTEM_GENESIS) { genesis_context *gen = (genesis_context *)current_system; @@ -541,6 +556,9 @@ void handle_binding_up(keybinding * binding) menu->external_game_load = 1; } } +#ifndef DISABLE_NUKLEAR + } +#endif break; } break; @@ -549,6 +567,9 @@ void handle_binding_up(keybinding * binding) void handle_keyup(int keycode, uint8_t scancode) { + if (!current_io) { + return; + } int bucket = keycode >> 15 & 0xFFFF; int idx = keycode & 0x7FFF; keybinding * binding = bindings[bucket] ? bindings[bucket] + idx : NULL; |