diff options
| author | Alan Edwardes <[email protected]> | 2013-12-03 10:47:30 +0000 |
|---|---|---|
| committer | Alan Edwardes <[email protected]> | 2013-12-03 10:47:30 +0000 |
| commit | 550992aebacbc7586553c15a3c2120f85a879126 (patch) | |
| tree | c814cf654018acd5d69bb6e4be5dc9900391fd37 /mp/src/public/inputsystem | |
| parent | VBSP now checks all search paths for an FGD file. (diff) | |
| parent | Make .xcconfigs text files too. (diff) | |
| download | source-sdk-2013-550992aebacbc7586553c15a3c2120f85a879126.tar.xz source-sdk-2013-550992aebacbc7586553c15a3c2120f85a879126.zip | |
Merge remote-tracking branch 'upstream/master' into vbsp-fixes.
Diffstat (limited to 'mp/src/public/inputsystem')
| -rw-r--r-- | mp/src/public/inputsystem/AnalogCode.h | 88 | ||||
| -rw-r--r-- | mp/src/public/inputsystem/ButtonCode.h | 756 | ||||
| -rw-r--r-- | mp/src/public/inputsystem/InputEnums.h | 200 | ||||
| -rw-r--r-- | mp/src/public/inputsystem/iinputsystem.h | 253 |
4 files changed, 652 insertions, 645 deletions
diff --git a/mp/src/public/inputsystem/AnalogCode.h b/mp/src/public/inputsystem/AnalogCode.h index b9eaafaf..51a8441d 100644 --- a/mp/src/public/inputsystem/AnalogCode.h +++ b/mp/src/public/inputsystem/AnalogCode.h @@ -1,44 +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
+//========= 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 index df0a5050..39dc7e0a 100644 --- a/mp/src/public/inputsystem/ButtonCode.h +++ b/mp/src/public/inputsystem/ButtonCode.h @@ -1,378 +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
+//========= 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 index 2bf7357b..4da6866b 100644 --- a/mp/src/public/inputsystem/InputEnums.h +++ b/mp/src/public/inputsystem/InputEnums.h @@ -1,100 +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
+//========= 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 index f2453067..ab408e09 100644 --- a/mp/src/public/inputsystem/iinputsystem.h +++ b/mp/src/public/inputsystem/iinputsystem.h @@ -1,123 +1,130 @@ -//========= 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
+//========= 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; + + // tell the input system that we're not a game, we're console text mode. + // this is used for dedicated servers to not initialize joystick system. + // this needs to be called before CInputSystem::Init (e.g. in PreInit of + // some system) if you want ot prevent the joystick system from ever + // being initialized. + virtual void SetConsoleTextMode( bool bConsoleTextMode ) = 0; +}; + + +#endif // IINPUTSYSTEM_H |