Commit 4f978095 authored by Rinnegatamante's avatar Rinnegatamante
Browse files

Added touch support for precision aiming.

parent 66400aeb
......@@ -90,6 +90,8 @@ void IN_RescaleAnalog(int *x, int *y, int dead) {
#define LANALOG_UP 0x04
#define LANALOG_DOWN 0x08
int old_x = - 1, old_y;
void IN_Frame( void )
{
SceCtrlData keys;
......@@ -99,6 +101,15 @@ void IN_Frame( void )
Sys_SetKeys(keys.buttons, time);
oldkeys = keys.buttons;
// Emulating mouse with touch
SceTouchData touch;
sceTouchPeek(SCE_TOUCH_PORT_FRONT, &touch, 1);
if (touch.reportNum > 0){
if (old_x != -1) Com_QueueEvent(time, SE_MOUSE, (touch.report[0].x - old_x), (touch.report[0].y - old_y), 0, NULL);
old_x = touch.report[0].x;
old_y = touch.report[0].y;
}else old_x = -1;
// Emulating mouse with right analog
int right_x = (keys.rx - 127) * 256;
int right_y = (keys.ry - 127) * 256;
......@@ -141,6 +152,7 @@ IN_Init
void IN_Init( void *windowData )
{
sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG_WIDE);
sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START);
}
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment