-
Notifications
You must be signed in to change notification settings - Fork 2
/
TTengine.h
84 lines (69 loc) · 2.31 KB
/
TTengine.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright © 2013 Tom Tondeur
//
// This file is part of tt::Engine.
//
// tt::Engine is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// tt::Engine is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with tt::Engine. If not, see <http://www.gnu.org/licenses/>.
// __ __ ______ _
// / /_/ /__ _ / ____/___ ____ _(_)___ ___
// / __/ __(_|_) __/ / __ \/ __ `/ / __ \/ _ \
// / /_/ /__ _ / /___/ / / / /_/ / / / / / __/
// \__/\__(_|_)_____/_/ /_/\__, /_/_/ /_/\___/
// /____/
//
// TTengine.h : Bridges Win32 and OOP, contains main game loop
//
#pragma once
//------------
// Includes
//------------
#include "Helpers/Namespace.h"
#include "Timer.h"
#include "Helpers/resrc_ptr.hpp"
//Forward declarations
class AbstractGame;
class SpriteFont;
//--------------------------------
// TTengine Declaration
//--------------------------------
class TTengine
{
public:
// Default constructor, destructor
TTengine(void);
virtual ~TTengine(void);
//Overloaded operators
void Initialize(void);
// Methods
static TTengine* GetInstance(void);
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
void SetGame(AbstractGame* pGame);
void Run(void);
private:
// Internal methods
int InitWindow(HINSTANCE hInstance);
LRESULT HandleWM(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static DWORD GameLoopProc(TTengine* pThis);
DWORD GameLoop(void);
// Datamembers
static TTengine* m_pEngineInstance;
AbstractGame* m_pGame;
bool m_bProgramTerminated;
tt::GameContext m_GameContext;
resource_ptr<SpriteFont> m_pDefaultFont;
unsigned int m_FrameCounter;
float m_TimeElapsedSinceLastSecond;
//Disabled copy constructor & assignment operator
TTengine(TTengine& source);// = delete;
TTengine& operator=(const TTengine& src);// = delete;
};