latest work on mice stuff, still not too far. also slight cleanup
This commit is contained in:
@@ -397,6 +397,11 @@ void InputFilter::GetPressedButtons( vector<DeviceInput> &array ) const
|
||||
array = g_CurrentState;
|
||||
}
|
||||
|
||||
void InputFilter::UpdateCursorLocation()
|
||||
{
|
||||
// todo
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
|
||||
+9
-8
@@ -7,15 +7,15 @@
|
||||
|
||||
enum InputEventType
|
||||
{
|
||||
/* The device was just pressed. */
|
||||
// The device was just pressed.
|
||||
IET_FIRST_PRESS,
|
||||
|
||||
/* The device is auto-repeating. This event is guaranteed to be sent only between
|
||||
* IET_FIRST_PRESS and IET_RELEASE pairs. */
|
||||
/* The device is auto-repeating. This event is guaranteed to be sent only
|
||||
* between IET_FIRST_PRESS and IET_RELEASE pairs. */
|
||||
IET_REPEAT,
|
||||
|
||||
/* The device is no longer pressed. Exactly one IET_RELEASE event will be sent
|
||||
* for each IET_FIRST_PRESS. */
|
||||
/* The device is no longer pressed. Exactly one IET_RELEASE event will be
|
||||
* sent for each IET_FIRST_PRESS. */
|
||||
IET_RELEASE,
|
||||
|
||||
NUM_InputEventType,
|
||||
@@ -29,7 +29,7 @@ struct InputEvent
|
||||
DeviceInput di;
|
||||
InputEventType type;
|
||||
|
||||
/* A list of all buttons that were pressed at the time of this event: */
|
||||
// A list of all buttons that were pressed at the time of this event:
|
||||
DeviceInputList m_ButtonState;
|
||||
};
|
||||
|
||||
@@ -62,6 +62,9 @@ public:
|
||||
void GetInputEvents( vector<InputEvent> &aEventOut );
|
||||
void GetPressedButtons( vector<DeviceInput> &array ) const;
|
||||
|
||||
// cursor
|
||||
void UpdateCursorLocation();
|
||||
|
||||
private:
|
||||
void CheckButtonChange( ButtonState &bs, DeviceInput di, const RageTimer &now );
|
||||
void ReportButtonChange( const DeviceInput &di, InputEventType t );
|
||||
@@ -71,10 +74,8 @@ private:
|
||||
RageMutex *queuemutex;
|
||||
};
|
||||
|
||||
|
||||
extern InputFilter* INPUTFILTER; // global and accessable from anywhere in our program
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -34,7 +34,6 @@ InputMapper::InputMapper()
|
||||
m_pInputScheme = NULL;
|
||||
}
|
||||
|
||||
|
||||
InputMapper::~InputMapper()
|
||||
{
|
||||
SaveMappingsToDisk();
|
||||
|
||||
+4
-6
@@ -100,9 +100,9 @@ struct AutoMappings
|
||||
#undef PUSH
|
||||
}
|
||||
|
||||
/* Strings used by automatic joystick mappings. */
|
||||
RString m_sGame; // only used
|
||||
RString m_sDriverRegex; // reported by InputHandler
|
||||
// Strings used by automatic joystick mappings.
|
||||
RString m_sGame; // only used
|
||||
RString m_sDriverRegex; // reported by InputHandler
|
||||
RString m_sControllerName; // the product name of the controller
|
||||
|
||||
vector<AutoMappingEntry> m_vMaps;
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
const char *m_szName; // The name used by the button graphics system. e.g. "left", "right", "middle C", "snare"
|
||||
GameButton m_SecondaryMenuButton;
|
||||
};
|
||||
/* Data for each Game-specific GameButton. This starts at GAME_BUTTON_NEXT. */
|
||||
// Data for each Game-specific GameButton. This starts at GAME_BUTTON_NEXT.
|
||||
GameButtonInfo m_GameButtonInfo[NUM_GameButton];
|
||||
const AutoMappings *m_pAutoMappings;
|
||||
|
||||
@@ -211,10 +211,8 @@ protected:
|
||||
const InputScheme *m_pInputScheme;
|
||||
};
|
||||
|
||||
|
||||
extern InputMapper* INPUTMAPPER; // global and accessable from anywhere in our program
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -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