aboutsummaryrefslogtreecommitdiffstats
path: root/yage/entity/engine.cpp
blob: 503dc9196697a311a0d2b47043640ec11c44f46f (plain)
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
/** ---------------------------------------------------------------------------
 * @file: engine.cpp
 *
 * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
 * MIT License, see LICENSE file for more details.
 * ----------------------------------------------------------------------------
 */

#include "engine.h"

#include "space.h"
#include "entity.h"

namespace yage
{

void Engine::init()
{
    window_.create("Game Engine", 800, 640);
}

void Engine::mainLoop()
{
    while (!window_.shouldClose()) {
        window_.clearBuffer();

        update();

        window_.swapBuffer();
    }
}

void Engine::update()
{
    for(auto &space : spaces_) {
        
    }
}

void Engine::addSpace(std::unique_ptr<Space> space)
{
    spaces_.push_back(std::move(space));
}

Engine &Engine::instance()
{
    static Engine engine_instance;

    return engine_instance;
}

} // namespace yage