Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
4.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #if !defined( IINPUT_H )
  9. #define IINPUT_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. class bf_write;
  14. class bf_read;
  15. class CUserCmd;
  16. class C_BaseCombatWeapon;
  17. struct kbutton_t;
  18. struct CameraThirdData_t
  19. {
  20. float m_flPitch;
  21. float m_flYaw;
  22. float m_flDist;
  23. float m_flLag;
  24. Vector m_vecHullMin;
  25. Vector m_vecHullMax;
  26. };
  27. abstract_class IInput
  28. {
  29. public:
  30. // Initialization/shutdown of the subsystem
  31. virtual void Init_All( void ) = 0;
  32. virtual void Shutdown_All( void ) = 0;
  33. // Latching button states
  34. virtual int GetButtonBits( int ) = 0;
  35. // Create movement command
  36. virtual void CreateMove ( int sequence_number, float input_sample_frametime, bool active ) = 0;
  37. virtual void ExtraMouseSample( float frametime, bool active ) = 0;
  38. virtual bool WriteUsercmdDeltaToBuffer( bf_write *buf, int from, int to, bool isnewcommand ) = 0;
  39. virtual void EncodeUserCmdToBuffer( bf_write& buf, int slot ) = 0;
  40. virtual void DecodeUserCmdFromBuffer( bf_read& buf, int slot ) = 0;
  41. virtual CUserCmd *GetUserCmd( int sequence_number ) = 0;
  42. virtual void MakeWeaponSelection( C_BaseCombatWeapon *weapon ) = 0;
  43. // Retrieve key state
  44. virtual float KeyState ( kbutton_t *key ) = 0;
  45. // Issue key event
  46. virtual int KeyEvent( int eventcode, ButtonCode_t keynum, const char *pszCurrentBinding ) = 0;
  47. // Look for key
  48. virtual kbutton_t *FindKey( const char *name ) = 0;
  49. // Issue commands from controllers
  50. virtual void ControllerCommands( void ) = 0;
  51. // Extra initialization for some joysticks
  52. virtual void Joystick_Advanced( void ) = 0;
  53. virtual void Joystick_SetSampleTime( float frametime ) = 0;
  54. virtual void IN_SetSampleTime( float frametime ) = 0;
  55. // Accumulate mouse delta
  56. virtual void AccumulateMouse( void ) = 0;
  57. // Activate/deactivate mouse
  58. virtual void ActivateMouse( void ) = 0;
  59. virtual void DeactivateMouse( void ) = 0;
  60. // Clear mouse state data
  61. virtual void ClearStates( void ) = 0;
  62. // Retrieve lookspring setting
  63. virtual float GetLookSpring( void ) = 0;
  64. // Retrieve mouse position
  65. virtual void GetFullscreenMousePos( int *mx, int *my, int *unclampedx = 0, int *unclampedy = 0 ) = 0;
  66. virtual void SetFullscreenMousePos( int mx, int my ) = 0;
  67. virtual void ResetMouse( void ) = 0;
  68. virtual float GetLastForwardMove( void ) = 0;
  69. virtual float Joystick_GetForward( void ) = 0;
  70. virtual float Joystick_GetSide( void ) = 0;
  71. virtual float Joystick_GetPitch( void ) = 0;
  72. virtual float Joystick_GetYaw( void ) = 0;
  73. // Third Person camera ( TODO/FIXME: Move this to a separate interface? )
  74. virtual void CAM_Think( void ) = 0;
  75. virtual int CAM_IsThirdPerson( void ) = 0;
  76. virtual void CAM_ToThirdPerson(void) = 0;
  77. virtual void CAM_ToFirstPerson(void) = 0;
  78. virtual void CAM_StartMouseMove(void) = 0;
  79. virtual void CAM_EndMouseMove(void) = 0;
  80. virtual void CAM_StartDistance(void) = 0;
  81. virtual void CAM_EndDistance(void) = 0;
  82. virtual int CAM_InterceptingMouse( void ) = 0;
  83. // orthographic camera info ( TODO/FIXME: Move this to a separate interface? )
  84. virtual void CAM_ToOrthographic() = 0;
  85. virtual bool CAM_IsOrthographic() const = 0;
  86. virtual void CAM_OrthographicSize( float& w, float& h ) const = 0;
  87. virtual void SetPreferredGameActionSet( GameActionSet_t action_set ) = 0;
  88. virtual GameActionSet_t GetPreferredGameActionSet() = 0;
  89. virtual void SetGameActionSetFlags( GameActionSetFlags_t action_set_flags ) = 0;
  90. #if defined( HL2_CLIENT_DLL )
  91. // IK back channel info
  92. virtual void AddIKGroundContactInfo( int entindex, float minheight, float maxheight ) = 0;
  93. #endif
  94. virtual void LevelInit( void ) = 0;
  95. // Causes an input to have to be re-pressed to become active
  96. virtual void ClearInputButton( int bits ) = 0;
  97. virtual void CAM_SetCameraThirdData( CameraThirdData_t *pCameraData, const QAngle &vecCameraOffset ) = 0;
  98. virtual void CAM_CameraThirdThink( void ) = 0;
  99. virtual bool EnableJoystickMode() = 0;
  100. virtual bool IsSteamControllerActive() = 0;
  101. };
  102. extern ::IInput *input;
  103. #endif // IINPUT_H