TurtleBrains  0.3.1
High quality, portable, C++ framework for rapid 2D game development.
TurtleBrains::Game::TileSystem Class Reference

#include <tb_tile_system.h>

Inheritance diagram for TurtleBrains::Game::TileSystem:
TurtleBrains::Graphics::Graphic TurtleBrains::Core::Noncopyable

Public Member Functions

 TileSystem (void)
 
virtual ~TileSystem (void)
 
void ClearMap (void)
 
tbCore::tbString GetMapPropertyAsString (const tbCore::tbString &propertyName) const
 
int GetMapPropertyAsInteger (const tbCore::tbString &propertyName) const
 
bool GetMapPropertyAsBoolean (const tbCore::tbString &propertyName) const
 
void SetPropertiesForMap (const tbCore::DynamicStructure &mapProperties)
 
void AddTileSet (const tbCore::tbString &tilesetName, const tbGraphics::SpriteMap &spriteMap, const tbCore::DynamicStructure &tileSetProperties=tbCore::DynamicStructure::kNullValue)
 
AboutTileContainer FindTilesWithProperty (const tbCore::tbString &tileProperty, bool onlyVisibleLayers=false) const
 
AboutTileContainer FindTilesWithPropertyEquals (const tbCore::tbString &tileProperty, bool propertyValue, bool onlyVisibleLayers=false) const
 
AboutTileContainer FindTilesWithPropertyEquals (const tbCore::tbString &tileProperty, int propertyValue, bool onlyVisibleLayers=false) const
 
AboutTileContainer FindTilesWithPropertyEquals (const tbCore::tbString &tileProperty, const tbCore::tbString &propertyValue, bool onlyVisibleLayers=false) const
 
void SetPropertiesForTile (const tbCore::tbString &tileSetName, const TileIndex &tileIndex, const tbCore::DynamicStructure &tileProperties)
 
tbCore::tbString GetTilePropertyAsString (const tbCore::tbString &tileSetName, const TileIndex &tileIndex, const tbCore::tbString &propertyName) const
 
int GetTilePropertyAsInteger (const tbCore::tbString &tileSetName, const TileIndex &tileIndex, const tbCore::tbString &propertyName) const
 
bool GetTilePropertyAsBoolean (const tbCore::tbString &tileSetName, const TileIndex &tileIndex, const tbCore::tbString &propertyName) const
 
void SetTileProperty (const tbCore::tbString &tileSetName, const TileIndex &tileIndex, const tbCore::tbString &propertyName, const tbCore::tbString &propertyValue)
 
void SetTileProperty (const tbCore::tbString &tileSetName, const TileIndex &tileIndex, const tbCore::tbString &propertyName, const int propertyValue)
 
void SetTileProperty (const tbCore::tbString &tileSetName, const TileIndex &tileIndex, const tbCore::tbString &propertyName, const bool propertyValue)
 
void AddTileLayer (const tbCore::tbString &tileLayerName, const std::vector< TileIndex > &tileData, const tbCore::tbString &tileSetName, const TileLocation &columnCount, const TileLocation &rowCount)
 
void AddTileLayer (const tbCore::tbString &tileLayerName, const std::vector< TileIndex > &tileData, const std::vector< TileSetIndex > &tileSetData, const TileLocation &columnCount, const TileLocation &rowCount)
 
void SetLayerVisible (const tbCore::tbString &tileLayerName, const bool isVisible)
 
void SetTile (const tbCore::tbString &tileLayerName, const TileLocation &tileColumn, const TileLocation &tileRow, const TileIndex &toTileIndex, const TileSetIndex &toTileSetIndex=kInvalidTileSetIndex)
 
bool MoveEntity (const tbMath::Vector2 &currentPosition, tbMath::Vector2 &finalPosition, const TurtleBrains::Math::Unstable::BoundingVolume &boundingVolume) const
 
bool MoveEntity (Entity &entity, const tbMath::Vector2 &fromOldPosition, const tbMath::Vector2 &toNewPosition) const
 
bool IsPointInSolid (const tbMath::Vector2 &pointPosition) const
 
void UpdateColliderInformation (void)
 
- Public Member Functions inherited from TurtleBrains::Graphics::Graphic
 Graphic (void)
 
 Graphic (const Graphic &other)
 
