From 1ee6fe673ea359704190366ede696af2e8c9df36 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Fri, 23 Jan 2009 18:29:09 +0000 Subject: [PATCH] Even further simplfication --- Src/C64_SDL.h | 3 ++- Src/VirtualKeyboard.cpp | 12 ++++++------ Src/VirtualKeyboard.h | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Src/C64_SDL.h b/Src/C64_SDL.h index 0b82663..e33c39b 100644 --- a/Src/C64_SDL.h +++ b/Src/C64_SDL.h @@ -302,7 +302,8 @@ void C64::bind_keys(Prefs *np) int key; bool shifted; - if (this->virtual_keyboard->get_key(&key) != false) + key = this->virtual_keyboard->get_key(); + if (key >= 0) { this->prefs_changed = true; np->JoystickKeyBinding[opt] = key; diff --git a/Src/VirtualKeyboard.cpp b/Src/VirtualKeyboard.cpp index 0b77ec0..5db698f 100644 --- a/Src/VirtualKeyboard.cpp +++ b/Src/VirtualKeyboard.cpp @@ -164,9 +164,9 @@ const char *VirtualKeyboard::keycode_to_string(int kc) return out; } -bool VirtualKeyboard::get_key(int *kc) +int VirtualKeyboard::get_key() { - bool out = false; + int kc = -1; while(1) { @@ -192,11 +192,10 @@ bool VirtualKeyboard::get_key(int *kc) else if (k & KEY_SELECT) { virtkey_t key = keys[ this->sel_y * KEY_COLS + this->sel_x ]; - out = true; - *kc = key.kc; + kc = key.kc; if (this->shift_on) - *kc |= 0x80; + kc |= 0x80; if (key.is_shift == true) this->toggle_shift(); @@ -206,5 +205,6 @@ bool VirtualKeyboard::get_key(int *kc) } SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 0, 0, 0)); - return out; + + return kc; } diff --git a/Src/VirtualKeyboard.h b/Src/VirtualKeyboard.h index d916b25..463cdbb 100644 --- a/Src/VirtualKeyboard.h +++ b/Src/VirtualKeyboard.h @@ -16,7 +16,7 @@ class VirtualKeyboard { public: VirtualKeyboard(SDL_Surface *screen, TTF_Font *font); - bool get_key(int *kc); + int get_key(); const char *keycode_to_string(int kc); private: