mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Menus: Disable normal left-click/touch menu functionality when the mouse is active.
git-svn-id: https://svn.eduke32.com/eduke32@4854 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
598e33319c
commit
4f9831d45c
3 changed files with 33 additions and 8 deletions
|
@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "joystick.h"
|
||||
#include "control.h"
|
||||
#include "input.h"
|
||||
#include "menus.h"
|
||||
|
||||
int32_t I_CheckAllInput(void)
|
||||
{
|
||||
|
@ -51,12 +52,18 @@ int32_t I_AdvanceTrigger(void)
|
|||
return (
|
||||
KB_KeyPressed(sc_kpad_Enter) ||
|
||||
KB_KeyPressed(sc_Enter) ||
|
||||
(MOUSE_GetButtons()&LEFT_MOUSE) ||
|
||||
#if !defined EDUKE32_TOUCH_DEVICES
|
||||
MOUSEINACTIVECONDITIONAL(MOUSE_GetButtons()&LEFT_MOUSE) ||
|
||||
#endif
|
||||
#if defined(GEKKO)
|
||||
(JOYSTICK_GetButtons()&WII_A)
|
||||
MOUSEINACTIVECONDITIONAL(JOYSTICK_GetButtons()&WII_A)
|
||||
#else
|
||||
BUTTON(gamefunc_Open) ||
|
||||
# if !defined EDUKE32_TOUCH_DEVICES
|
||||
MOUSEINACTIVECONDITIONAL(BUTTON(gamefunc_Fire))
|
||||
# else
|
||||
BUTTON(gamefunc_Fire)
|
||||
# endif
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
@ -250,7 +257,9 @@ void I_PanelDownClear(void)
|
|||
int32_t I_SliderLeft(void)
|
||||
{
|
||||
return (
|
||||
((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELUP_MOUSE)) ||
|
||||
#if !defined EDUKE32_TOUCH_DEVICES
|
||||
MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELUP_MOUSE)) ||
|
||||
#endif
|
||||
I_MenuLeft()
|
||||
);
|
||||
}
|
||||
|
@ -265,7 +274,9 @@ void I_SliderLeftClear(void)
|
|||
int32_t I_SliderRight(void)
|
||||
{
|
||||
return (
|
||||
((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELDOWN_MOUSE)) ||
|
||||
#if !defined EDUKE32_TOUCH_DEVICES
|
||||
MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELDOWN_MOUSE)) ||
|
||||
#endif
|
||||
I_MenuRight()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -3161,8 +3161,7 @@ static inline int32_t M_UpdateScreenOK(MenuID_t cm)
|
|||
chances are you should scroll up.
|
||||
*/
|
||||
|
||||
#define M_MOUSETIMEOUT 120
|
||||
static int32_t m_mouselastactivity;
|
||||
int32_t m_mouselastactivity;
|
||||
static vec2_t m_prevmousepos, m_mousepos, m_mousedownpos;
|
||||
|
||||
void M_OpenMenu(size_t playerID)
|
||||
|
@ -4898,6 +4897,7 @@ void M_DisplayMenus(void)
|
|||
if (M_UpdateScreenOK(g_currentMenu))
|
||||
G_UpdateScreenArea();
|
||||
|
||||
// Display the menu, with a transition animation if applicable.
|
||||
if (totalclock < m_animation.start + m_animation.length)
|
||||
{
|
||||
vec2_t previousOrigin = { 0, 0 };
|
||||
|
@ -4917,7 +4917,7 @@ void M_DisplayMenus(void)
|
|||
|
||||
if (mousestatus)
|
||||
{
|
||||
if (((totalclock - m_mouselastactivity < M_MOUSETIMEOUT) && mousepressstateadvance()) || m_mousepos.x != m_prevmousepos.x || m_mousepos.y != m_prevmousepos.y)
|
||||
if (MOUSEACTIVECONDITIONAL(mousepressstateadvance()) || m_mousepos.x != m_prevmousepos.x || m_mousepos.y != m_prevmousepos.y)
|
||||
{
|
||||
m_prevmousepos = m_mousepos;
|
||||
m_mouselastactivity = totalclock;
|
||||
|
@ -4926,8 +4926,11 @@ void M_DisplayMenus(void)
|
|||
else
|
||||
m_mouselastactivity = -M_MOUSETIMEOUT;
|
||||
|
||||
if (totalclock - m_mouselastactivity < M_MOUSETIMEOUT)
|
||||
#ifndef EDUKE32_TOUCH_DEVICES
|
||||
// Display the mouse cursor, except on touch devices.
|
||||
if (MOUSEACTIVECONDITION)
|
||||
rotatesprite_fs(m_mousepos.x,m_mousepos.y,65536,0,CROSSHAIR,0,CROSSHAIR_PAL,2|1);
|
||||
#endif
|
||||
|
||||
if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU)
|
||||
{
|
||||
|
|
|
@ -402,6 +402,17 @@ void M_OpenMenu(size_t playerID);
|
|||
void M_CloseMenu(size_t playerID);
|
||||
void M_DisplayMenus(void);
|
||||
|
||||
#define M_MOUSETIMEOUT 120
|
||||
extern int32_t m_mouselastactivity;
|
||||
|
||||
#if defined EDUKE32_TOUCH_DEVICES
|
||||
# define MOUSEACTIVECONDITIONAL(condition) (condition)
|
||||
#else
|
||||
# define MOUSEACTIVECONDITION (totalclock - m_mouselastactivity < M_MOUSETIMEOUT)
|
||||
# define MOUSEACTIVECONDITIONAL(condition) (MOUSEACTIVECONDITION && (condition))
|
||||
# define MOUSEINACTIVECONDITIONAL(condition) (!MOUSEACTIVECONDITION && (condition))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue