Skip to content

Commit 0e8e43d

Browse files
committed
Use ESC for back
Fixes #158
1 parent 2915cf2 commit 0e8e43d

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

demo/raylib/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ struct nk_rect lastWindowSize;
2121
int main() {
2222
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
2323
InitWindow(800, 450, "nuklear_console_demo");
24+
SetExitKey(KEY_NULL);
2425
SetWindowMinSize(200, 200);
2526

2627
// Create the Nuklear Context

nuklear_console.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,11 @@ NK_API nk_bool nk_console_button_pushed(nk_console* console, int button) {
13951395
case NK_GAMEPAD_BUTTON_LEFT: return data->axis_left_fired || nk_input_is_key_released(&console->ctx->input, NK_KEY_LEFT);
13961396
case NK_GAMEPAD_BUTTON_RIGHT: return data->axis_right_fired || nk_input_is_key_released(&console->ctx->input, NK_KEY_RIGHT);
13971397
case NK_GAMEPAD_BUTTON_A: return nk_input_is_key_released(&console->ctx->input, NK_KEY_ENTER);
1398-
case NK_GAMEPAD_BUTTON_B: return nk_input_is_key_released(&console->ctx->input, NK_KEY_BACKSPACE) || (nk_input_is_mouse_pressed(&console->ctx->input, NK_BUTTON_X1) && nk_window_is_hovered(console->ctx));
1398+
case NK_GAMEPAD_BUTTON_B:
1399+
// Escape Key
1400+
return nk_input_is_key_released(&console->ctx->input, NK_KEY_TEXT_RESET_MODE) ||
1401+
// Mouse Back Button
1402+
(nk_input_is_mouse_pressed(&console->ctx->input, NK_BUTTON_X1) && nk_window_is_hovered(console->ctx));
13991403
// case NK_GAMEPAD_BUTTON_X: return nk_input_is_key_pressed(&console->ctx->input, NK_KEY_A);
14001404
// case NK_GAMEPAD_BUTTON_Y: return nk_input_is_key_pressed(&console->ctx->input, NK_KEY_S);
14011405
case NK_GAMEPAD_BUTTON_LB: return nk_input_is_key_released(&console->ctx->input, NK_KEY_UP) && nk_input_is_key_down(&console->ctx->input, NK_KEY_SHIFT);

0 commit comments

Comments
 (0)