Even further simplfication

This commit is contained in:
simon.kagstrom 2009-01-23 18:29:09 +00:00
parent fa07068d04
commit 1ee6fe673e
3 changed files with 9 additions and 8 deletions

View File

@ -302,7 +302,8 @@ void C64::bind_keys(Prefs *np)
int key; int key;
bool shifted; bool shifted;
if (this->virtual_keyboard->get_key(&key) != false) key = this->virtual_keyboard->get_key();
if (key >= 0)
{ {
this->prefs_changed = true; this->prefs_changed = true;
np->JoystickKeyBinding[opt] = key; np->JoystickKeyBinding[opt] = key;

View File

@ -164,9 +164,9 @@ const char *VirtualKeyboard::keycode_to_string(int kc)
return out; return out;
} }
bool VirtualKeyboard::get_key(int *kc) int VirtualKeyboard::get_key()
{ {
bool out = false; int kc = -1;
while(1) while(1)
{ {
@ -192,11 +192,10 @@ bool VirtualKeyboard::get_key(int *kc)
else if (k & KEY_SELECT) else if (k & KEY_SELECT)
{ {
virtkey_t key = keys[ this->sel_y * KEY_COLS + this->sel_x ]; virtkey_t key = keys[ this->sel_y * KEY_COLS + this->sel_x ];
out = true;
*kc = key.kc; kc = key.kc;
if (this->shift_on) if (this->shift_on)
*kc |= 0x80; kc |= 0x80;
if (key.is_shift == true) if (key.is_shift == true)
this->toggle_shift(); this->toggle_shift();
@ -206,5 +205,6 @@ bool VirtualKeyboard::get_key(int *kc)
} }
SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 0, 0, 0)); SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 0, 0, 0));
return out;
return kc;
} }

View File

@ -16,7 +16,7 @@ class VirtualKeyboard
{ {
public: public:
VirtualKeyboard(SDL_Surface *screen, TTF_Font *font); VirtualKeyboard(SDL_Surface *screen, TTF_Font *font);
bool get_key(int *kc); int get_key();
const char *keycode_to_string(int kc); const char *keycode_to_string(int kc);
private: private: