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.

93 lines
2.8 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose: Data and functionality for the logical 2D view
  4. //
  5. //===========================================================================//
  6. #ifndef MAPVIEWLOGICAL_H
  7. #define MAPVIEWLOGICAL_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "MapView2DBase.h"
  12. #include "tier1/utlrbtree.h"
  13. #include "tier1/utlstack.h"
  14. class CWnd;
  15. class CView;
  16. class CMapAtom;
  17. class CMapClass;
  18. class CMapDoc;
  19. class CCamera;
  20. class CTitleWnd;
  21. class CEntityConnection;
  22. class CMapViewLogical : public CMapView2DBase
  23. {
  24. public:
  25. // Other public methods
  26. virtual void Render();
  27. protected:
  28. CMapViewLogical(); // protected constructor used by dynamic creation
  29. virtual ~CMapViewLogical();
  30. DECLARE_DYNCREATE(CMapViewLogical)
  31. virtual bool IsLogical() { return true; }
  32. virtual void OnRenderListDirty();
  33. // convert client view space to map world coordinates (2D versions for convenience)
  34. void WorldToClient( Vector2D &ptClient, const Vector2D &vWorld );
  35. void ClientToWorld( Vector2D &vWorld, const Vector2D &vClient );
  36. virtual void WorldToClient( Vector2D &ptClient, const Vector &vWorld );
  37. virtual void ClientToWorld( Vector &vWorld, const Vector2D &vClient );
  38. // Performs a selection which selects an object at the point as well as entities connected to outputs.
  39. bool SelectAtCascading( const Vector2D &ptClient, bool bMakeFirst );
  40. private:
  41. // timer IDs:
  42. enum
  43. {
  44. TIMER_CONNECTIONUPDATE = 2,
  45. };
  46. typedef CUtlRBTree<CMapClass*, unsigned short> MapClassDict_t;
  47. // Purpose: Builds up list of mapclasses to render
  48. void AddToRenderLists( CMapClass *pObject );
  49. void PopulateConnectionList( );
  50. // Purpose:
  51. void RenderConnections(const bool bDrawSelected, const bool bAnySelected);
  52. // Draws a wire from a particular point to a target
  53. const color32 & GetWireColor(const char *pszName, const bool bSelected, const bool bBroken, const bool bAnySelected );
  54. void DrawConnectingWire( float x, float y, CMapEntity *pSource, CEntityConnection *pConnection, CMapEntity *pTarget );
  55. bool m_bUpdateRenderObjects; // Should I build a list of things to render?
  56. CUtlVector<CMapClass *> m_RenderList; // list of current rendered objects
  57. CUtlVector<CMapClass *> m_ConnectionList; // list of all objects which are in the render list of have connections to something in the renderlist
  58. CUtlStack<CMapClass *> m_ConnectionUpdate; // for iteratively determining connectivity
  59. MapClassDict_t m_RenderDict;
  60. // Overrides
  61. // ClassWizard generated virtual function overrides
  62. //{{AFX_VIRTUAL(CMapView2D)
  63. protected:
  64. virtual void OnInitialUpdate(); // first time after construct
  65. //}}AFX_VIRTUAL
  66. // Generated message map functions
  67. //{{AFX_MSG(CMapView2D)
  68. afx_msg void OnTimer(UINT nIDEvent);
  69. //}}AFX_MSG
  70. DECLARE_MESSAGE_MAP()
  71. };
  72. #endif // MAPVIEWLOGICAL_H