virtual ~Graphic (void)
 
bool IsActive (void) const
 
void SetActive (const bool isActive)
 
void Update (const float deltaTime)
 
bool IsVisible (void) const
 
void SetVisible (const bool isVisible)
 
void Render (void) const
 
const tbMath::Vector2GetPosition (void) const
 
void SetPosition (const float x, const float y)
 
void SetPosition (const tbMath::Vector2 &position)
 
void SetOrigin (const AnchorLocation &anchor, const tbMath::Vector2 &offset=tbMath::Vector2::Zero())
 
void SetOrigin (const float originX, const float originY)
 
void SetOrigin (const tbMath::Vector2 &origin)
 
float GetDepth (void) const
 
void SetDepth (const float newDepth)
 
const tbMath::Vector2GetScale (void) const
 
void SetScale (const float scale)
 
void SetScale (const float scaleX, const float scaleY)
 
float GetRotation (void) const
 
void SetRotation (const float rotation)
 
void SetScroll (const float scroll)
 
void SetScroll (const float scrollX, const float scrollY)
 
bool IsRelative (void) const
 
const ColorGetColor (void) const
 
virtual void SetColor (const tbGraphics::Color &newColor)
 
virtual PixelSpace GetPixelWidth (void) const
 
virtual PixelSpace GetPixelHeight (void) const
 
float GetWidth (void) const
 
float GetHeight (void) const
 

Protected Member Functions

virtual void OnRender (void) const override
 
- Protected Member Functions inherited from TurtleBrains::Graphics::Graphic
virtual void OnUpdate (const float deltaTime)
 
virtual void ApplyTransform (void) const
 
virtual void PopTransform (void) const
 

Detailed Description

The TileSystem contains details about all the different tiles used as well as stores multiple tile layers to be rendered. Loads tile maps edited with Tiled when saved in the json format, although only basic support will be added in this first version.

The TileSystem has a lot of components working together, Tiles, TileSets and TileLayers it is important to understand the differences between each of these objects, particularly between TileSets and TileLayers. Each Tile

Constructor & Destructor Documentation

TurtleBrains::Game::TileSystem::TileSystem ( void  )

Constructs an empty TileSystem with no tilesets, no tiles and no layers.

virtual TurtleBrains::Game::TileSystem::~TileSystem ( void  )
virtual

Destroys the TileSystem object which will clean up all resources for each of the layers and tilesets.

Member Function Documentation

void TurtleBrains::Game::TileSystem::AddTileLayer ( const tbCore::tbString tileLayerName,
const std::vector< TileIndex > &  tileData,
const tbCore::tbString tileSetName,
const TileLocation columnCount,
const TileLocation rowCount 
)

TODO: TurtleBrains: Documentation: Teach the user how to use this.

void TurtleBrains::Game::TileSystem::AddTileLayer ( const tbCore::tbString tileLayerName,
const std::vector< TileIndex > &  tileData,
const std::vector< TileSetIndex > &  tileSetData,
const TileLocation columnCount,
const TileLocation rowCount 
)

TODO: TurtleBrains: Documentation: Teach the user how to use this.

void TurtleBrains::Game::TileSystem::AddTileSet ( const tbCore::tbString tilesetName,
const tbGraphics::SpriteMap spriteMap,
const tbCore::DynamicStructure tileSetProperties = tbCore::DynamicStructure::kNullValue 
)

Adds a tileset with a given name to the TileSystem.

void TurtleBrains::Game::TileSystem::ClearMap ( void  )

Clean up all resources for each of the layers and tilesets, will contain no tilesets, layers or tiles after this is complete.

AboutTileContainer TurtleBrains::Game::TileSystem::FindTilesWithProperty ( const tbCore::tbString tileProperty,
bool  onlyVisibleLayers = false 
) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

AboutTileContainer TurtleBrains::Game::TileSystem::FindTilesWithPropertyEquals ( const tbCore::tbString tileProperty,
bool  propertyValue,
bool  onlyVisibleLayers = false 
) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

AboutTileContainer TurtleBrains::Game::TileSystem::FindTilesWithPropertyEquals ( const tbCore::tbString tileProperty,
int  propertyValue,
bool  onlyVisibleLayers = false 
) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

