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.

129 lines
3.6 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //-----------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #ifndef DISPVIEW_H
  14. #define DISPVIEW_H
  15. #pragma once
  16. //=============================================================================
  17. #include "Render3D.h"
  18. #include "Camera.h"
  19. #include "Keyboard.h"
  20. //=============================================================================
  21. enum
  22. {
  23. FORWARD = 0,
  24. STRAFE,
  25. VERTICAL
  26. };
  27. //=============================================================================
  28. class CDispView : public CMapView
  29. {
  30. DECLARE_DYNCREATE( CDispView )
  31. public:
  32. enum DispViewType_t
  33. {
  34. DISPVIEW_IMAGE = 0,
  35. DISPVIEW_OUTLINED_IMAGE,
  36. };
  37. virtual ~CDispView();
  38. void Render( void );
  39. CMapDoc* GetDocument( void );
  40. void Activate( BOOL bActivate );
  41. void ToggleCameraMode( void );
  42. void ProcessInput( void );
  43. //{{AFX_VIRTUAL( CDispView )
  44. public:
  45. virtual void OnInitialUpdate();
  46. protected:
  47. virtual void OnDraw( CDC *pDC );
  48. virtual BOOL PreCreateWindow( CREATESTRUCT &cs );
  49. //}}AFX_VIRTUAL
  50. protected:
  51. CDispView();
  52. CRender3D *m_pRender; // view renderer
  53. CCamera *m_pCamera; // view camera
  54. DispViewType_t m_eDispViewType; // type of displacement view
  55. bool m_bCameraEnable; // view in camera mode
  56. CKeyboard m_Keyboard; // handles binding of keys and mouse buttons to logical functions
  57. DWORD m_TimeLastInputSample; // used for framerate-independent input processing.
  58. float m_Speed[3]; // speed in world units/sec = forward, side-to-side, and up-down
  59. float m_SpeedMax[3]; // max speed in world units/sec
  60. float m_Accel[3]; // accel in world units/sec
  61. bool m_bLMBDown; // is the left mouse button down?
  62. bool m_bRMBDown; // is the right mouse button down?
  63. void InitializeKeyMap( void );
  64. void ProcessKeys( float elapsedTime );
  65. void ProcessMovementKeys( float elapsedTime );
  66. float Accelerate( float vel, float accel, float accelScale, float timeScale, float velMax);
  67. void LockCursorInCenter( bool bLock );
  68. void ApplyDispTool( UINT nFlags, CPoint point, bool bLMBDown );
  69. bool OnSelection( UINT nFlags, CPoint point );
  70. bool InitRenderer( void );
  71. bool InitCamera( void );
  72. bool AllocRenderer( void );
  73. void FreeRenderer( void );
  74. bool AllocCamera( void );
  75. void FreeCamera( void );
  76. #ifdef _DEBUG
  77. virtual void AssertValid() const;
  78. virtual void Dump( CDumpContext &dc ) const;
  79. #endif
  80. //{{AFX_MSG( CDispView )
  81. afx_msg void OnChar( UINT nChar, UINT nRepCnt, UINT nFlags );
  82. afx_msg BOOL OnEraseBkgnd( CDC *pDC );
  83. afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
  84. afx_msg void OnKeyUp( UINT nChar, UINT nRepCnt, UINT nFlags );
  85. afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
  86. afx_msg void OnLButtonUp( UINT nFlags, CPoint point );
  87. afx_msg void OnMouseMove( UINT nFlags, CPoint point );
  88. afx_msg void OnRButtonDown( UINT nFlags, CPoint point );
  89. afx_msg void OnRButtonUp( UINT nFlags, CPoint point );
  90. afx_msg void OnSize( UINT nType, int cx, int cy );
  91. afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  92. afx_msg void OnTimer(UINT nIDEvent);
  93. //}}AFX_MSG
  94. DECLARE_MESSAGE_MAP()
  95. };
  96. inline CMapDoc *CDispView::GetDocument( void )
  97. {
  98. return( ( CMapDoc* )m_pDocument );
  99. }
  100. #endif // DISPVIEW_H