summaryrefslogtreecommitdiff
path: root/src/helpers/DamageRing.hpp
blob: 4750648becb13033b9698d47bd760dca36819311 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once

#include "./math/Math.hpp"
#include <array>

constexpr static int DAMAGE_RING_PREVIOUS_LEN = 3;

class CDamageRing {
  public:
    void    setSize(const Vector2D& size_);
    bool    damage(const CRegion& rg);
    void    damageEntire();
    void    rotate();
    CRegion getBufferDamage(int age);
    bool    hasChanged();

  private:
    Vector2D                                      m_size;
    CRegion                                       m_current;
    std::array<CRegion, DAMAGE_RING_PREVIOUS_LEN> m_previous;
    size_t                                        m_previousIdx = 0;
};