R-TYPE
Public Member Functions | List of all members
ECS::Hitbox Class Reference

#include <Hitbox.hpp>

Inheritance diagram for ECS::Hitbox:
ECS::IComp

Public Member Functions

 Hitbox (unsigned short sizex, unsigned short sizey) noexcept
 
 Hitbox (const Hitbox &hitbox) noexcept
 
 Hitbox (Hitbox &&) noexcept=delete
 
 ~Hitbox () noexcept override=default
 
Hitboxoperator= (const Hitbox &) const noexcept=delete
 
Hitboxoperator= (Hitbox &&) const noexcept=delete
 
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
 
unsigned short getWidth () const noexcept
 
unsigned short getHeight () const noexcept
 
void setWidth (unsigned short width) noexcept
 
void setHeight (unsigned short height) noexcept
 
- Public Member Functions inherited from ECS::IComp
virtual ~IComp () noexcept=default
 

Constructor & Destructor Documentation

◆ Hitbox() [1/3]

ECS::Hitbox::Hitbox ( unsigned short  sizex,
unsigned short  sizey 
)
explicitnoexcept

It sets the width of the hitbox.

Parameters
sizexThe width of the hitbox.
sizeyThe height of the hitbox.

◆ Hitbox() [2/3]

ECS::Hitbox::Hitbox ( const Hitbox hitbox)
noexcept

Copy constructor.

Parameters
hitboxThe hitbox to copy.

◆ Hitbox() [3/3]

ECS::Hitbox::Hitbox ( Hitbox &&  )
explicitdeletenoexcept

◆ ~Hitbox()

ECS::Hitbox::~Hitbox ( )
overridedefaultnoexcept

Member Function Documentation

◆ getHeight()

unsigned short ECS::Hitbox::getHeight ( ) const
noexcept

It returns the height of the hitbox.

Returns
The height of the hitbox.

◆ getWidth()

unsigned short ECS::Hitbox::getWidth ( ) const
noexcept

It returns the width of the hitbox.

Returns
The width of the hitbox.

◆ isColliding()

bool ECS::Hitbox::isColliding ( const std::shared_ptr< ECS::Position current,
const std::shared_ptr< ECS::Hitbox compare,
const std::shared_ptr< ECS::Position comp 
) const
noexcept

If any of the four corners of the current hitbox are inside the other hitbox, then they are colliding

Parameters
currentThe position of the current entity
compareThe hitbox to compare with
compThe position of the entity you're comparing to
Returns
A boolean.

◆ operator=() [1/2]

Hitbox& ECS::Hitbox::operator= ( const Hitbox ) const
deletenoexcept

◆ operator=() [2/2]

Hitbox& ECS::Hitbox::operator= ( Hitbox &&  ) const
deletenoexcept

◆ setHeight()

void ECS::Hitbox::setHeight ( unsigned short  height)
noexcept

Sets the height of the hitbox.

Parameters
heightThe height of the hitbox.

◆ setWidth()

void ECS::Hitbox::setWidth ( unsigned short  width)
noexcept

Sets the width of the hitbox.

Parameters
widthThe width of the hitbox.

The documentation for this class was generated from the following files: