Guest User

Untitled

a guest
Oct 16th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.81 KB | None | 0 0
  1. //-----------------------------------------------------------------
  2. // Game Engine Object
  3. // C++ Header - GameEngine.h
  4. //-----------------------------------------------------------------
  5.  
  6. #pragma once
  7.  
  8. //-----------------------------------------------------------------
  9. // Include Files
  10. //-----------------------------------------------------------------
  11. #include <windows.h>
  12.  
  13. //-----------------------------------------------------------------
  14. // Windows Function Declarations
  15. //-----------------------------------------------------------------
  16. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  17. PSTR szCmdLine, int iCmdShow);
  18. LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
  19.  
  20. //-----------------------------------------------------------------
  21. // Game Engine Function Declarations
  22. //-----------------------------------------------------------------
  23. BOOL GameInitialize(HINSTANCE hInstance);
  24. void GameStart(HWND hWindow);
  25. void GameEnd();
  26. void GameActivate(HWND hWindow);
  27. void GameDeactivate(HWND hWindow);
  28. void GamePaint(HDC hDC);
  29. void GameCycle();
  30. int Welcome ();
  31. void MouseButtonDown(int x, int y, BOOL bLeft);
  32.  
  33. //-----------------------------------------------------------------
  34. // GameEngine Class
  35. //-----------------------------------------------------------------
  36. class GameEngine
  37. {
  38. protected:
  39. // Member Variables
  40. static GameEngine* m_pGameEngine;
  41. HINSTANCE m_hInstance;
  42. HWND m_hWindow;
  43. TCHAR m_szWindowClass[32];
  44. TCHAR m_szTitle[32];
  45. WORD m_wIcon, m_wSmallIcon;
  46. int m_iWidth, m_iHeight;
  47. int m_iFrameDelay;
  48. BOOL m_bSleep;
  49.  
  50. public:
  51. // Constructor(s)/Destructor
  52. GameEngine(HINSTANCE hInstance, LPTSTR szWindowClass, LPTSTR szTitle,
  53. WORD wIcon, WORD wSmallIcon, int iWidth = 640, int iHeight = 480);
  54. virtual ~GameEngine();
  55.  
  56. // General Methods
  57. static GameEngine* GetEngine() { return m_pGameEngine; };
  58. BOOL Initialize(int iCmdShow);
  59. LRESULT HandleEvent(HWND hWindow, UINT msg, WPARAM wParam,
  60. LPARAM lParam);
  61.  
  62. // Accessor Methods
  63. HINSTANCE GetInstance() { return m_hInstance; };
  64. HWND GetWindow() { return m_hWindow; };
  65. void SetWindow(HWND hWindow) { m_hWindow = hWindow; };
  66. LPTSTR GetTitle() { return m_szTitle; };
  67. WORD GetIcon() { return m_wIcon; };
  68. WORD GetSmallIcon() { return m_wSmallIcon; };
  69. int GetWidth() { return m_iWidth; };
  70. int GetHeight() { return m_iHeight; };
  71. int GetFrameDelay() { return m_iFrameDelay; };
  72. void SetFrameRate(int iFrameRate) { m_iFrameDelay = 1000 /
  73. iFrameRate; };
  74. BOOL GetSleep() { return m_bSleep; };
  75. void SetSleep(BOOL bSleep) { m_bSleep = bSleep; };
  76. };
  77. //
Add Comment
Please, Sign In to add comment