From a788b9e54028d6040d5ece0416303979b01ae0b7 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 26 Apr 2022 13:27:09 +0200 Subject: [PATCH] CLI command -keys --- control.cpp | 3 ++- debug.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/control.cpp b/control.cpp index 08352dac..80f96701 100644 --- a/control.cpp +++ b/control.cpp @@ -940,8 +940,9 @@ EX void mainloopiter() { for(auto d: dialog::key_queue) { println(hlog, "handling key ", d); handlekey(d, d); + dialog::key_queue.erase(dialog::key_queue.begin()); + break; } - dialog::key_queue.clear(); while(SDL_PollEvent(&ev)) handle_event(ev); fix_mouseh(); diff --git a/debug.cpp b/debug.cpp index 53478ff3..2feda6e8 100644 --- a/debug.cpp +++ b/debug.cpp @@ -915,6 +915,30 @@ int read_cheat_args() { for(int i=0; i= '1' && c <= '9') dialog::queue_key(SDLK_F1 + c - '1'); + else if(c == 'e') dialog::queue_key(SDLK_ESCAPE); + else if(c == 'r') dialog::queue_key(SDLK_RETURN); + else if(c == 't') dialog::queue_key(SDLK_TAB); + else if(c == 'b') dialog::queue_key(SDLK_BACKSPACE); + else if(c == 'R') dialog::queue_key(SDLK_RIGHT); + else if(c == 'L') dialog::queue_key(SDLK_LEFT); + else if(c == 'U') dialog::queue_key(SDLK_UP); + else if(c == 'D') dialog::queue_key(SDLK_DOWN); + else if(c == 'H') dialog::queue_key(SDLK_HOME); + else if(c == 'E') dialog::queue_key(SDLK_END); + else if(c == 'P') dialog::queue_key(SDLK_PAGEUP); + else if(c == 'Q') dialog::queue_key(SDLK_PAGEDOWN); + } + else if(c == '\\') quote = true; + else dialog::queue_key(c); + } else if(argis("-hroll")) { shift(); int i = argi();