R-Type
Public Member Functions | Public Attributes | List of all members
GameEngine::Rect< T > Class Template Reference

class representing a rect More...

#include <Rect.hpp>

Inheritance diagram for GameEngine::Rect< T >:
GameEngine::IRect< T, sf::Rect >

Public Member Functions

 Rect ()=default
 constructor More...
 
 Rect (T l, T t, T w, T h)
 constructor More...
 
 ~Rect ()=default
 destructor More...
 
const sf::Rect< T > getBaseRect () const override
 get the rect stored in the class More...
 
bool isColliding (const Vector2< T > &pos, const Rect< T > &rect, const Vector2< T > &rectPos) const
 check the collision between two objects More...
 
void handleCollisionFromRect (Vector2< T > &pos, const Rect< T > &rect, const Vector2< T > &rectPos)
 
- Public Member Functions inherited from GameEngine::IRect< T, sf::Rect >
 ~IRect ()=default
 Destructor. More...
 

Public Attributes

left
 
top
 
width
 
height
 

Detailed Description

template<typename T>
class GameEngine::Rect< T >

class representing a rect

Template Parameters
Tthe type contained in the rect

Constructor & Destructor Documentation

◆ Rect() [1/2]

template<typename T >
GameEngine::Rect< T >::Rect ( )
default

constructor

◆ Rect() [2/2]

template<typename T >
GameEngine::Rect< T >::Rect ( l,
t,
w,
h 
)
inline

constructor

Parameters
lleft coordinate
ttop coordinate
wthe width of the rect
hthe height of the rect

◆ ~Rect()

template<typename T >
GameEngine::Rect< T >::~Rect ( )
default

destructor

Member Function Documentation

◆ getBaseRect()

template<typename T >
const sf::Rect<T> GameEngine::Rect< T >::getBaseRect ( ) const
inlineoverridevirtual

get the rect stored in the class

Returns
rect of type T

Implements GameEngine::IRect< T, sf::Rect >.

◆ handleCollisionFromRect()

template<typename T >
void GameEngine::Rect< T >::handleCollisionFromRect ( Vector2< T > &  pos,
const Rect< T > &  rect,
const Vector2< T > &  rectPos 
)
inline
Parameters
pos
rect
rectPos

◆ isColliding()

template<typename T >
bool GameEngine::Rect< T >::isColliding ( const Vector2< T > &  pos,
const Rect< T > &  rect,
const Vector2< T > &  rectPos 
) const
inline

check the collision between two objects

Parameters
pos
rect
rectPosposition of rect
Returns
boolean that indicates if a collision is made

Member Data Documentation

◆ height

template<typename T >
T GameEngine::Rect< T >::height

◆ left

template<typename T >
T GameEngine::Rect< T >::left

◆ top

template<typename T >
T GameEngine::Rect< T >::top

◆ width

template<typename T >
T GameEngine::Rect< T >::width

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