aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/helpers/DamageRing.hpp
blob: ae85c45362ee4e429a4349282249aa2f28b01bdf (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                                      size;
    CRegion                                       current;
    std::array<CRegion, DAMAGE_RING_PREVIOUS_LEN> previous;
    size_t                                        previousIdx = 0;
};