aboutsummaryrefslogtreecommitdiffstats
path: root/include/game.hpp
blob: 1991ebef5025189a6e01b85ace3e72e6f39586e1 (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
#ifndef GAME_HPP
#define GAME_HPP

#include "glsl_program.hpp"
#include "gl_texture.hpp"
#include "sprite.hpp"

#include <GL/glew.h>
#include <SDL2/SDL.h>

#include <memory>
#include <vector>

enum class GameState
{
    PLAY,
    EXIT
};

class Game
{
private:
    SDL_Window *window_ = nullptr;
    int width_ = 1280;
    int height_ = 720;
    GameState game_state_ = GameState::PLAY;
    float time_ = 0;

    // Temporary program
    GlslProgram program_;
    std::vector<std::shared_ptr<Sprite>> sprites_;

    void initSystems();
    void initShaders();
    void processInput();
    void gameLoop();
    void drawGame();
    float calculateFps();
public:
    Game();
    ~Game();

    void run();
};

#endif