mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-10 21:55:11 +01:00
Push joystick events to the GUI. Not tested yet.
This commit is contained in:
parent
7a35a744ec
commit
d2e0208510
@ -829,14 +829,22 @@ uint8 C64::poll_joystick_hats(int port)
|
||||
Uint8 v = SDL_JoystickGetHat (js, i);
|
||||
|
||||
/* FIXME! This is the wrong way for the Wii */
|
||||
if (v & SDL_HAT_UP)
|
||||
if (v & SDL_HAT_UP) {
|
||||
out &= 0xfe;
|
||||
if (v & SDL_HAT_DOWN)
|
||||
Gui::gui->pushEvent(KEY_UP);
|
||||
}
|
||||
if (v & SDL_HAT_DOWN) {
|
||||
out &= 0xfd;
|
||||
if (v & SDL_HAT_LEFT)
|
||||
Gui::gui->pushEvent(KEY_DOWN);
|
||||
}
|
||||
if (v & SDL_HAT_LEFT) {
|
||||
out &= 0xfb;
|
||||
if (v & SDL_HAT_RIGHT)
|
||||
Gui::gui->pushEvent(KEY_LEFT);
|
||||
}
|
||||
if (v & SDL_HAT_RIGHT) {
|
||||
out &= 0xf7;
|
||||
Gui::gui->pushEvent(KEY_RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
@ -858,9 +866,16 @@ uint8 C64::poll_joystick_buttons(int port)
|
||||
if (kc == JOY_NONE)
|
||||
continue;
|
||||
|
||||
if (cur != old)
|
||||
if (cur != old) {
|
||||
TheDisplay->UpdateKeyMatrix(kc, !cur,
|
||||
TheCIA1->KeyMatrix, TheCIA1->RevMatrix, &out);
|
||||
if (kc == JOY_FIRE)
|
||||
Gui::gui->pushEvent(KEY_SELECT);
|
||||
else if (kc == JOY_ENTER_MENU)
|
||||
Gui::gui->activate();
|
||||
else
|
||||
Gui::gui->pushEvent(KEY_ESCAPE);
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
|
@ -326,6 +326,25 @@ void Gui::exitMenu()
|
||||
this->saveGameInfo();
|
||||
}
|
||||
|
||||
void Gui::pushEvent(event_t ev)
|
||||
{
|
||||
GuiView *cur_view = this->peekView();
|
||||
|
||||
if (!this->is_active || !cur_view)
|
||||
{
|
||||
if (this->kbd)
|
||||
this->kbd->pushEvent(ev);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->dlg)
|
||||
this->dlg->pushEvent(ev);
|
||||
else if (this->kbd)
|
||||
this->kbd->pushEvent(ev);
|
||||
else
|
||||
cur_view->pushEvent(ev);
|
||||
}
|
||||
|
||||
void Gui::pushEvent(SDL_Event *ev)
|
||||
{
|
||||
GuiView *cur_view = this->peekView();
|
||||
|
@ -43,6 +43,8 @@ public:
|
||||
|
||||
void runLogic(void);
|
||||
|
||||
void pushEvent(event_t ev);
|
||||
|
||||
void pushEvent(SDL_Event *ev);
|
||||
|
||||
void draw(SDL_Surface *where);
|
||||
|
@ -420,6 +420,11 @@ void VirtualKeyboard::updateTheme()
|
||||
this->setFont(Gui::gui->small_font);
|
||||
}
|
||||
|
||||
void VirtualKeyboard::pushEvent(event_t ev)
|
||||
{
|
||||
Widget::pushEvent(ev);
|
||||
}
|
||||
|
||||
void VirtualKeyboard::pushEvent(SDL_Event *ev)
|
||||
{
|
||||
switch(ev->type)
|
||||
|
@ -71,6 +71,8 @@ public:
|
||||
|
||||
void draw(SDL_Surface *where, int x, int y, int w, int h);
|
||||
|
||||
void pushEvent(event_t ev);
|
||||
|
||||
void pushEvent(SDL_Event *ev);
|
||||
|
||||
const char *getString();
|
||||
|
Loading…
Reference in New Issue
Block a user