summaryrefslogtreecommitdiff
path: root/src/helpers/DamageRing.hpp
blob: f53d6bf083612ebc0bb7f9b7848d8ec08846f5b9 (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 = 2;

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;
};