fix multitouch.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4164 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
d8fdaabfe4
commit
8ba7a5b9f7
1 changed files with 89 additions and 89 deletions
|
@ -3,23 +3,23 @@
|
|||
|
||||
#include "quakedef.h"
|
||||
|
||||
extern qboolean mouse_active;
|
||||
|
||||
static cvar_t m_filter = CVARF("m_filter", "0", CVAR_ARCHIVE);
|
||||
static cvar_t m_accel = CVARF("m_accel", "0", CVAR_ARCHIVE);
|
||||
extern qboolean mouse_active;
|
||||
|
||||
static cvar_t m_filter = CVARF("m_filter", "0", CVAR_ARCHIVE);
|
||||
static cvar_t m_accel = CVARF("m_accel", "0", CVAR_ARCHIVE);
|
||||
static cvar_t m_forcewheel = CVARD("m_forcewheel", "1", "0: ignore mousewheels in apis where it is abiguous.\n1: Use mousewheel when it is treated as a third axis. Motion above a threshold is ignored, to avoid issues with an unknown threshold.\n2: Like 1, but excess motion is retained. The threshold specifies exact z-axis distance per notice.");
|
||||
static cvar_t m_forcewheel_threshold = CVARD("m_forcewheel_threshold", "32", "Mousewheel graduations smaller than this will not trigger mousewheel deltas.");
|
||||
static cvar_t m_strafeonright = CVARFD("m_strafeonright", "1", CVAR_ARCHIVE, "If 1, touching the right half of the touchscreen will strafe/move, while the left side will turn.");
|
||||
static cvar_t m_fatpressthreshold = CVARFD("m_fatpressthreshold", "0.5", CVAR_ARCHIVE, "How fat your thumb has to be to register a fat press (touchscreens).");
|
||||
static cvar_t m_slidethreshold = CVARFD("m_slidethreshold", "5", CVAR_ARCHIVE, "How far your finger needs to move to be considered a slide event (touchscreens).");
|
||||
|
||||
extern cvar_t cl_forcesplitclient; //all devices claim to be a single player
|
||||
extern cvar_t _windowed_mouse;
|
||||
|
||||
int mousecursor_x, mousecursor_y; /*absolute position*/
|
||||
extern int mousemove_x, mousemove_y;
|
||||
|
||||
|
||||
static cvar_t m_forcewheel_threshold = CVARD("m_forcewheel_threshold", "32", "Mousewheel graduations smaller than this will not trigger mousewheel deltas.");
|
||||
static cvar_t m_strafeonright = CVARFD("m_strafeonright", "1", CVAR_ARCHIVE, "If 1, touching the right half of the touchscreen will strafe/move, while the left side will turn.");
|
||||
static cvar_t m_fatpressthreshold = CVARFD("m_fatpressthreshold", "0.5", CVAR_ARCHIVE, "How fat your thumb has to be to register a fat press (touchscreens).");
|
||||
static cvar_t m_slidethreshold = CVARFD("m_slidethreshold", "5", CVAR_ARCHIVE, "How far your finger needs to move to be considered a slide event (touchscreens).");
|
||||
|
||||
extern cvar_t cl_forcesplitclient; //all devices claim to be a single player
|
||||
extern cvar_t _windowed_mouse;
|
||||
|
||||
int mousecursor_x, mousecursor_y; /*absolute position*/
|
||||
extern int mousemove_x, mousemove_y;
|
||||
|
||||
|
||||
#define EVENTQUEUELENGTH 128
|
||||
struct eventlist_s
|
||||
{
|
||||
|
@ -77,48 +77,48 @@ struct mouse_s
|
|||
vec2_t old_delta; //how far its moved previously, for mouse smoothing
|
||||
float wheeldelta;
|
||||
int down;
|
||||
} ptr[MAXPOINTERS];
|
||||
|
||||
|
||||
|
||||
void IN_Shutdown(void)
|
||||
{
|
||||
INS_Shutdown();
|
||||
}
|
||||
|
||||
void IN_ReInit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
} ptr[MAXPOINTERS];
|
||||
|
||||
|
||||
|
||||
void IN_Shutdown(void)
|
||||
{
|
||||
INS_Shutdown();
|
||||
}
|
||||
|
||||
void IN_ReInit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
events_avail = 0;
|
||||
events_used = 0;
|
||||
|
||||
for (i = 0; i < MAXPOINTERS; i++)
|
||||
{
|
||||
ptr[i].type = M_INVALID;
|
||||
ptr[i].qdeviceid = i;
|
||||
}
|
||||
|
||||
INS_ReInit();
|
||||
}
|
||||
|
||||
void IN_Init(void)
|
||||
{
|
||||
Cvar_Register (&m_filter, "input controls");
|
||||
Cvar_Register (&m_accel, "input controls");
|
||||
events_used = 0;
|
||||
|
||||
for (i = 0; i < MAXPOINTERS; i++)
|
||||
{
|
||||
ptr[i].type = M_INVALID;
|
||||
ptr[i].qdeviceid = i;
|
||||
}
|
||||
|
||||
INS_ReInit();
|
||||
}
|
||||
|
||||
void IN_Init(void)
|
||||
{
|
||||
Cvar_Register (&m_filter, "input controls");
|
||||
Cvar_Register (&m_accel, "input controls");
|
||||
Cvar_Register (&m_forcewheel, "Input Controls");
|
||||
Cvar_Register (&m_forcewheel_threshold, "Input Controls");
|
||||
Cvar_Register (&m_strafeonright, "input controls");
|
||||
Cvar_Register (&m_fatpressthreshold, "input controls");
|
||||
Cvar_Register (&m_slidethreshold, "input controls");
|
||||
|
||||
INS_Init();
|
||||
}
|
||||
|
||||
/*a 'pointer' is either a multitouch pointer, or a separate device
|
||||
note that mice use the keyboard button api, but separate devices*/
|
||||
void IN_Commands(void)
|
||||
{
|
||||
Cvar_Register (&m_forcewheel_threshold, "Input Controls");
|
||||
Cvar_Register (&m_strafeonright, "input controls");
|
||||
Cvar_Register (&m_fatpressthreshold, "input controls");
|
||||
Cvar_Register (&m_slidethreshold, "input controls");
|
||||
|
||||
INS_Init();
|
||||
}
|
||||
|
||||
/*a 'pointer' is either a multitouch pointer, or a separate device
|
||||
note that mice use the keyboard button api, but separate devices*/
|
||||
void IN_Commands(void)
|
||||
{
|
||||
struct eventlist_s *ev;
|
||||
|
||||
INS_Commands();
|
||||
|
@ -252,10 +252,10 @@ void IN_Commands(void)
|
|||
break;
|
||||
}
|
||||
events_used++;
|
||||
}
|
||||
}
|
||||
|
||||
void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum)
|
||||
}
|
||||
}
|
||||
|
||||
void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum)
|
||||
{
|
||||
extern int mousecursor_x, mousecursor_y;
|
||||
extern int mousemove_x, mousemove_y;
|
||||
|
@ -350,25 +350,25 @@ void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum)
|
|||
|
||||
if (mouse->type == M_TOUCH)
|
||||
{
|
||||
if (m_strafeonright.ival && mouse->downpos[0] > vid.pixelwidth/2 && movements != NULL && (key_dest == key_game))
|
||||
{
|
||||
//if they're strafing, calculate the speed to move at based upon their displacement
|
||||
if (mouse->down)
|
||||
{
|
||||
mx = (mouse->oldpos[0] - mouse->downpos[0])*0.1;
|
||||
my = (mouse->oldpos[1] - mouse->downpos[1])*0.1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mx = 0;
|
||||
my = 0;
|
||||
}
|
||||
strafe_x = true;
|
||||
strafe_y = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
strafe_x = false;
|
||||
if (m_strafeonright.ival && mouse->downpos[0] > vid.pixelwidth/2 && movements != NULL && (key_dest == key_game))
|
||||
{
|
||||
//if they're strafing, calculate the speed to move at based upon their displacement
|
||||
if (mouse->down)
|
||||
{
|
||||
mx = (mouse->oldpos[0] - mouse->downpos[0])*0.1;
|
||||
my = (mouse->oldpos[1] - mouse->downpos[1])*0.1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mx = 0;
|
||||
my = 0;
|
||||
}
|
||||
strafe_x = true;
|
||||
strafe_y = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
strafe_x = false;
|
||||
strafe_y = false;
|
||||
}
|
||||
}
|
||||
|
@ -449,15 +449,15 @@ void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum)
|
|||
else
|
||||
movements[0] -= m_forward.value * mouse_y;
|
||||
}
|
||||
}
|
||||
|
||||
void IN_Move (float *movements, int pnum)
|
||||
{
|
||||
int i;
|
||||
INS_Move(movements, pnum);
|
||||
for (i = 0; i < MAXPOINTERS; i++)
|
||||
IN_MoveMouse(&ptr[i], movements, pnum);
|
||||
}
|
||||
}
|
||||
|
||||
void IN_Move (float *movements, int pnum)
|
||||
{
|
||||
int i;
|
||||
INS_Move(movements, pnum);
|
||||
for (i = 0; i < MAXPOINTERS; i++)
|
||||
IN_MoveMouse(&ptr[i], movements, pnum);
|
||||
}
|
||||
|
||||
void IN_KeyEvent(int devid, int down, int keycode, int unicode)
|
||||
{
|
||||
|
@ -465,7 +465,7 @@ void IN_KeyEvent(int devid, int down, int keycode, int unicode)
|
|||
if (!ev)
|
||||
return;
|
||||
ev->type = down?IEV_KEYDOWN:IEV_KEYRELEASE;
|
||||
ev->devid = 0;
|
||||
ev->devid = devid;
|
||||
ev->keyboard.scancode = keycode;
|
||||
ev->keyboard.unicode = unicode;
|
||||
in_finishevent();
|
||||
|
|
Loading…
Reference in a new issue