aboutsummaryrefslogtreecommitdiff
path: root/mp/src/public/inputsystem
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
committerJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
commit39ed87570bdb2f86969d4be821c94b722dc71179 (patch)
treeabc53757f75f40c80278e87650ea92808274aa59 /mp/src/public/inputsystem
downloadsource-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz
source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip
First version of the SOurce SDK 2013
Diffstat (limited to 'mp/src/public/inputsystem')
-rw-r--r--mp/src/public/inputsystem/AnalogCode.h44
-rw-r--r--mp/src/public/inputsystem/ButtonCode.h378
-rw-r--r--mp/src/public/inputsystem/InputEnums.h100
-rw-r--r--mp/src/public/inputsystem/iinputsystem.h123
4 files changed, 645 insertions, 0 deletions
diff --git a/mp/src/public/inputsystem/AnalogCode.h b/mp/src/public/inputsystem/AnalogCode.h
new file mode 100644
index 00000000..b9eaafaf
--- /dev/null
+++ b/mp/src/public/inputsystem/AnalogCode.h
@@ -0,0 +1,44 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//===========================================================================//
+
+#ifndef ANALOGCODE_H
+#define ANALOGCODE_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+
+#include "inputsystem/InputEnums.h"
+
+
+//-----------------------------------------------------------------------------
+// Macro to get at joystick codes
+//-----------------------------------------------------------------------------
+#define JOYSTICK_AXIS_INTERNAL( _joystick, _axis ) ( JOYSTICK_FIRST_AXIS + ((_joystick) * MAX_JOYSTICK_AXES) + (_axis) )
+#define JOYSTICK_AXIS( _joystick, _axis ) ( (AnalogCode_t)JOYSTICK_AXIS_INTERNAL( _joystick, _axis ) )
+
+
+//-----------------------------------------------------------------------------
+// Enumeration for analog input devices. Includes joysticks, mousewheel, mouse
+//-----------------------------------------------------------------------------
+enum AnalogCode_t
+{
+ ANALOG_CODE_INVALID = -1,
+ MOUSE_X = 0,
+ MOUSE_Y,
+ MOUSE_XY, // Invoked when either x or y changes
+ MOUSE_WHEEL,
+
+ JOYSTICK_FIRST_AXIS,
+ JOYSTICK_LAST_AXIS = JOYSTICK_AXIS_INTERNAL( MAX_JOYSTICKS-1, MAX_JOYSTICK_AXES-1 ),
+
+ ANALOG_CODE_LAST,
+};
+
+
+#endif // ANALOGCODE_H
diff --git a/mp/src/public/inputsystem/ButtonCode.h b/mp/src/public/inputsystem/ButtonCode.h
new file mode 100644
index 00000000..df0a5050
--- /dev/null
+++ b/mp/src/public/inputsystem/ButtonCode.h
@@ -0,0 +1,378 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//===========================================================================//
+
+#ifndef BUTTONCODE_H
+#define BUTTONCODE_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "inputsystem/InputEnums.h"
+#include "mathlib/mathlib.h"
+
+//-----------------------------------------------------------------------------
+// Button enum. "Buttons" are binary-state input devices (mouse buttons, keyboard keys)
+//-----------------------------------------------------------------------------
+enum
+{
+ JOYSTICK_MAX_BUTTON_COUNT = 32,
+ JOYSTICK_POV_BUTTON_COUNT = 4,
+ JOYSTICK_AXIS_BUTTON_COUNT = MAX_JOYSTICK_AXES * 2,
+};
+
+#define JOYSTICK_BUTTON_INTERNAL( _joystick, _button ) ( JOYSTICK_FIRST_BUTTON + ((_joystick) * JOYSTICK_MAX_BUTTON_COUNT) + (_button) )
+#define JOYSTICK_POV_BUTTON_INTERNAL( _joystick, _button ) ( JOYSTICK_FIRST_POV_BUTTON + ((_joystick) * JOYSTICK_POV_BUTTON_COUNT) + (_button) )
+#define JOYSTICK_AXIS_BUTTON_INTERNAL( _joystick, _button ) ( JOYSTICK_FIRST_AXIS_BUTTON + ((_joystick) * JOYSTICK_AXIS_BUTTON_COUNT) + (_button) )
+
+#define JOYSTICK_BUTTON( _joystick, _button ) ( (ButtonCode_t)JOYSTICK_BUTTON_INTERNAL( _joystick, _button ) )
+#define JOYSTICK_POV_BUTTON( _joystick, _button ) ( (ButtonCode_t)JOYSTICK_POV_BUTTON_INTERNAL( _joystick, _button ) )
+#define JOYSTICK_AXIS_BUTTON( _joystick, _button ) ( (ButtonCode_t)JOYSTICK_AXIS_BUTTON_INTERNAL( _joystick, _button ) )
+
+enum ButtonCode_t
+{
+ BUTTON_CODE_INVALID = -1,
+ BUTTON_CODE_NONE = 0,
+
+ KEY_FIRST = 0,
+
+ KEY_NONE = KEY_FIRST,
+ KEY_0,
+ KEY_1,
+ KEY_2,
+ KEY_3,
+ KEY_4,
+ KEY_5,
+ KEY_6,
+ KEY_7,
+ KEY_8,
+ KEY_9,
+ KEY_A,
+ KEY_B,
+ KEY_C,
+ KEY_D,
+ KEY_E,
+ KEY_F,
+ KEY_G,
+ KEY_H,
+ KEY_I,
+ KEY_J,
+ KEY_K,
+ KEY_L,
+ KEY_M,
+ KEY_N,
+ KEY_O,
+ KEY_P,
+ KEY_Q,
+ KEY_R,
+ KEY_S,
+ KEY_T,
+ KEY_U,
+ KEY_V,
+ KEY_W,
+ KEY_X,
+ KEY_Y,
+ KEY_Z,
+ KEY_PAD_0,
+ KEY_PAD_1,
+ KEY_PAD_2,
+ KEY_PAD_3,
+ KEY_PAD_4,
+ KEY_PAD_5,
+ KEY_PAD_6,
+ KEY_PAD_7,
+ KEY_PAD_8,
+ KEY_PAD_9,
+ KEY_PAD_DIVIDE,
+ KEY_PAD_MULTIPLY,
+ KEY_PAD_MINUS,
+ KEY_PAD_PLUS,
+ KEY_PAD_ENTER,
+ KEY_PAD_DECIMAL,
+ KEY_LBRACKET,
+ KEY_RBRACKET,
+ KEY_SEMICOLON,
+ KEY_APOSTROPHE,
+ KEY_BACKQUOTE,
+ KEY_COMMA,
+ KEY_PERIOD,
+ KEY_SLASH,
+ KEY_BACKSLASH,
+ KEY_MINUS,
+ KEY_EQUAL,
+ KEY_ENTER,
+ KEY_SPACE,
+ KEY_BACKSPACE,
+ KEY_TAB,
+ KEY_CAPSLOCK,
+ KEY_NUMLOCK,
+ KEY_ESCAPE,
+ KEY_SCROLLLOCK,
+ KEY_INSERT,
+ KEY_DELETE,
+ KEY_HOME,
+ KEY_END,
+ KEY_PAGEUP,
+ KEY_PAGEDOWN,
+ KEY_BREAK,
+ KEY_LSHIFT,
+ KEY_RSHIFT,
+ KEY_LALT,
+ KEY_RALT,
+ KEY_LCONTROL,
+ KEY_RCONTROL,
+ KEY_LWIN,
+ KEY_RWIN,
+ KEY_APP,
+ KEY_UP,
+ KEY_LEFT,
+ KEY_DOWN,
+ KEY_RIGHT,
+ KEY_F1,
+ KEY_F2,
+ KEY_F3,
+ KEY_F4,
+ KEY_F5,
+ KEY_F6,
+ KEY_F7,
+ KEY_F8,
+ KEY_F9,
+ KEY_F10,
+ KEY_F11,
+ KEY_F12,
+ KEY_CAPSLOCKTOGGLE,
+ KEY_NUMLOCKTOGGLE,
+ KEY_SCROLLLOCKTOGGLE,
+
+ KEY_LAST = KEY_SCROLLLOCKTOGGLE,
+ KEY_COUNT = KEY_LAST - KEY_FIRST + 1,
+
+ // Mouse
+ MOUSE_FIRST = KEY_LAST + 1,
+
+ MOUSE_LEFT = MOUSE_FIRST,
+ MOUSE_RIGHT,
+ MOUSE_MIDDLE,
+ MOUSE_4,
+ MOUSE_5,
+ MOUSE_WHEEL_UP, // A fake button which is 'pressed' and 'released' when the wheel is moved up
+ MOUSE_WHEEL_DOWN, // A fake button which is 'pressed' and 'released' when the wheel is moved down
+
+ MOUSE_LAST = MOUSE_WHEEL_DOWN,
+ MOUSE_COUNT = MOUSE_LAST - MOUSE_FIRST + 1,
+
+ // Joystick
+ JOYSTICK_FIRST = MOUSE_LAST + 1,
+
+ JOYSTICK_FIRST_BUTTON = JOYSTICK_FIRST,
+ JOYSTICK_LAST_BUTTON = JOYSTICK_BUTTON_INTERNAL( MAX_JOYSTICKS-1, JOYSTICK_MAX_BUTTON_COUNT-1 ),
+ JOYSTICK_FIRST_POV_BUTTON,
+ JOYSTICK_LAST_POV_BUTTON = JOYSTICK_POV_BUTTON_INTERNAL( MAX_JOYSTICKS-1, JOYSTICK_POV_BUTTON_COUNT-1 ),
+ JOYSTICK_FIRST_AXIS_BUTTON,
+ JOYSTICK_LAST_AXIS_BUTTON = JOYSTICK_AXIS_BUTTON_INTERNAL( MAX_JOYSTICKS-1, JOYSTICK_AXIS_BUTTON_COUNT-1 ),
+
+ JOYSTICK_LAST = JOYSTICK_LAST_AXIS_BUTTON,
+
+#if !defined ( _X360 )
+ NOVINT_FIRST = JOYSTICK_LAST + 2, // plus 1 missing key. +1 seems to cause issues on the first button.
+
+ NOVINT_LOGO_0 = NOVINT_FIRST,
+ NOVINT_TRIANGLE_0,
+ NOVINT_BOLT_0,
+ NOVINT_PLUS_0,
+ NOVINT_LOGO_1,
+ NOVINT_TRIANGLE_1,
+ NOVINT_BOLT_1,
+ NOVINT_PLUS_1,
+
+ NOVINT_LAST = NOVINT_PLUS_1,
+#endif
+
+ BUTTON_CODE_LAST,
+ BUTTON_CODE_COUNT = BUTTON_CODE_LAST - KEY_FIRST + 1,
+
+ // Helpers for XBox 360
+ KEY_XBUTTON_UP = JOYSTICK_FIRST_POV_BUTTON, // POV buttons
+ KEY_XBUTTON_RIGHT,
+ KEY_XBUTTON_DOWN,
+ KEY_XBUTTON_LEFT,
+
+ KEY_XBUTTON_A = JOYSTICK_FIRST_BUTTON, // Buttons
+ KEY_XBUTTON_B,
+ KEY_XBUTTON_X,
+ KEY_XBUTTON_Y,
+ KEY_XBUTTON_LEFT_SHOULDER,
+ KEY_XBUTTON_RIGHT_SHOULDER,
+ KEY_XBUTTON_BACK,
+ KEY_XBUTTON_START,
+ KEY_XBUTTON_STICK1,
+ KEY_XBUTTON_STICK2,
+
+ KEY_XSTICK1_RIGHT = JOYSTICK_FIRST_AXIS_BUTTON, // XAXIS POSITIVE
+ KEY_XSTICK1_LEFT, // XAXIS NEGATIVE
+ KEY_XSTICK1_DOWN, // YAXIS POSITIVE
+ KEY_XSTICK1_UP, // YAXIS NEGATIVE
+ KEY_XBUTTON_LTRIGGER, // ZAXIS POSITIVE
+ KEY_XBUTTON_RTRIGGER, // ZAXIS NEGATIVE
+ KEY_XSTICK2_RIGHT, // UAXIS POSITIVE
+ KEY_XSTICK2_LEFT, // UAXIS NEGATIVE
+ KEY_XSTICK2_DOWN, // VAXIS POSITIVE
+ KEY_XSTICK2_UP, // VAXIS NEGATIVE
+};
+
+inline bool IsAlpha( ButtonCode_t code )
+{
+ return ( code >= KEY_A ) && ( code <= KEY_Z );
+}
+
+inline bool IsAlphaNumeric( ButtonCode_t code )
+{
+ return ( code >= KEY_0 ) && ( code <= KEY_Z );
+}
+
+inline bool IsSpace( ButtonCode_t code )
+{
+ return ( code == KEY_ENTER ) || ( code == KEY_TAB ) || ( code == KEY_SPACE );
+}
+
+inline bool IsKeypad( ButtonCode_t code )
+{
+ return ( code >= MOUSE_FIRST ) && ( code <= KEY_PAD_DECIMAL );
+}
+
+inline bool IsPunctuation( ButtonCode_t code )
+{
+ return ( code >= KEY_0 ) && ( code <= KEY_SPACE ) && !IsAlphaNumeric( code ) && !IsSpace( code ) && !IsKeypad( code );
+}
+
+inline bool IsKeyCode( ButtonCode_t code )
+{
+ return ( code >= KEY_FIRST ) && ( code <= KEY_LAST );
+}
+
+inline bool IsMouseCode( ButtonCode_t code )
+{
+ return ( code >= MOUSE_FIRST ) && ( code <= MOUSE_LAST );
+}
+
+inline bool IsNovintCode( ButtonCode_t code )
+{
+#if !defined ( _X360 )
+ return ( ( code >= NOVINT_FIRST ) && ( code <= NOVINT_LAST ) );
+#else
+ return false;
+#endif
+}
+
+inline bool IsNovintButtonCode( ButtonCode_t code )
+{
+#if !defined ( _X360 )
+ return IsNovintCode( code );
+#else
+ return false;
+#endif
+}
+
+inline bool IsJoystickCode( ButtonCode_t code )
+{
+ return ( ( ( code >= JOYSTICK_FIRST ) && ( code <= JOYSTICK_LAST ) ) || IsNovintCode( code ) );
+}
+
+inline bool IsJoystickButtonCode( ButtonCode_t code )
+{
+ return ( ( ( code >= JOYSTICK_FIRST_BUTTON ) && ( code <= JOYSTICK_LAST_BUTTON ) ) || IsNovintButtonCode( code ) );
+}
+
+inline bool IsJoystickPOVCode( ButtonCode_t code )
+{
+ return ( code >= JOYSTICK_FIRST_POV_BUTTON ) && ( code <= JOYSTICK_LAST_POV_BUTTON );
+}
+
+inline bool IsJoystickAxisCode( ButtonCode_t code )
+{
+ return ( code >= JOYSTICK_FIRST_AXIS_BUTTON ) && ( code <= JOYSTICK_LAST_AXIS_BUTTON );
+}
+
+inline ButtonCode_t GetBaseButtonCode( ButtonCode_t code )
+{
+ if ( IsJoystickButtonCode( code ) )
+ {
+ int offset = ( code - JOYSTICK_FIRST_BUTTON ) % JOYSTICK_MAX_BUTTON_COUNT;
+ return (ButtonCode_t)( JOYSTICK_FIRST_BUTTON + offset );
+ }
+
+ if ( IsJoystickPOVCode( code ) )
+ {
+ int offset = ( code - JOYSTICK_FIRST_POV_BUTTON ) % JOYSTICK_POV_BUTTON_COUNT;
+ return (ButtonCode_t)( JOYSTICK_FIRST_POV_BUTTON + offset );
+ }
+
+ if ( IsJoystickAxisCode( code ) )
+ {
+ int offset = ( code - JOYSTICK_FIRST_AXIS_BUTTON ) % JOYSTICK_AXIS_BUTTON_COUNT;
+ return (ButtonCode_t)( JOYSTICK_FIRST_AXIS_BUTTON + offset );
+ }
+
+ return code;
+}
+
+inline int GetJoystickForCode( ButtonCode_t code )
+{
+ if ( !IsJoystickCode( code ) )
+ return 0;
+
+ if ( IsJoystickButtonCode( code ) )
+ {
+ int offset = ( code - JOYSTICK_FIRST_BUTTON ) / JOYSTICK_MAX_BUTTON_COUNT;
+ return offset;
+ }
+ if ( IsJoystickPOVCode( code ) )
+ {
+ int offset = ( code - JOYSTICK_FIRST_POV_BUTTON ) / JOYSTICK_POV_BUTTON_COUNT;
+ return offset;
+ }
+ if ( IsJoystickAxisCode( code ) )
+ {
+ int offset = ( code - JOYSTICK_FIRST_AXIS_BUTTON ) / JOYSTICK_AXIS_BUTTON_COUNT;
+ return offset;
+ }
+
+ return 0;
+}
+
+inline ButtonCode_t ButtonCodeToJoystickButtonCode( ButtonCode_t code, int nDesiredJoystick )
+{
+ if ( !IsJoystickCode( code ) || nDesiredJoystick == 0 )
+ return code;
+
+ nDesiredJoystick = ::clamp<int>( nDesiredJoystick, 0, MAX_JOYSTICKS - 1 );
+
+ code = GetBaseButtonCode( code );
+
+ // Now upsample it
+ if ( IsJoystickButtonCode( code ) )
+ {
+ int nOffset = code - JOYSTICK_FIRST_BUTTON;
+ return JOYSTICK_BUTTON( nDesiredJoystick, nOffset );
+ }
+
+ if ( IsJoystickPOVCode( code ) )
+ {
+ int nOffset = code - JOYSTICK_FIRST_POV_BUTTON;
+ return JOYSTICK_POV_BUTTON( nDesiredJoystick, nOffset );
+ }
+
+ if ( IsJoystickAxisCode( code ) )
+ {
+ int nOffset = code - JOYSTICK_FIRST_AXIS_BUTTON;
+ return JOYSTICK_AXIS_BUTTON( nDesiredJoystick, nOffset );
+ }
+
+ return code;
+}
+
+#endif // BUTTONCODE_H
diff --git a/mp/src/public/inputsystem/InputEnums.h b/mp/src/public/inputsystem/InputEnums.h
new file mode 100644
index 00000000..2bf7357b
--- /dev/null
+++ b/mp/src/public/inputsystem/InputEnums.h
@@ -0,0 +1,100 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//===========================================================================//
+
+#ifndef INPUTENUMS_H
+#define INPUTENUMS_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+// Standard maximum +/- value of a joystick axis
+#define MAX_BUTTONSAMPLE 32768
+
+#if !defined( _X360 )
+#define INVALID_USER_ID -1
+#else
+#define INVALID_USER_ID XBX_INVALID_USER_ID
+#endif
+
+//-----------------------------------------------------------------------------
+// Forward declarations:
+//-----------------------------------------------------------------------------
+
+enum
+{
+ MAX_JOYSTICKS = 1,
+ MOUSE_BUTTON_COUNT = 5,
+ MAX_NOVINT_DEVICES = 2,
+};
+
+#if defined( LINUX )
+// Linux has a slightly different mapping order on the joystick axes
+enum JoystickAxis_t
+{
+ JOY_AXIS_X = 0,
+ JOY_AXIS_Y,
+ JOY_AXIS_Z,
+ JOY_AXIS_U,
+ JOY_AXIS_R,
+ JOY_AXIS_V,
+ MAX_JOYSTICK_AXES,
+};
+#else
+enum JoystickAxis_t
+{
+ JOY_AXIS_X = 0,
+ JOY_AXIS_Y,
+ JOY_AXIS_Z,
+ JOY_AXIS_R,
+ JOY_AXIS_U,
+ JOY_AXIS_V,
+ MAX_JOYSTICK_AXES,
+};
+#endif
+
+
+
+//-----------------------------------------------------------------------------
+// Extra mouse codes
+//-----------------------------------------------------------------------------
+enum
+{
+ MS_WM_XBUTTONDOWN = 0x020B,
+ MS_WM_XBUTTONUP = 0x020C,
+ MS_WM_XBUTTONDBLCLK = 0x020D,
+ MS_MK_BUTTON4 = 0x0020,
+ MS_MK_BUTTON5 = 0x0040,
+};
+
+//-----------------------------------------------------------------------------
+// Events
+//-----------------------------------------------------------------------------
+enum InputEventType_t
+{
+ IE_ButtonPressed = 0, // m_nData contains a ButtonCode_t
+ IE_ButtonReleased, // m_nData contains a ButtonCode_t
+ IE_ButtonDoubleClicked, // m_nData contains a ButtonCode_t
+ IE_AnalogValueChanged, // m_nData contains an AnalogCode_t, m_nData2 contains the value
+
+ IE_FirstSystemEvent = 100,
+ IE_Quit = IE_FirstSystemEvent,
+ IE_ControllerInserted, // m_nData contains the controller ID
+ IE_ControllerUnplugged, // m_nData contains the controller ID
+
+ IE_FirstVguiEvent = 1000, // Assign ranges for other systems that post user events here
+ IE_FirstAppEvent = 2000,
+};
+
+struct InputEvent_t
+{
+ int m_nType; // Type of the event (see InputEventType_t)
+ int m_nTick; // Tick on which the event occurred
+ int m_nData; // Generic 32-bit data, what it contains depends on the event
+ int m_nData2; // Generic 32-bit data, what it contains depends on the event
+ int m_nData3; // Generic 32-bit data, what it contains depends on the event
+};
+
+#endif // INPUTENUMS_H
diff --git a/mp/src/public/inputsystem/iinputsystem.h b/mp/src/public/inputsystem/iinputsystem.h
new file mode 100644
index 00000000..f2453067
--- /dev/null
+++ b/mp/src/public/inputsystem/iinputsystem.h
@@ -0,0 +1,123 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//===========================================================================//
+
+#ifndef IINPUTSYSTEM_H
+#define IINPUTSYSTEM_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "tier0/platform.h"
+#include "appframework/IAppSystem.h"
+
+#include "inputsystem/InputEnums.h"
+#include "inputsystem/ButtonCode.h"
+#include "inputsystem/AnalogCode.h"
+
+//-----------------------------------------------------------------------------
+// Main interface for input. This is a low-level interface
+//-----------------------------------------------------------------------------
+#define INPUTSYSTEM_INTERFACE_VERSION "InputSystemVersion001"
+abstract_class IInputSystem : public IAppSystem
+{
+public:
+ // Attach, detach input system from a particular window
+ // This window should be the root window for the application
+ // Only 1 window should be attached at any given time.
+ virtual void AttachToWindow( void* hWnd ) = 0;
+ virtual void DetachFromWindow( ) = 0;
+
+ // Enables/disables input. PollInputState will not update current
+ // button/analog states when it is called if the system is disabled.
+ virtual void EnableInput( bool bEnable ) = 0;
+
+ // Enables/disables the windows message pump. PollInputState will not
+ // Peek/Dispatch messages if this is disabled
+ virtual void EnableMessagePump( bool bEnable ) = 0;
+
+ // Polls the current input state
+ virtual void PollInputState() = 0;
+
+ // Gets the time of the last polling in ms
+ virtual int GetPollTick() const = 0;
+
+ // Is a button down? "Buttons" are binary-state input devices (mouse buttons, keyboard keys)
+ virtual bool IsButtonDown( ButtonCode_t code ) const = 0;
+
+ // Returns the tick at which the button was pressed and released
+ virtual int GetButtonPressedTick( ButtonCode_t code ) const = 0;
+ virtual int GetButtonReleasedTick( ButtonCode_t code ) const = 0;
+
+ // Gets the value of an analog input device this frame
+ // Includes joysticks, mousewheel, mouse
+ virtual int GetAnalogValue( AnalogCode_t code ) const = 0;
+
+ // Gets the change in a particular analog input device this frame
+ // Includes joysticks, mousewheel, mouse
+ virtual int GetAnalogDelta( AnalogCode_t code ) const = 0;
+
+ // Returns the input events since the last poll
+ virtual int GetEventCount() const = 0;
+ virtual const InputEvent_t* GetEventData( ) const = 0;
+
+ // Posts a user-defined event into the event queue; this is expected
+ // to be called in overridden wndprocs connected to the root panel.
+ virtual void PostUserEvent( const InputEvent_t &event ) = 0;
+
+ // Returns the number of joysticks
+ virtual int GetJoystickCount() const = 0;
+
+ // Enable/disable joystick, it has perf costs
+ virtual void EnableJoystickInput( int nJoystick, bool bEnable ) = 0;
+
+ // Enable/disable diagonal joystick POV (simultaneous POV buttons down)
+ virtual void EnableJoystickDiagonalPOV( int nJoystick, bool bEnable ) = 0;
+
+ // Sample the joystick and append events to the input queue
+ virtual void SampleDevices( void ) = 0;
+
+ // FIXME: Currently force-feedback is only supported on the Xbox 360
+ virtual void SetRumble( float fLeftMotor, float fRightMotor, int userId = INVALID_USER_ID ) = 0;
+ virtual void StopRumble( void ) = 0;
+
+ // Resets the input state
+ virtual void ResetInputState() = 0;
+
+ // Sets a player as the primary user - all other controllers will be ignored.
+ virtual void SetPrimaryUserId( int userId ) = 0;
+
+ // Convert back + forth between ButtonCode/AnalogCode + strings
+ virtual const char *ButtonCodeToString( ButtonCode_t code ) const = 0;
+ virtual const char *AnalogCodeToString( AnalogCode_t code ) const = 0;
+ virtual ButtonCode_t StringToButtonCode( const char *pString ) const = 0;
+ virtual AnalogCode_t StringToAnalogCode( const char *pString ) const = 0;
+
+ // Sleeps until input happens. Pass a negative number to sleep infinitely
+ virtual void SleepUntilInput( int nMaxSleepTimeMS = -1 ) = 0;
+
+ // Convert back + forth between virtual codes + button codes
+ // FIXME: This is a temporary piece of code
+ virtual ButtonCode_t VirtualKeyToButtonCode( int nVirtualKey ) const = 0;
+ virtual int ButtonCodeToVirtualKey( ButtonCode_t code ) const = 0;
+ virtual ButtonCode_t ScanCodeToButtonCode( int lParam ) const = 0;
+
+ // How many times have we called PollInputState?
+ virtual int GetPollCount() const = 0;
+
+ // Sets the cursor position
+ virtual void SetCursorPosition( int x, int y ) = 0;
+
+ // NVNT get address to haptics interface
+ virtual void *GetHapticsInterfaceAddress() const = 0;
+
+ virtual void SetNovintPure( bool bPure ) = 0;
+
+ // read and clear accumulated raw input values
+ virtual bool GetRawMouseAccumulators( int& accumX, int& accumY ) = 0;
+};
+
+
+#endif // IINPUTSYSTEM_H