GameCodeStd.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. #pragma once
  2. //========================================================================
  3. // GameCodeStd.h : include file for standard system include files,
  4. // or project specific include files that are used frequently, but
  5. // are changed infrequently
  6. //
  7. // GameCode4 is the sample application that encapsulates much of the source code
  8. // discussed in "Game Coding Complete - 4th Edition" by Mike McShaffry and David
  9. // "Rez" Graham, published by Charles River Media.
  10. // ISBN-10: 1133776574 | ISBN-13: 978-1133776574
  11. //
  12. // If this source code has found it's way to you, and you think it has helped you
  13. // in any way, do the authors a favor and buy a new copy of the book - there are
  14. // detailed explanations in it that compliment this code well. Buy a copy at Amazon.com
  15. // by clicking here:
  16. // http://www.amazon.com/gp/product/1133776574/ref=olp_product_details?ie=UTF8&me=&seller=
  17. //
  18. // There's a companion web site at http://www.mcshaffry.com/GameCode/
  19. //
  20. // The source code is managed and maintained through Google Code:
  21. // http://code.google.com/p/gamecode4/
  22. //
  23. // (c) Copyright 2012 Michael L. McShaffry and David Graham
  24. //
  25. // This program is free software; you can redistribute it and/or
  26. // modify it under the terms of the GNU Lesser GPL v3
  27. // as published by the Free Software Foundation.
  28. //
  29. // This program is distributed in the hope that it will be useful,
  30. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  31. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  32. // http://www.gnu.org/licenses/lgpl-3.0.txt for more details.
  33. //
  34. // You should have received a copy of the GNU Lesser GPL v3
  35. // along with this program; if not, write to the Free Software
  36. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  37. //
  38. //========================================================================
  39. // C RunTime Header Files
  40. #include <stdlib.h>
  41. #include <malloc.h>
  42. #include <memory.h>
  43. // #include <tchar.h>
  44. // TODO(munnellg) - delete these when done
  45. #include <iostream>
  46. #include <iomanip>
  47. // #include <mmsystem.h>
  48. #include <algorithm>
  49. #include <string>
  50. #include <list>
  51. #include <vector>
  52. #include <queue>
  53. #include <map>
  54. // OpenGL / SDL2 includes
  55. // will go here
  56. #include <tinyxml.h>
  57. // fast delegate stuff
  58. #include <FastDelegate.h>
  59. using fastdelegate::MakeDelegate;
  60. // GameCode #includes
  61. #include "../Debugging/Logger.h" // this should be the first of the gcc includes since it defines GCC_ASSERT()
  62. #include "../Utilities/types.h"
  63. #include "../Utilities/templates.h"
  64. #include "../Graphics3D/Geometry.h"
  65. typedef glm::vec4 Color;
  66. extern Color g_White;
  67. extern Color g_Black;
  68. extern Color g_Cyan;
  69. extern Color g_Red;
  70. extern Color g_Green;
  71. extern Color g_Blue;
  72. extern Color g_Yellow;
  73. extern Color g_Gray40;
  74. extern Color g_Gray25;
  75. extern Color g_Gray65;
  76. extern Color g_Transparent;
  77. extern glm::vec3 g_Up;
  78. extern glm::vec3 g_Right;
  79. extern glm::vec3 g_Forward;
  80. extern glm::vec4 g_Up4;
  81. extern glm::vec4 g_Right4;
  82. extern glm::vec4 g_Forward4;
  83. class GCC_noncopyable
  84. {
  85. private:
  86. GCC_noncopyable(const GCC_noncopyable& x);
  87. GCC_noncopyable& operator=(const GCC_noncopyable& x);
  88. public:
  89. GCC_noncopyable() {}; // Default constructor
  90. };
  91. // TODO(munnellg): Update to the correct reference
  92. // Game Code Complete - Chapter 12, page 446-447
  93. #if defined(_DEBUG)
  94. # define GCC_NEW new(_NORMAL_BLOCK,__FILE__, __LINE__)
  95. #else
  96. # define GCC_NEW new
  97. #endif
  98. // Useful #defines
  99. // TODO(munnellg) - delete this when we're done with all that Window kruft
  100. #define MAX_PATH 260
  101. extern const float fOPAQUE;
  102. extern const int iOPAQUE;
  103. extern const float fTRANSPARENT;
  104. extern const int iTRANSPARENT;
  105. extern const int MEGABYTE;
  106. extern const float SIXTY_HERTZ;
  107. extern const int SCREEN_WIDTH;
  108. extern const int SCREEN_HEIGHT;
  109. #if !defined(SAFE_DELETE)
  110. #define SAFE_DELETE(x) do { if(x) delete x; x = NULL; } while(0)
  111. #endif
  112. #if !defined(SAFE_DELETE_ARRAY)
  113. #define SAFE_DELETE_ARRAY(x) do { if(x) delete [] x; x = NULL; } while(0)
  114. #endif
  115. #if !defined(SAFE_RELEASE)
  116. #define SAFE_RELEASE(x) do { if(x) x->Release(); x = NULL; } while(0)
  117. #endif
  118. #include "../GameCode4/GameCode.h"
  119. extern int GameCode4(int argc, char** argv);