-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgame_loop.cpp
45 lines (36 loc) · 1.09 KB
/
game_loop.cpp
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
/*
This file is part of Heroes of Wesnoth.
Copyright (C) 2007, 2008, 2009 Jon Ander Peñalba <[email protected]>
Heroes of Wesnoth is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation.
Heroes of Wesnoth 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 Heroes of Wesnoth. If not, see <http://www.gnu.org/licenses/>
*/
#include "game_loop.hpp"
#include "events.hpp"
#include "graphics.hpp"
#include "timer.hpp"
// Constructor
GameLoop::GameLoop(void) {
fps = new Timer;
}
// Destructor
GameLoop::~GameLoop(void) {
delete fps;
}
// Starts the loop
void GameLoop::loop(void) {
done = false;
while (!done) {
fps->start();
events_engine::input->readInput();
done = frame();
video_engine::screen->update();
fps->end(30);
}
}