R-TYPE
Hitbox.hpp
Go to the documentation of this file.
1 #ifndef _HITBOX
2 #define _HITBOX
3 
4 #include "IComp.hpp"
5 #include "Position.hpp"
6 #include <memory>
7 
8 namespace ECS {
9 
10 class Hitbox : public IComp {
11 public:
12  explicit Hitbox(unsigned short sizex, unsigned short sizey) noexcept;
13  Hitbox(const Hitbox& hitbox) noexcept;
14  explicit Hitbox(Hitbox&&) noexcept = delete;
15  ~Hitbox() noexcept override = default;
16 
17  Hitbox& operator=(const Hitbox&) const noexcept = delete;
18  Hitbox& operator=(Hitbox&&) const noexcept = delete;
19 
20  [[nodiscard]] bool isColliding(const std::shared_ptr<ECS::Position> current, const std::shared_ptr<ECS::Hitbox> compare, const std::shared_ptr<ECS::Position> comp) const noexcept;
21  [[nodiscard]] unsigned short getWidth() const noexcept;
22  [[nodiscard]] unsigned short getHeight() const noexcept;
23  void setWidth(unsigned short width) noexcept;
24  void setHeight(unsigned short height) noexcept;
25 
26 private:
27  unsigned short _sizex;
28  unsigned short _sizey;
29 };
30 };
31 
32 #endif
Definition: Hitbox.hpp:10
void setHeight(unsigned short height) noexcept
Definition: Hitbox.cpp:54
Hitbox(unsigned short sizex, unsigned short sizey) noexcept
Definition: Hitbox.cpp:11
bool isColliding(const std::shared_ptr< ECS::Position > current, const std::shared_ptr< ECS::Hitbox > compare, const std::shared_ptr< ECS::Position > comp) const noexcept
Definition: Hitbox.cpp:66
unsigned short getHeight() const noexcept
Definition: Hitbox.cpp:40
unsigned short getWidth() const noexcept
Definition: Hitbox.cpp:33
void setWidth(unsigned short width) noexcept
Definition: Hitbox.cpp:47
Hitbox(Hitbox &&) noexcept=delete
Definition: IComp.hpp:7
Definition: Position.hpp:8
Definition: ComponentManager.hpp:14