aboutsummaryrefslogtreecommitdiff
path: root/include/graphics.hpp
blob: d51b47ae09549598de8bab78b66b8bb1ba0e7dfd (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
#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        drawCell(Game::Cell cell, int y, int x);
    void        handleEvent();
    void        error() const;
};

#endif