aboutsummaryrefslogtreecommitdiff
path: root/src/games/Game.cpp
blob: 7ed94eb7cae31eaf26e1b26548bc30716347d3a9 (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
#include <games/Game.hpp>
#include <games/tetris/Tetris.hpp>
#include <games/snake/Snake.hpp>
#include <games/minesweeper/Minesweeper.hpp>
#include <games/breakout/Breakout.hpp>

#include <assert.h>
#include <memory>


std::unique_ptr<Game>
Game::Select(GameType type)
{
    switch (type) {
    case no_game: {
        return nullptr;
    } break;

    case tetris: {
        return std::make_unique<Tetris>();
    } break;

    case snake: {
        return std::make_unique<Snake>();
    } break;

    case minesweeper: {
        return std::make_unique<Minesweeper>();
    } break;

    case breakout: {
        return std::make_unique<Breakout>();
    } break;

    InvalidDefaultCase;
    }

    return nullptr;
}