latest work on mice stuff, still not too far. also slight cleanup
This commit is contained in:
@@ -1,25 +1,21 @@
|
||||
#ifndef INPUT_HANDLER_H
|
||||
#define INPUT_HANDLER_H
|
||||
|
||||
/*
|
||||
* This is a simple class to handle special input devices. Update()
|
||||
* will be called during the input update; the derived class should
|
||||
* send appropriate events to InputHandler.
|
||||
*
|
||||
* Note that, if the underlying device is capable of it, you're free to
|
||||
* start a blocking thread; just store inputs in your class and send them
|
||||
* off in a batch on the next Update. This gets much more accurate timestamps;
|
||||
* we get events more quickly and timestamp them, instead of having a rough
|
||||
* timing granularity due to the framerate.
|
||||
*
|
||||
* Send input events for a specific type of device. Only one driver
|
||||
* for a given set of InputDevice types should be loaded for a given
|
||||
* arch. For example, any number of drivers may produce DEVICE_PUMPn
|
||||
* events, but only one may be loaded at a time. (This will be inconvenient
|
||||
* if, for example, we have two completely distinct methods of getting
|
||||
* input for the same device; we have no method to allocate device numbers.
|
||||
* We don't need this now; I'll write it if it becomes needed.)
|
||||
*/
|
||||
/* This is a simple class to handle special input devices. Update() will be
|
||||
* called during the input update; the derived class should send appropriate
|
||||
* events to InputHandler.
|
||||
* Note that, if the underlying device is capable of it, you're free to start
|
||||
* a blocking thread; just store inputs in your class and send them off in a
|
||||
* batch on the next Update. This gets much more accurate timestamps; we get
|
||||
* events more quickly and timestamp them, instead of having a rough timing
|
||||
* granularity due to the framerate.
|
||||
* Send input events for a specific type of device. Only one driver for a given
|
||||
* set of InputDevice types should be loaded for a given arch. For example,
|
||||
* any number of drivers may produce DEVICE_PUMPn events, but only one may be
|
||||
* loaded at a time. (This will be inconvenient if, for example, we have two
|
||||
* completely distinct methods of getting input for the same device; we have no
|
||||
* method to allocate device numbers. We don't need this now; I'll write it
|
||||
* if it becomes needed.) */
|
||||
#include "RageInputDevice.h" // for InputDevice
|
||||
#include "arch/RageDriver.h"
|
||||
|
||||
|
||||
@@ -425,7 +425,8 @@ void InputHandler_DInput::UpdatePolled( DIDevice &device, const RageTimer &tm )
|
||||
|
||||
if( neg != DeviceButton_Invalid )
|
||||
{
|
||||
float l = SCALE( int(val), 0.0f, 100.0f, 0.0f, 1.0f );
|
||||
//float l = SCALE( int(val), 0.0f, 100.0f, 0.0f, 1.0f );
|
||||
float l = val;
|
||||
ButtonPressed( DeviceInput(dev, neg, max(-l,0), tm) );
|
||||
ButtonPressed( DeviceInput(dev, pos, max(+l,0), tm) );
|
||||
}
|
||||
@@ -509,11 +510,14 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm
|
||||
{
|
||||
case DIMOFS_X:
|
||||
LOG->Trace("mouse X axis changed (buffered)");
|
||||
// todo: update cursor position -aj
|
||||
up = MOUSE_X_LEFT; down = MOUSE_X_RIGHT;
|
||||
break;
|
||||
case DIMOFS_Y:
|
||||
LOG->Trace("mouse Y axis changed (buffered)");
|
||||
// todo: update cursor position -aj
|
||||
up = MOUSE_Y_UP; down = MOUSE_Y_DOWN;
|
||||
//INPUTFILTER->UpdateCursorLocation(0, evtbuf[i].dwData);
|
||||
break;
|
||||
case DIMOFS_Z:
|
||||
LOG->Trace("mouse Z axis changed (buffered)");
|
||||
@@ -524,6 +528,9 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm
|
||||
device.m_sName.c_str(), in.ofs );
|
||||
continue;
|
||||
}
|
||||
float l = SCALE( int(evtbuf[i].dwData), 0.0f, 100.0f, 0.0f, 1.0f );
|
||||
ButtonPressed( DeviceInput(dev, up, max(-l,0), tm) );
|
||||
ButtonPressed( DeviceInput(dev, down, max(+l,0), tm) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -532,7 +539,7 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm
|
||||
// joystick
|
||||
case DIJOFS_X: up = JOY_LEFT; down = JOY_RIGHT; break;
|
||||
case DIJOFS_Y: up = JOY_UP; down = JOY_DOWN; break;
|
||||
case DIJOFS_Z: up = JOY_Z_UP; down = JOY_Z_DOWN; break;
|
||||
case DIJOFS_Z: up = JOY_Z_UP; down = JOY_Z_DOWN; break;
|
||||
case DIJOFS_RX: up = JOY_ROT_UP; down = JOY_ROT_DOWN; break;
|
||||
case DIJOFS_RY: up = JOY_ROT_LEFT; down = JOY_ROT_RIGHT; break;
|
||||
case DIJOFS_RZ: up = JOY_ROT_Z_UP; down = JOY_ROT_Z_DOWN; break;
|
||||
@@ -543,11 +550,10 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm
|
||||
device.m_sName.c_str(), in.ofs );
|
||||
continue;
|
||||
}
|
||||
float l = SCALE( int(evtbuf[i].dwData), 0.0f, 100.0f, 0.0f, 1.0f );
|
||||
ButtonPressed( DeviceInput(dev, up, max(-l,0), tm) );
|
||||
ButtonPressed( DeviceInput(dev, down, max(+l,0), tm) );
|
||||
}
|
||||
|
||||
float l = SCALE( int(evtbuf[i].dwData), 0.0f, 100.0f, 0.0f, 1.0f );
|
||||
ButtonPressed( DeviceInput(dev, up, max(-l,0), tm) );
|
||||
ButtonPressed( DeviceInput(dev, down, max(+l,0), tm) );
|
||||
break;
|
||||
}
|
||||
case in.HAT:
|
||||
|
||||
Reference in New Issue
Block a user