Advertisement
huutho_96

Constants.h V1

Sep 16th, 2016
2,064
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma once
  2. #ifndef CONSTANTS_H
  3. #define CONSTANTS_H
  4.  
  5. const int WINDOW_WIDTH  = 640;
  6. const int WINDOW_HEIGHT = 480;
  7. const char* APP_NAME = "5T&H";
  8. const char* WINDOW_NAME = "DIRECTX";
  9.  
  10. bool FULLSCREEN = false;
  11.  
  12. template <typename T>
  13. void SafeRelease(T &ptr)
  14. {
  15.     if (ptr)
  16.     {
  17.         ptr->Release();
  18.         ptr = NULL;
  19.     }
  20. }
  21. #define SAFE_RELEASE SafeRelease;
  22.  
  23. template <typename T>
  24. void SafeDelete(T &ptr)
  25. {
  26.     if (ptr)
  27.     {
  28.         delete ptr;
  29.         ptr = NULL;
  30.     }
  31. }
  32. #define SAFE_DELETE SafeDelete;
  33.  
  34. template <typename T>
  35. void SafeDeleteArray(T &ptr)
  36. {
  37.     if (ptr)
  38.     {
  39.         delete[] ptr;
  40.         ptr = NULL;
  41.     }
  42. }
  43. #define SAFE_DELETE_ARRAY SafeDeleteArray;
  44.  
  45.  
  46. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement