Turbo Engine 0.3
A C++ game engine using Allegro 5
turbo::Tileset Class Reference

Loads a tile sheet image and slices it into a grid of Sprites, accessible by their (x, y) coordinates. More...

#include <Tileset.hpp>

Public Member Functions

 Tileset (Path *path, const Vector2< unsigned short > &tile_size, const Vector2< unsigned short > &tiles_nbr, const unsigned short &margin=0, const unsigned short &border_offset=0)
 ~Tileset ()
Spriteget_sprite (const Vector2< unsigned short > &coords) const noexcept(false)
Spriteget_sprite (unsigned short x, unsigned short y) const noexcept(false)
Spriteoperator() (const Vector2< unsigned short > &coords) const noexcept(false)
Spriteoperator() (unsigned short x, unsigned short y) const noexcept(false)
const Vector2< unsigned short > & get_size () const

Detailed Description

Loads a tile sheet image and slices it into a grid of Sprites, accessible by their (x, y) coordinates.

Constructor & Destructor Documentation

◆ Tileset()

turbo::Tileset::Tileset ( Path * path,
const Vector2< unsigned short > & tile_size,
const Vector2< unsigned short > & tiles_nbr,
const unsigned short & margin = 0,
const unsigned short & border_offset = 0 )
explicit

Create a tileset

Parameters
pathpath to the texture file
tile_sizesize of the tile
tiles_nbramount of tiles
marginmargin between the tiles
border_offsetoffset around all the textures

◆ ~Tileset()

turbo::Tileset::~Tileset ( )

Member Function Documentation

◆ get_size()

const Vector2< unsigned short > & turbo::Tileset::get_size ( ) const

◆ get_sprite() [1/2]

Sprite * turbo::Tileset::get_sprite ( const Vector2< unsigned short > & coords) const

◆ get_sprite() [2/2]

Sprite * turbo::Tileset::get_sprite ( unsigned short x,
unsigned short y ) const

◆ operator()() [1/2]

Sprite * turbo::Tileset::operator() ( const Vector2< unsigned short > & coords) const

◆ operator()() [2/2]

Sprite * turbo::Tileset::operator() ( unsigned short x,
unsigned short y ) const

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