aboutsummaryrefslogtreecommitdiff
path: root/include/graphics.hpp
blob: ef0c813bda8bc6c1e7e6f5feb6ab52845454162f (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
#ifndef GRAPHICS_HPP
# define GRAPHICS_HPP

#include <iostream>
#include <string>
#include <SDL2/SDL.h>
#include "game.hpp"

class Graphics
{
    public:
    Graphics(Game &game, std::string title, int width, int height);
    ~Graphics();

    void update();
    bool isRunning() const;

    private:
    bool         m_running;
    Game         &m_game;
    std::string  m_title;
    int          m_width;
    int          m_height;
    SDL_Renderer *m_renderer;
    SDL_Window   *m_window;

    void        drawGame();
    void        handleEvent();
    void        error() const;
};

#endif