Set up input so that the menus are navigable under iOS. This also enables the SELECTDIR back button unconditionally instead of restricting it to non-touch devices. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@5169 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-04-28 21:30:42 +00:00
parent 67cc5911fa
commit d313e2531a
4 changed files with 34 additions and 8 deletions

View file

@ -708,7 +708,7 @@ int32_t initinput(void)
W_SetKeyboardLayoutUS(0);
#endif
#ifdef __APPLE__
#if defined EDUKE32_OSX
// force OS X to operate in >1 button mouse mode so that LMB isn't adulterated
if (!getenv("SDL_HAS3BUTTONMOUSE"))
putenv("SDL_HAS3BUTTONMOUSE=1");
@ -1839,10 +1839,9 @@ void handleevents_updatemousestate(uint8_t state)
int32_t handleevents_sdlcommon(SDL_Event *ev)
{
int32_t j;
switch (ev->type)
{
#if !defined EDUKE32_IOS
case SDL_MOUSEMOTION:
#ifndef GEKKO
mouseabs.x = ev->motion.x;
@ -1871,6 +1870,9 @@ int32_t handleevents_sdlcommon(SDL_Event *ev)
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
{
int32_t j;
// some of these get reordered to match winlayer
switch (ev->button.button)
{
@ -1912,6 +1914,20 @@ int32_t handleevents_sdlcommon(SDL_Event *ev)
if (mousepresscallback)
mousepresscallback(j+1, ev->button.state == SDL_PRESSED);
break;
}
#else
# if SDL_MAJOR_VERSION != 1
case SDL_FINGERUP:
mousepressstate = Mouse_Released;
break;
case SDL_FINGERDOWN:
mousepressstate = Mouse_Pressed;
case SDL_FINGERMOTION:
mouseabs.x = Blrintf(ev->tfinger.x * xdim);
mouseabs.y = Blrintf(ev->tfinger.y * ydim);
break;
# endif
#endif
case SDL_JOYAXISMOTION:
if (appactive && ev->jaxis.axis < joynumaxes)

View file

@ -33,6 +33,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
int32_t I_CheckAllInput(void)
{
return (
#if defined EDUKE32_IOS
mousepressstate == Mouse_Pressed ||
#endif
KB_KeyWaiting() ||
MOUSE_GetButtons() ||
JOYSTICK_GetButtons()
@ -40,6 +43,9 @@ int32_t I_CheckAllInput(void)
}
void I_ClearAllInput(void)
{
#if defined EDUKE32_IOS
mousepressstateadvance();
#endif
KB_FlushKeyboardQueue();
KB_ClearKeysDown();
MOUSE_ClearAllButtons();

View file

@ -4491,13 +4491,14 @@ static int32_t M_RunMenuInput_MouseAdvance(void)
return MOUSEACTIVECONDITIONAL(!m_mousecaught && mousepressstate == Mouse_Released);
}
#if !defined EDUKE32_TOUCH_DEVICES
static int32_t M_RunMenuInput_MouseReturn_status;
static void M_RunMenu_MouseReturn(Menu_t *cm, const vec2_t origin)
{
#if !defined EDUKE32_TOUCH_DEVICES
if (!MOUSEACTIVECONDITION)
return;
#endif
if (cm->menuID == MENU_MAIN)
return;
@ -4507,7 +4508,6 @@ static void M_RunMenu_MouseReturn(Menu_t *cm, const vec2_t origin)
2 | 8 | 16 | RS_ALIGN_L, MOUSEALPHA, 0, xdim_from_320_16(origin.x + x_widescreen_left()), 0,
xdim_from_320_16(origin.x + x_widescreen_left() + (tilesiz[SELECTDIR].y << 15)), ydim - 1);
}
#endif
static int32_t M_RunMenuInput_MouseReturn(void)
{
@ -4517,6 +4517,7 @@ static int32_t M_RunMenuInput_MouseReturn(void)
M_RunMenuInput_MouseReturn_status = 0;
return 0;
}
#endif
if (g_currentMenu == MENU_MAIN)
return 0;
@ -4525,12 +4526,16 @@ static int32_t M_RunMenuInput_MouseReturn(void)
if (M_MouseWithinBounds(&m_mousepos, MouseReturnRegionX, 0, tilesiz[SELECTDIR].y<<15, tilesiz[SELECTDIR].x<<16))
{
#if !defined EDUKE32_TOUCH_DEVICES
M_RunMenuInput_MouseReturn_status = 1;
#else
M_RunMenuInput_MouseReturn_status = (mousepressstate == Mouse_Pressed || mousepressstate == Mouse_Held);
#endif
return !m_mousecaught && mousepressstate == Mouse_Released && M_MouseWithinBounds(&m_mousedownpos, MouseReturnRegionX, 0, tilesiz[SELECTDIR].y<<15, tilesiz[SELECTDIR].x<<16);
}
M_RunMenuInput_MouseReturn_status = 0;
#endif
return 0;
}
@ -4804,9 +4809,7 @@ static void M_RunMenu(Menu_t *cm, const vec2_t origin)
}
}
#if !defined EDUKE32_TOUCH_DEVICES
M_RunMenu_MouseReturn(cm, origin);
#endif
}
/*

View file

@ -431,6 +431,7 @@ void M_DisplayMenus(void);
extern int32_t m_mouselastactivity;
#if defined EDUKE32_TOUCH_DEVICES
# define MOUSEALPHA 0
# define MOUSEACTIVECONDITIONAL(condition) (condition)
# define MOUSEWATCHPOINTCONDITIONAL(condition) (condition)
#else