Meteor2D  dev internal
Meteor is a lightweight 2D game engine.
Loading...
Searching...
No Matches
meteor::MSpriteSheet Class Reference

This class holds the Rects within a texture that form an Animation. More...

#include <spritesheet.h>

Inheritance diagram for meteor::MSpriteSheet:

Public Member Functions

 MSpriteSheet (std::string texturePath, std::vector< SRect > rects)
 Constructor.
 
MTexturegetTexture ()
 Gets the Texture for this sprite-sheet.
 
SRect sample (int &index, bool loop)
 Sample the sprite-sheet for a animation frame rect.
 
- Public Member Functions inherited from meteor::MEntity
virtual bool equals (MEntity *other)
 Checks equality between two entities.
 
std::string getName ()
 
void setName (std::string name)
 Sets name of entity.
 
virtual std::string toString ()
 Get this object as a string.
 

Additional Inherited Members

- Protected Attributes inherited from meteor::MEntity
std::string name
 

Detailed Description

This class holds the Rects within a texture that form an Animation.

Constructor & Destructor Documentation

◆ MSpriteSheet()

meteor::MSpriteSheet::MSpriteSheet ( std::string texturePath,
std::vector< SRect > rects )

Constructor.

Parameters
texturePathPath to texture.
rectsList of rects that form the animation.

Member Function Documentation

◆ getTexture()

MTexture * meteor::MSpriteSheet::getTexture ( )

Gets the Texture for this sprite-sheet.

Returns
Ptr to Texture instance

◆ sample()

SRect meteor::MSpriteSheet::sample ( int & index,
bool loop )

Sample the sprite-sheet for a animation frame rect.

Parameters
indexinteger directly mapping to frame number.
loopboolean flag to loop over the frames.
Returns
Rect for a specific animation frame.