ClanLib  2.3.7
List of all members
CL_Quadx< Type > Class Template Reference

2D quad structure. More...

#include <quad.h>

Inheritance diagram for CL_Quadx< Type >:
Inheritance graph
[legend]

Public Member Functions

Construction
 CL_Quadx ()
 Constructs a quad. More...
 
 CL_Quadx (const CL_Vec2< Type > &new_p, const CL_Vec2< Type > &new_q, const CL_Vec2< Type > &new_r, const CL_Vec2< Type > &new_s)
 Constructs a quad. More...
 
 CL_Quadx (const CL_Rectx< Type > &rect)
 Constructs a quad. More...
 
 CL_Quadx (const CL_Quadx< Type > &quad)
 Constructs a quad. More...
 
CL_Quadx< Type > & operator+= (const CL_Quadx< Type > &quad)
 Quad += Quad operator. More...
 
CL_Quadx< Type > & operator-= (const CL_Quadx< Type > &quad)
 Quad -= Quad operator. More...
 
CL_Quadx< Type > & operator+= (const CL_Vec2< Type > &point)
 Quad += Point operator. More...
 
CL_Quadx< Type > & operator-= (const CL_Vec2< Type > &point)
 Quad -= Point operator. More...
 
CL_Quadx< Type > operator+ (const CL_Quadx< Type > &quad) const
 Quad + Quad operator. More...
 
CL_Quadx< Type > operator- (const CL_Quadx< Type > &quad) const
 Quad - Quad operator. More...
 
CL_Quadx< Type > operator+ (const CL_Vec2< Type > &point) const
 Quad + Point operator. More...
 
CL_Quadx< Type > operator- (const CL_Vec2< Type > &point) const
 Quad - Point operator. More...
 
bool operator== (const CL_Quadx< Type > &quad) const
 Quad == Quad operator. More...
 
bool operator!= (const CL_Quadx< Type > &quad) const
 Quad != Quad operator. More...
 
Operations
CL_Quadx< Type > & rotate (const CL_Vec2< Type > &hotspot, const CL_Angle &angle)
 Rotates the Quad. More...
 
CL_Quadx< Type > & scale (float sx, float sy)
 Scale the Quad. More...
 
CL_Quadx< Type > & scale (const CL_Vec2< Type > &hotspot, float sx, float sy)
 Scale the Quad. More...
 
CL_Vec2< Type > center () const
 Returns the center point of the quad. More...
 
CL_Quadx< Type > & apply_alignment (CL_Origin origin, Type x, Type y)
 Applies an origin and offset pair to this rectangle. More...
 

Attributes

CL_Vec2< Type > p
 First Point. More...
 
CL_Vec2< Type > q
 Second Point. More...
 
CL_Vec2< Type > r
 Third Point. More...
 
CL_Vec2< Type > s
 Fourth Point. More...
 
Type get_width () const
 Returns the width of the quad. More...
 
Type get_height () const
 Returns the height of the quad. More...
 
CL_Sizex< Type > get_size () const
 Returns the size of the rectangle. More...
 
CL_Rect get_bounds () const
 Returns the bounding box of the quad as a CL_Rect. More...
 

Detailed Description

template<typename Type>
class CL_Quadx< Type >

2D quad structure.

These quads templates are defined for: int (CL_Quad), float (CL_Quadf), double (CL_Quadd)

Constructor & Destructor Documentation

template<typename Type>
CL_Quadx< Type >::CL_Quadx ( )
inline

Constructs a quad.

template<typename Type>
CL_Quadx< Type >::CL_Quadx ( const CL_Vec2< Type > &  new_p,
const CL_Vec2< Type > &  new_q,
const CL_Vec2< Type > &  new_r,
const CL_Vec2< Type > &  new_s 
)
inline

Constructs a quad.

Parameters
new_p= coord for first point of quad.
new_q= coord for second point of quad.
new_r= coord for third point of quad.
new_s= coord for forth point of quad.
template<typename Type>
CL_Quadx< Type >::CL_Quadx ( const CL_Rectx< Type > &  rect)
inline

Constructs a quad.

Parameters
rectRectangle used to initialize the quad.

The corners of the rect are mapped to the quad member variables as follows:

  • Top-left: p
  • Top-right: q
  • Bottom-right: r
  • Bottom-left: s
