Counter Strike : Global Offensive Source Code
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.

121 lines
4.2 KiB

  1. //========= Copyright � 1996-2005, 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( bool bResetState ) = 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( int nSlot, bf_write *buf, int from, int to, bool isnewcommand ) = 0;
  39. virtual void EncodeUserCmdToBuffer( int nSlot, bf_write& buf, int slot ) = 0;
  40. virtual void DecodeUserCmdFromBuffer( int nSlot, bf_read& buf, int slot ) = 0;
  41. virtual CUserCmd *GetUserCmd( int nSlot, 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 bool ControllerModeActive() = 0;
  53. virtual void Joystick_Advanced( bool bSilent ) = 0;
  54. virtual void Joystick_SetSampleTime( float frametime ) = 0;
  55. virtual float Joystick_GetPitch( void ) = 0;
  56. virtual float Joystick_GetYaw( void ) = 0;
  57. virtual void Joystick_Querry( float &forward, float &side, float &pitch, float &yaw ) = 0;
  58. virtual void Joystick_ForceRecentering( int nStick, bool bSet = true ) = 0;
  59. virtual void IN_SetSampleTime( float frametime ) = 0;
  60. // Accumulate mouse delta
  61. virtual void AccumulateMouse( int nSlot ) = 0;
  62. // Activate/deactivate mouse
  63. virtual void ActivateMouse( void ) = 0;
  64. virtual void DeactivateMouse( void ) = 0;
  65. // Clear mouse state data
  66. virtual void ClearStates( void ) = 0;
  67. // Retrieve lookspring setting
  68. virtual float GetLookSpring( void ) = 0;
  69. // Retrieve mouse position
  70. virtual void GetFullscreenMousePos( int *mx, int *my, int *unclampedx = 0, int *unclampedy = 0 ) = 0;
  71. virtual void SetFullscreenMousePos( int mx, int my ) = 0;
  72. virtual void ResetMouse() = 0;
  73. virtual float GetLastForwardMove( void ) = 0;
  74. // Third Person camera ( TODO/FIXME: Move this to a separate interface? )
  75. virtual void CAM_Think( void ) = 0;
  76. virtual int CAM_IsThirdPerson( int nSlot = -1 ) = 0;
  77. virtual bool CAM_IsThirdPersonOverview( int nSlot = -1 ) = 0;
  78. virtual void CAM_GetCameraOffset( Vector& ofs ) = 0;
  79. virtual void CAM_ToThirdPerson(void) = 0;
  80. virtual void CAM_ToFirstPerson(void) = 0;
  81. virtual void CAM_ToThirdPersonShoulder(void) = 0;
  82. virtual void CAM_ToThirdPersonOverview(void) = 0;
  83. virtual void CAM_StartMouseMove(void) = 0;
  84. virtual void CAM_EndMouseMove(void) = 0;
  85. virtual void CAM_StartDistance(void) = 0;
  86. virtual void CAM_EndDistance(void) = 0;
  87. virtual int CAM_InterceptingMouse( void ) = 0;
  88. virtual void CAM_Command( int command ) = 0;
  89. // orthographic camera info ( TODO/FIXME: Move this to a separate interface? )
  90. virtual void CAM_ToOrthographic() = 0;
  91. virtual bool CAM_IsOrthographic() const = 0;
  92. virtual void CAM_OrthographicSize( float& w, float& h ) const = 0;
  93. #if defined( HL2_CLIENT_DLL )
  94. // IK back channel info
  95. virtual void AddIKGroundContactInfo( int entindex, float minheight, float maxheight ) = 0;
  96. #endif
  97. virtual void LevelInit( void ) = 0;
  98. // Causes an input to have to be re-pressed to become active
  99. virtual void ClearInputButton( int bits ) = 0;
  100. virtual void CAM_SetCameraThirdData( CameraThirdData_t *pCameraData, const QAngle &vecCameraOffset ) = 0;
  101. virtual void CAM_CameraThirdThink( void ) = 0;
  102. };
  103. extern ::IInput *input;
  104. #endif // IINPUT_H