mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-22 11:29:24 +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);
|
Uint8 v = SDL_JoystickGetHat (js, i);
|
||||||
|
|
||||||
/* FIXME! This is the wrong way for the Wii */
|
/* FIXME! This is the wrong way for the Wii */
|
||||||
if (v & SDL_HAT_UP)
|
if (v & SDL_HAT_UP) {
|
||||||
out &= 0xfe;
|
out &= 0xfe;
|
||||||
if (v & SDL_HAT_DOWN)
|
Gui::gui->pushEvent(KEY_UP);
|
||||||
|
}
|
||||||
|
if (v & SDL_HAT_DOWN) {
|
||||||
out &= 0xfd;
|
out &= 0xfd;
|
||||||
if (v & SDL_HAT_LEFT)
|
Gui::gui->pushEvent(KEY_DOWN);
|
||||||
|
}
|
||||||
|
if (v & SDL_HAT_LEFT) {
|
||||||
out &= 0xfb;
|
out &= 0xfb;
|
||||||
if (v & SDL_HAT_RIGHT)
|
Gui::gui->pushEvent(KEY_LEFT);
|
||||||
|
}
|
||||||
|
if (v & SDL_HAT_RIGHT) {
|
||||||
out &= 0xf7;
|
out &= 0xf7;
|
||||||
|
Gui::gui->pushEvent(KEY_RIGHT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
@ -858,9 +866,16 @@ uint8 C64::poll_joystick_buttons(int port)
|
|||||||
if (kc == JOY_NONE)
|
if (kc == JOY_NONE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (cur != old)
|
if (cur != old) {
|
||||||
TheDisplay->UpdateKeyMatrix(kc, !cur,
|
TheDisplay->UpdateKeyMatrix(kc, !cur,
|
||||||
TheCIA1->KeyMatrix, TheCIA1->RevMatrix, &out);
|
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;
|
return out;
|
||||||
|
@ -326,6 +326,25 @@ void Gui::exitMenu()
|
|||||||
this->saveGameInfo();
|
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)
|
void Gui::pushEvent(SDL_Event *ev)
|
||||||
{
|
{
|
||||||
GuiView *cur_view = this->peekView();
|
GuiView *cur_view = this->peekView();
|
||||||
|
@ -43,6 +43,8 @@ public:
|
|||||||
|
|
||||||
void runLogic(void);
|
void runLogic(void);
|
||||||
|
|
||||||
|
void pushEvent(event_t ev);
|
||||||
|
|
||||||
void pushEvent(SDL_Event *ev);
|
void pushEvent(SDL_Event *ev);
|
||||||
|
|
||||||
void draw(SDL_Surface *where);
|
void draw(SDL_Surface *where);
|
||||||
|
@ -420,6 +420,11 @@ void VirtualKeyboard::updateTheme()
|
|||||||
this->setFont(Gui::gui->small_font);
|
this->setFont(Gui::gui->small_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VirtualKeyboard::pushEvent(event_t ev)
|
||||||
|
{
|
||||||
|
Widget::pushEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
void VirtualKeyboard::pushEvent(SDL_Event *ev)
|
void VirtualKeyboard::pushEvent(SDL_Event *ev)
|
||||||
{
|
{
|
||||||
switch(ev->type)
|
switch(ev->type)
|
||||||
|
@ -71,6 +71,8 @@ public:
|
|||||||
|
|
||||||
void draw(SDL_Surface *where, int x, int y, int w, int h);
|
void draw(SDL_Surface *where, int x, int y, int w, int h);
|
||||||
|
|
||||||
|
void pushEvent(event_t ev);
|
||||||
|
|
||||||
void pushEvent(SDL_Event *ev);
|
void pushEvent(SDL_Event *ev);
|
||||||
|
|
||||||
const char *getString();
|
const char *getString();
|
||||||
|
Loading…
Reference in New Issue
Block a user