template<typename Type>
CL_Quadx< Type >::CL_Quadx ( const CL_Quadx< Type > &  quad)
inline

Constructs a quad.

Parameters
quad= Quad used to initialize this quad.

Member Function Documentation

template<typename Type>
CL_Quadx<Type>& CL_Quadx< Type >::apply_alignment ( CL_Origin  origin,
Type  x,
Type  y 
)

Applies an origin and offset pair to this rectangle.

Parameters
originThe new origin to adjust to from default upper-left position
x,yOffsets applied negatively to each corner of the rectangle
Returns
reference to this object
template<typename Type>
CL_Vec2<Type> CL_Quadx< Type >::center ( ) const

Returns the center point of the quad.

template<typename Type>
CL_Rect CL_Quadx< Type >::get_bounds ( ) const

Returns the bounding box of the quad as a CL_Rect.

template<typename Type>
Type CL_Quadx< Type >::get_height ( ) const

Returns the height of the quad.

template<typename Type>
CL_Sizex<Type> CL_Quadx< Type >::get_size ( ) const
inline

Returns the size of the rectangle.

template<typename Type>
Type CL_Quadx< Type >::get_width ( ) const

Returns the width of the quad.

template<typename Type>
bool CL_Quadx< Type >::operator!= ( const CL_Quadx< Type > &  quad) const
inline

Quad != Quad operator.

template<typename Type>
CL_Quadx<Type> CL_Quadx< Type >::operator+ ( const CL_Quadx< Type > &  quad) const
inline

Quad + Quad operator.

template<typename Type>
CL_Quadx<Type> CL_Quadx< Type >::operator+ ( const CL_Vec2< Type > &  point) const
inline

Quad + Point operator.

template<typename Type>
CL_Quadx<Type>& CL_Quadx< Type >::operator+= ( const CL_Quadx< Type > &  quad)
inline

Quad += Quad operator.

template<typename Type>
CL_Quadx<Type>& CL_Quadx< Type >::operator+= ( const CL_Vec2< Type > &  point)
inline

Quad += Point operator.

template<typename Type>
CL_Quadx<Type> CL_Quadx< Type >::operator- ( const CL_Quadx< Type > &  quad) const
inline

Quad - Quad operator.

template<typename Type>
CL_Quadx<Type> CL_Quadx< Type >::operator- ( const CL_Vec2< Type > &  point) const
inline

Quad - Point operator.

template<typename Type>
CL_Quadx<Type>& CL_Quadx< Type >::operator-= ( const CL_Quadx< Type > &  quad)
inline

Quad -= Quad operator.

template<typename Type>
CL_Quadx<Type>& CL_Quadx< Type >::operator-= ( const CL_Vec2< Type > &  point)
inline

Quad -= Point operator.

template<typename Type>
bool CL_Quadx< Type >::operator== ( const CL_Quadx< Type > &  quad) const
inline

Quad == Quad operator.

template<typename Type>
CL_Quadx<Type>& CL_Quadx< Type >::rotate ( const CL_Vec2< Type > &  hotspot,
const CL_Angle angle 
)

Rotates the Quad.

Parameters
hotspotPoint to rotate around.
angleAngle to rotate in degrees.
Returns
reference to this object
template<typename Type>
CL_Quadx<Type>& CL_Quadx< Type >::scale ( float  sx,
float  sy 
)

Scale the Quad.

Parameters
sx= Scale value in x-axis
sy= Scale value in y-axis
Returns
reference to this object
template<typename Type>
CL_Quadx<Type>& CL_Quadx< Type >::scale ( const CL_Vec2< Type > &  hotspot,
float  sx,
float  sy 
)

Scale the Quad.

Parameters
sx= Scale value in x-axis
sy= Scale value in y-axis
hotspot= Point to scale around.
Returns
reference to this object

Member Data Documentation

template<typename Type>
CL_Vec2<Type> CL_Quadx< Type >::p
template<typename Type>
CL_Vec2<Type> CL_Quadx< Type >::q
template<typename Type>
CL_Vec2<Type> CL_Quadx< Type >::r
template<typename Type>
CL_Vec2<Type> CL_Quadx< Type >::s

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