GraphDraw.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: GraphDraw.h //////////////////////////////////////////////////////////
  24. //-----------------------------------------------------------------------------
  25. //
  26. // Electronic Arts Pacific.
  27. //
  28. // Confidential Information
  29. // Copyright (C) 2002 - All Rights Reserved
  30. //
  31. //-----------------------------------------------------------------------------
  32. //
  33. // created: Aug 2002
  34. //
  35. // Filename: GraphDraw.h
  36. //
  37. // author: John McDonald
  38. //
  39. // purpose: Contains the functions to queue up and display a single graph for
  40. // each frame. Note: This class is presently only intended for use by
  41. // the Performance timers, all though it could be easily adapted for
  42. // other purposes.
  43. //
  44. //-----------------------------------------------------------------------------
  45. ///////////////////////////////////////////////////////////////////////////////
  46. #pragma once
  47. #ifndef __GRAPHDRAW_H__
  48. #define __GRAPHDRAW_H__
  49. #include "Common/PerfTimer.h"
  50. #include "Common/STLTypedefs.h"
  51. #ifdef PERF_TIMERS
  52. typedef std::pair<AsciiString, Real> PairAsciiStringReal;
  53. typedef std::vector<PairAsciiStringReal> VecGraphEntries;
  54. typedef VecGraphEntries::iterator VecGraphEntriesIt;
  55. enum { MAX_GRAPH_VALUES = 36 };
  56. enum { BAR_HEIGHT = 14 };
  57. enum { BAR_SPACE = 2 };
  58. class DisplayString;
  59. class GraphDraw
  60. {
  61. public:
  62. GraphDraw();
  63. virtual ~GraphDraw();
  64. void addEntry(AsciiString str, Real val);
  65. // Called during begin/end
  66. void render();
  67. void clear();
  68. protected:
  69. VecGraphEntries m_graphEntries;
  70. DisplayString *m_displayStrings[MAX_GRAPH_VALUES];
  71. };
  72. extern GraphDraw *TheGraphDraw;
  73. #endif /* PERF_TIMERS */
  74. #endif /* __GRAPHDRAW_H__ */