LPCGame
A Simple 2d Game Engine
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Rect< T > Class Template Reference

A rectangle. More...

#include <rect.h>

Public Member Functions

 Rect (T pX, T pY, T pW, T pH)
 
 Rect (Vector2< T > pPos, T pW, T pH)
 
 Rect (Json::Value val)
 
void Set (const Rect< T > &r)
 
void Set (T pX, T pY, T pW, T pH)
 
void Set (Vector2< T > pPos, T pW, T pH)
 
void Set (T pX, T pY)
 
void Set (Vector2< T > pPos)
 
Vector2< T > Pos () const
 Get the rect's position vector.
 
X () const
 Get x value.
 
Y () const
 Get y value.
 
W () const
 Get width.
 
H () const
 Get height.
 
Json::Value Save () const
 
void Load (Json::Value val)
 
bool operator== (Rect< T > r) const
 Operators.
 
Rect< T > & operator+= (Vector2f vec)
 
Rect< T > operator+ (const Vector2f v) const
 
Rect< T > operator- (const Vector2f v) const
 
 operator SDL_Rect () const
 For conversions.
 
 operator Rect< float > () const
 
 operator Rect< int > () const
 
 operator std::string () const
 

Public Attributes

Vector2< T > pos
 
w
 
h
 

Detailed Description

template<class T>
class Rect< T >

A rectangle.

Describes a rectangle, can use ints, floats or doubles to represent its values

Constructor & Destructor Documentation

template<class T>
Rect< T >::Rect ( pX,
pY,
pW,
pH 
)
inline

Construct the rect and set its properties

Parameters
pXThe x position
pYThe y position
pWThe width
pHThe height
template<class T>
Rect< T >::Rect ( Vector2< T >  pPos,
pW,
pH 
)
inline

Construct the rect and set its properties

Parameters
pPosThe position, as a vector
pWThe width
pHThe height
template<class T>
Rect< T >::Rect ( Json::Value  val)
inline

Set the rect's properties

Parameters
valThe Json::Value containing x, y, w, h

Member Function Documentation

template<class T>
void Rect< T >::Load ( Json::Value  val)
inline

Load the box's properties from a Json::Value

Parameters
valThe Json::Value containing the properties to load
template<class T>
Json::Value Rect< T >::Save ( ) const
inline

Save the box's properties to a Json::Value and return it

Returns
Json::Value containing the box's properties
template<class T>
void Rect< T >::Set ( const Rect< T > &  r)
inline

Set the rect to have the same values as some other rect

Parameters
rThe Rect to get values from
template<class T>
void Rect< T >::Set ( pX,
pY,
pW,
pH 
)
inline

Set the rect's properties

Parameters
pXThe x position
pYThe y position
pWThe width
pHThe height
template<class T>
void Rect< T >::Set ( Vector2< T >  pPos,
pW,
pH 
)
inline

Set the rect's properties

Parameters
pPosThe position, as a vector
pWThe width
pHThe height
template<class T>
void Rect< T >::Set ( pX,
pY 
)
inline

Set the rect's position

Parameters
pXThe x position
pYThe y position
template<class T>
void Rect< T >::Set ( Vector2< T >  pPos)
inline

Set the rect's position

Parameters
pPosThe position vector

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