YourGameLib
Loading...
Searching...
No Matches
Public Member Functions | List of all members
yourgame::gl::SpriteGrid Class Reference

#include <spritegrid.h>

Public Member Functions

 SpriteGrid ()
 
 SpriteGrid (SpriteGrid const &)=delete
 
SpriteGridoperator= (SpriteGrid const &)=delete
 
 ~SpriteGrid ()
 
int make (const yourgame::gl::Texture *atlas, const std::vector< std::string > &tiles, unsigned int width, float gridWidth, float gridHeight)
 creates grid geometry in x-y plane (z = 0)
 
Geometrygeo () const
 

Constructor & Destructor Documentation

◆ SpriteGrid() [1/2]

yourgame::gl::SpriteGrid::SpriteGrid ( )

◆ SpriteGrid() [2/2]

yourgame::gl::SpriteGrid::SpriteGrid ( SpriteGrid const &  )
delete

◆ ~SpriteGrid()

yourgame::gl::SpriteGrid::~SpriteGrid ( )

Member Function Documentation

◆ geo()

Geometry * yourgame::gl::SpriteGrid::geo ( ) const
inline
Returns
pointer to geometry object (m_geo)

◆ make()

int yourgame::gl::SpriteGrid::make ( const yourgame::gl::Texture atlas,
const std::vector< std::string > &  tiles,
unsigned int  width,
float  gridWidth,
float  gridHeight 
)

creates grid geometry in x-y plane (z = 0)

  • planar grid in x-y plane (z=0), 2 ccw trianlges per tile
  • drawing: bind texture manually and get geometry for drawing via geo()
  • aspect ratio taken from first tile
  • atlas is only used for geometry creation, pointer is not kept
  • atlas should have only 1 texture
Parameters
atlasatlas, the coordinates are taken from
tilesnames of tiles in atlas, in row-major order
widthnumber of tiles per row. if = 0, all tiles in 1 row
gridWidthdesired width of entire grid. if <= 0.0f, aspect ratio and gridHeight (if > 0.0f) used
gridHeightdesired height of entire grid. if <= 0.0f, aspect ratio and gridWidth (if > 0.0f) used
Returns
error (0 on success)

◆ operator=()

SpriteGrid & yourgame::gl::SpriteGrid::operator= ( SpriteGrid const &  )
delete

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