DebugDisplay.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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. //----------------------------------------------------------------------------
  24. //
  25. // Westwood Studios Pacific.
  26. //
  27. // Confidential Information
  28. // Copyright (C) 2001 - All Rights Reserved
  29. //
  30. //----------------------------------------------------------------------------
  31. //
  32. // Project: Generals
  33. //
  34. // Module: Debug
  35. //
  36. // File name: GameClient/DebugDisplay.h
  37. //
  38. // Created: 11/13/01 TR
  39. //
  40. //----------------------------------------------------------------------------
  41. #pragma once
  42. #ifndef __GAMECLIENT_DEBUGDISPLAY_H
  43. #define __GAMECLIENT_DEBUGDISPLAY_H
  44. //----------------------------------------------------------------------------
  45. // Includes
  46. //----------------------------------------------------------------------------
  47. #include "Lib/BaseType.h"
  48. #include <stdio.h>
  49. //----------------------------------------------------------------------------
  50. // Forward References
  51. //----------------------------------------------------------------------------
  52. //----------------------------------------------------------------------------
  53. // Type Defines
  54. //----------------------------------------------------------------------------
  55. //===============================
  56. // DebugDisplayInterface
  57. //===============================
  58. class DebugDisplayInterface
  59. {
  60. public:
  61. enum Color
  62. {
  63. WHITE,
  64. BLACK,
  65. YELLOW,
  66. RED,
  67. GREEN,
  68. BLUE,
  69. NUM_COLORS
  70. };
  71. virtual ~DebugDisplayInterface() {};
  72. virtual void printf( Char *format, ...) = 0; ///< Print formatted text at current cursor position
  73. virtual void setCursorPos( Int x, Int y ) = 0; ///< Set new cursor position
  74. virtual Int getCursorXPos( void ) = 0; ///< Get current X position of cursor
  75. virtual Int getCursorYPos( void ) = 0; ///< Get current Y position of cursor
  76. virtual Int getWidth( void ) = 0; ///< Get character width of display
  77. virtual Int getHeight( void ) = 0; ///< Get character height of display
  78. virtual void setTextColor( Color color ) = 0; ///< Set text color
  79. virtual void setRightMargin( Int rightPos ) = 0; ///< Set right margin position
  80. virtual void setLeftMargin( Int leftPos ) = 0; ///< Set left margin position
  81. virtual void reset( void ) = 0; ///< Reset back to default settings
  82. protected:
  83. virtual void drawText( Int x, Int y, Char *text ) = 0; ///< Render null ternimated string at current cursor position
  84. };
  85. //===============================
  86. // DebugDisplay
  87. //===============================
  88. class DebugDisplay : public DebugDisplayInterface
  89. {
  90. public:
  91. DebugDisplay();
  92. virtual ~DebugDisplay() {};
  93. virtual void printf( Char *format, ...); ///< Print formatted text at current cursor position
  94. virtual void setCursorPos( Int x, Int y ); ///< Set new cursor position
  95. virtual Int getCursorXPos( void ); ///< Get current X position of cursor
  96. virtual Int getCursorYPos( void ); ///< Get current Y position of cursor
  97. virtual Int getWidth( void ); ///< Get character width of display
  98. virtual Int getHeight( void ); ///< Get character height of display
  99. virtual void setTextColor( Color color ); ///< set text color
  100. virtual void setRightMargin( Int rightPos ); ///< set right margin position
  101. virtual void setLeftMargin( Int leftPos ); ///< set left margin position
  102. virtual void reset( void ); ///< Reset back to default settings
  103. protected:
  104. Color m_textColor; ///< Color to render text in
  105. Int m_xPos; ///< Current X position of cursor
  106. Int m_yPos; ///< Current Y position of cursor
  107. Int m_width; ///< Character width of display
  108. Int m_height; ///< Character height of display
  109. Int m_rightMargin;///< Right margin position
  110. Int m_leftMargin; ///< Left margin position
  111. };
  112. // displayers
  113. #if defined(_DEBUG) || defined(_INTERNAL)
  114. extern void AudioDebugDisplay( DebugDisplayInterface *debugDisplay, void *userData, FILE *fp );
  115. #endif
  116. //----------------------------------------------------------------------------
  117. // Inlining
  118. //----------------------------------------------------------------------------
  119. #endif // __GAMECLIENT_DEBUGDISPLAY_H