AboutTileContainer TurtleBrains::Game::TileSystem::FindTilesWithPropertyEquals ( const tbCore::tbString tileProperty,
const tbCore::tbString propertyValue,
bool  onlyVisibleLayers = false 
) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

bool TurtleBrains::Game::TileSystem::GetMapPropertyAsBoolean ( const tbCore::tbString propertyName) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

int TurtleBrains::Game::TileSystem::GetMapPropertyAsInteger ( const tbCore::tbString propertyName) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

tbCore::tbString TurtleBrains::Game::TileSystem::GetMapPropertyAsString ( const tbCore::tbString propertyName) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

bool TurtleBrains::Game::TileSystem::GetTilePropertyAsBoolean ( const tbCore::tbString tileSetName,
const TileIndex tileIndex,
const tbCore::tbString propertyName 
) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

int TurtleBrains::Game::TileSystem::GetTilePropertyAsInteger ( const tbCore::tbString tileSetName,
const TileIndex tileIndex,
const tbCore::tbString propertyName 
) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

tbCore::tbString TurtleBrains::Game::TileSystem::GetTilePropertyAsString ( const tbCore::tbString tileSetName,
const TileIndex tileIndex,
const tbCore::tbString propertyName 
) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

bool TurtleBrains::Game::TileSystem::IsPointInSolid ( const tbMath::Vector2 pointPosition) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

bool TurtleBrains::Game::TileSystem::MoveEntity ( const tbMath::Vector2 currentPosition,
tbMath::Vector2 finalPosition,
const TurtleBrains::Math::Unstable::BoundingVolume boundingVolume 
) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

bool TurtleBrains::Game::TileSystem::MoveEntity ( Entity entity,
const tbMath::Vector2 fromOldPosition,
const tbMath::Vector2 toNewPosition 
) const

TODO: TurtleBrains: Documentation: Teach the user how to use this.

virtual void TurtleBrains::Game::TileSystem::OnRender ( void  ) const
overrideprotectedvirtual

TODO: TurtleBrains: Documentation: Teach the user how to use this.

Implements TurtleBrains::Graphics::Graphic.

void TurtleBrains::Game::TileSystem::SetLayerVisible ( const tbCore::tbString tileLayerName,
const bool  isVisible 
)

TODO: TurtleBrains: Documentation: Teach the user how to use this.

void TurtleBrains::Game::TileSystem::SetPropertiesForMap ( const tbCore::DynamicStructure mapProperties)

TODO: TurtleBrains: Documentation: Teach the user how to use this.

void TurtleBrains::Game::TileSystem::SetPropertiesForTile ( const tbCore::tbString tileSetName,
const TileIndex tileIndex,
const tbCore::DynamicStructure tileProperties 
)

TODO: TurtleBrains: Documentation: Teach the user how to use this.

void TurtleBrains::Game::TileSystem::SetTile ( const tbCore::tbString tileLayerName,
const TileLocation tileColumn,
const TileLocation tileRow,
const TileIndex toTileIndex,
const TileSetIndex toTileSetIndex = kInvalidTileSetIndex 
)

TODO: TurtleBrains: Documentation: Teach the user how to use this.

void TurtleBrains::Game::TileSystem::SetTileProperty ( const tbCore::tbString tileSetName,
const TileIndex tileIndex,
const tbCore::tbString propertyName,
const tbCore::tbString propertyValue 
)

TODO: TurtleBrains: Documentation: Teach the user how to use this.

void TurtleBrains::Game::TileSystem::SetTileProperty ( const tbCore::tbString tileSetName,
const TileIndex tileIndex,
const tbCore::tbString propertyName,
const int  propertyValue 
)

TODO: TurtleBrains: Documentation: Teach the user how to use this.

void TurtleBrains::Game::TileSystem::SetTileProperty ( const tbCore::tbString tileSetName,
const TileIndex tileIndex,
const tbCore::tbString propertyName,
const bool  propertyValue 
)

TODO: TurtleBrains: Documentation: Teach the user how to use this.

void TurtleBrains::Game::TileSystem::UpdateColliderInformation ( void  )

TODO: TurtleBrains: Documentation: Teach the user how to use this.