debugging.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. //***************************************************************************
  2. //
  3. // Debugging.h -- File contains the MechCommander Debugging Definitions
  4. //
  5. // MechCommander 2
  6. //
  7. //---------------------------------------------------------------------------//
  8. // Copyright (C) Microsoft Corporation. All rights reserved. //
  9. //===========================================================================//
  10. #ifndef DEBUGGING_H
  11. #define DEBUGGING_H
  12. #include <stdio.h>
  13. #include <GameOS\GameOS.hpp>
  14. //#include <GameOS\ToolOS.hpp>
  15. //---------------------------------------------------------------------------
  16. #define MAX_DEBUG_WINDOW_LINES 6
  17. #define MAX_DEBUG_WINDOW_LINELEN 256
  18. class GameDebugWindow {
  19. public:
  20. bool display;
  21. long pos[2];
  22. char textBuffer[MAX_DEBUG_WINDOW_LINES][MAX_DEBUG_WINDOW_LINELEN];
  23. long linePos;
  24. long numLines;
  25. static HGOSFONT3D font;
  26. static long fontHeight;
  27. public:
  28. void init (void) {
  29. display = false;
  30. pos[0] = 0;
  31. pos[1] = 0;
  32. linePos = 0;
  33. numLines = 0;
  34. for (long i = 0; i < MAX_DEBUG_WINDOW_LINES; i++)
  35. textBuffer[i][0] = NULL;
  36. }
  37. GameDebugWindow (void) {
  38. init();
  39. }
  40. void setPos (long x, long y) {
  41. pos[0] = x;
  42. pos[1] = y;
  43. }
  44. void open (long x = -1, long y = -1) {
  45. if ((x > -1) && (y > -1))
  46. setPos(x, y);
  47. display = true;
  48. }
  49. void close (void) {
  50. display = false;
  51. }
  52. void toggle (void) {
  53. if (display)
  54. close();
  55. else
  56. open();
  57. }
  58. ~GameDebugWindow (void) {
  59. destroy();
  60. }
  61. virtual void destroy (void) {
  62. }
  63. void print (char* s);
  64. void render (void);
  65. void clear (void) {
  66. numLines = 0;
  67. for (long i = 0; i < MAX_DEBUG_WINDOW_LINES; i++)
  68. textBuffer[i][0] = NULL;
  69. }
  70. static void setFont (char* fontFile);
  71. };
  72. //***************************************************************************
  73. #endif