SLProject 4.0.000
SLRect< T, V > Class Template Reference

A rectangle template class. More...

#include <SLRect.h>

Public Member Functions

 SLRect ()
 
 SLRect (const T WIDTH, const T HEIGHT)
 
 SLRect (const T X, const T Y, const T WIDTH, const T HEIGHT)
 
 SLRect (const V &tl, const V &br)
 
void set (const T X, const T Y, const T WIDTH, const T HEIGHT)
 
void set (const T v[2])
 
void set (const V tl, const V br)
 
void setZero ()
 
SLbool operator== (const SLRect &r) const
 
SLbool operator!= (const SLRect &r) const
 
SLRectoperator= (const SLRect &r)
 
void tl (V v)
 top-left corner More...
 
void br (V v)
 bottom-right corner More...
 
void setScnd (V v)
 
tl ()
 top-left corner More...
 
br ()
 bottom-right corner More...
 
area ()
 
SLbool isEmpty () const
 
SLbool isZero ()
 
SLbool contains (T X, T Y)
 
SLbool contains (V v)
 
SLbool contains (const SLRect &r)
 
void print (const char *str=nullptr)
 
void drawGL (const SLCol4f &color)
 

Public Attributes

x
 
y
 
width
 
height
 

Private Attributes

SLGLVertexArrayExt _vao
 

Friends

std::ostream & operator<< (std::ostream &output, const SLRect &r)
 

Detailed Description

template<class T, class V>
class SLRect< T, V >

A rectangle template class.

Defines a rectangle with a top-left corner at x,y measured from top-left of the window and with its width and height. It is used e.g. to draw a selection rectangle in SLSceneView::draw2DGL.

Constructor & Destructor Documentation

◆ SLRect() [1/4]

template<class T , class V >
SLRect< T, V >::SLRect ( )
inline

◆ SLRect() [2/4]

template<class T , class V >
SLRect< T, V >::SLRect ( const T  WIDTH,
const T  HEIGHT 
)
inline

◆ SLRect() [3/4]

template<class T , class V >
SLRect< T, V >::SLRect ( const T  X,
const T  Y,
const T  WIDTH,
const T  HEIGHT 
)
inline

◆ SLRect() [4/4]

template<class T , class V >
SLRect< T, V >::SLRect ( const V &  tl,
const V &  br 
)
inline

Member Function Documentation

◆ area()

template<class T , class V >
T SLRect< T, V >::area ( )
inline

◆ br() [1/2]

template<class T , class V >
V SLRect< T, V >::br ( )
inline

bottom-right corner

◆ br() [2/2]

template<class T , class V >
void SLRect< T, V >::br ( v)
inline

bottom-right corner

◆ contains() [1/3]

template<class T , class V >
SLbool SLRect< T, V >::contains ( const SLRect< T, V > &  r)
inline

◆ contains() [2/3]

template<class T , class V >
SLbool SLRect< T, V >::contains ( X,
Y 
)
inline

◆ contains() [3/3]

template<class T , class V >
SLbool SLRect< T, V >::contains ( v)
inline

◆ drawGL()

template<class T , class V >
void SLRect< T, V >::drawGL ( const SLCol4f color)
inline

◆ isEmpty()

template<class T , class V >
SLbool SLRect< T, V >::isEmpty ( ) const
inline

◆ isZero()

template<class T , class V >
SLbool SLRect< T, V >::isZero ( )
inline

◆ operator!=()

template<class T , class V >
SLbool SLRect< T, V >::operator!= ( const SLRect< T, V > &  r) const
inline

◆ operator=()

template<class T , class V >
SLRect & SLRect< T, V >::operator= ( const SLRect< T, V > &  r)
inline

◆ operator==()

template<class T , class V >
SLbool SLRect< T, V >::operator== ( const SLRect< T, V > &  r) const
inline

◆ print()

template<class T , class V >
void SLRect< T, V >::print ( const char *  str = nullptr)
inline

◆ set() [1/3]

template<class T , class V >
void SLRect< T, V >::set ( const T  v[2])
inline

◆ set() [2/3]

template<class T , class V >
void SLRect< T, V >::set ( const T  X,
const T  Y,
const T  WIDTH,
const T  HEIGHT 
)
inline

◆ set() [3/3]

template<class T , class V >
void SLRect< T, V >::set ( const V  tl,
const V  br 
)
inline

◆ setScnd()

template<class T , class V >
void SLRect< T, V >::setScnd ( v)
inline

◆ setZero()

template<class T , class V >
void SLRect< T, V >::setZero ( )
inline

◆ tl() [1/2]

template<class T , class V >
V SLRect< T, V >::tl ( )
inline

top-left corner

◆ tl() [2/2]

template<class T , class V >
void SLRect< T, V >::tl ( v)
inline

top-left corner

Friends And Related Function Documentation

◆ operator<<

template<class T , class V >
std::ostream & operator<< ( std::ostream &  output,
const SLRect< T, V > &  r 
)
friend

Member Data Documentation

◆ _vao

template<class T , class V >
SLGLVertexArrayExt SLRect< T, V >::_vao
private

◆ height

template<class T , class V >
T SLRect< T, V >::height

◆ width

template<class T , class V >
T SLRect< T, V >::width

◆ x

template<class T , class V >
T SLRect< T, V >::x

◆ y

template<class T , class V >
T SLRect< T, V >::y

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