blob: ec253ee712fea3ae035355ebcf05102d5afa05b0 (
plain) (
blame)
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
|
#include <vector>
#include <fov.h>
#include <iostream>
#include "util.h"
#include "game.h"
#include "renderer.h"
int main(int, char**)
{
std::random_device randomEngine;
std::mt19937 rng(randomEngine());
try
{
Renderer renderer;
Muxer muxer;
Game game(rng, muxer);
size_t lastTime = SDL_GetTicks();
while (!game.quit)
{
size_t currentTime = SDL_GetTicks();
size_t frameTime = currentTime - lastTime;
lastTime = currentTime;
game.update(frameTime);
renderer.renderGame(game, true);
muxer.update();
}
} catch (const sdl_error& ex)
{
std::cout << "SDL error (" << ex.what() << ")" << std::endl;
} catch (const img_error& ex)
{
std::cout << "SDL_IMG error (" << ex.what() << ")" << std::endl;
}
return 0;
}
|