summaryrefslogtreecommitdiff
path: root/Homework/cs3460/gameoflife/RendererConsole.hpp
blob: 3bbd3dbcd2b3d0ef11007f98bb2a65e6c7f10e88 (plain) (blame)
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
#include "LifeSimulator.hpp"
#include "Renderer.hpp"
#include "rlutil.h"

#include <array>
#include <map>

#ifndef RENDERERCONSOLE_HPP
    #define RENDERERCONSOLE_HPP

class RendererConsole : public Renderer
{
  private:
    std::map<std::pair<std::uint8_t, std::uint8_t>, std::uint8_t> m_previouslyAliveLength;

  public:
    static constexpr std::uint8_t MAX_ALIVE = 4;
    static constexpr std::array<std::pair<std::uint8_t, std::uint8_t>, 4> PRINT_PER_LIFESPAN{
        {
            { '8', rlutil::GREEN },
            { '+', rlutil::BLUE },
            { '-', rlutil::YELLOW },
            { '\'', rlutil::RED },
        }
    };
    virtual void render(const LifeSimulator& simulation);
};

#endif // RENDERERCONSOLE_HPP