SDL2lazy
Public Member Functions | Public Attributes | List of all members
SlRenderItem Class Reference

#include <SlRenderItem.h>

Public Member Functions

 SlRenderItem ()
 
 SlRenderItem (std::shared_ptr< SlSprite > pSprite, unsigned int dest)
 
 SlRenderItem (const SlRenderItem &toCopy)
 
SlRenderItem & operator= (const SlRenderItem &rhs)
 
bool operator== (const SlRenderItem &rhs)
 
bool operator!= (const SlRenderItem &rhs)
 
void initialize (const std::shared_ptr< SlSprite > pSprite, unsigned int dest)
 
bool is_inside (const int &x, const int &y)
 
std::string name ()
 

Public Attributes

std::shared_ptr< SlSprite > sprite_
 
unsigned int destination_
 
bool isActive = false
 
bool renderMe_
 

Detailed Description

Entries for SlRenderItem::renderQueue. Objects are identified by their name and destination which correspond to the SlSprite::name_ and SlSprite::destinations_ position.
The pointer to the sprite is added to avoid having ro repeatedly find the sprite by name.

Constructor & Destructor Documentation

SlRenderItem::SlRenderItem ( )

Default constructor

SlRenderItem::SlRenderItem ( std::shared_ptr< SlSprite >  pSprite,
unsigned int  dest 
)

Constructor sets name and destiantion and points sprite to pSprite.

SlRenderItem::SlRenderItem ( const SlRenderItem &  toCopy)

Copy constructor, sprite_ will point to same SlSprite object

Member Function Documentation

void SlRenderItem::initialize ( const std::shared_ptr< SlSprite >  pSprite,
unsigned int  dest 
)

Sets values for all data members.

bool SlRenderItem::is_inside ( const int &  x,
const int &  y 
)

Checks if the provided coordinates are inside the destination of this render item.

std::string SlRenderItem::name ( )
inline

The name of the sprite.

bool SlRenderItem::operator!= ( const SlRenderItem &  rhs)
inline

SlRenderItems are equal when they have the same name and destination, i.e. the same sprite will be plotted in the same position.

SlRenderItem & SlRenderItem::operator= ( const SlRenderItem &  rhs)

Assignment, sprite_ will point to same SlSprite object

bool SlRenderItem::operator== ( const SlRenderItem &  rhs)
inline

SlRenderItems are equal when they have the same name and destination, i.e. the same sprite will be plotted in the same position.

Member Data Documentation

unsigned int SlRenderItem::destination_

The position in SlSprite::destinations_ .

bool SlRenderItem::isActive = false

State of the render item, used to determine if it was previously grabbed by mouse.

bool SlRenderItem::renderMe_

Determines whether the item will be rendered. This avoids having to delete an item and create a new one each in the same position if a sprite is toggled on and off often.

std::shared_ptr<SlSprite> SlRenderItem::sprite_

The sprite that will be rendered.


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