Polyphase Game Engine
Loading...
Searching...
No Matches
TileSet Class Reference

#include <TileSet.h>

Inheritance diagram for TileSet:
Asset Object

Public Member Functions

 DECLARE_ASSET (TileSet, Asset)
 
 TileSet ()
 
virtual ~TileSet ()
 
virtual void LoadStream (Stream &stream, Platform platform) override
 
virtual void SaveStream (Stream &stream, Platform platform) override
 
virtual void Create () override
 
virtual void Destroy () override
 
virtual void GatherProperties (std::vector< Property > &outProps) override
 
virtual glm::vec4 GetTypeColor () override
 
virtual const char * GetTypeName () override
 
virtual bool ShouldSnapshotForPie () const override
 
TextureGetTexture () const
 
void SetTexture (Texture *tex)
 
int32_t GetTileWidth () const
 
int32_t GetTileHeight () const
 
int32_t GetMarginX () const
 
int32_t GetMarginY () const
 
int32_t GetSpacingX () const
 
int32_t GetSpacingY () const
 
void RebuildTileGrid ()
 
int32_t GetNumTiles () const
 
glm::ivec2 GetAtlasGridSize () const
 
glm::ivec2 TileIndexToAtlasCoord (int32_t tileIndex) const
 
bool GetTileUVs (int32_t tileIndex, glm::vec2 &outUV0, glm::vec2 &outUV1) const
 
const TileDefinitionGetTileDef (int32_t tileIndex) const
 
TileDefinitionGetTileDefMutable (int32_t tileIndex)
 
bool IsTileSolid (int32_t tileIndex) const
 
bool HasTileTag (int32_t tileIndex, const std::string &tag) const
 
const std::vector< TileDefinition > & GetTiles () const
 
const std::vector< NineBoxBrushDef > & GetNineBoxBrushes () const
 
std::vector< NineBoxBrushDef > & GetNineBoxBrushesMutable ()
 
int32_t AddNineBoxBrush (const std::string &name)
 
void RemoveNineBoxBrush (int32_t index)
 
const std::vector< AutotileSet > & GetAutotileSets () const
 
std::vector< AutotileSet > & GetAutotileSetsMutable ()
 
int32_t AddAutotileSet (const std::string &name)
 
void RemoveAutotileSet (int32_t index)
 
bool IsTileMemberOfAutotile (int32_t autotileIndex, int32_t tileIndex) const
 
int32_t MatchAutotileRule (int32_t autotileIndex, uint8_t selfMask) const
 
- Public Member Functions inherited from Asset
 DECLARE_FACTORY_MANAGER (Asset)
 
 DECLARE_FACTORY (Asset, Asset)
 
 DECLARE_OBJECT (Asset, Object)
 
 Asset ()
 
virtual ~Asset ()
 
virtual void Copy (Asset *srcAsset)
 
const std::string & GetName () const
 
bool IsLoaded () const
 
bool IsRefCounted () const
 
int32_t GetRefCount () const
 
bool IsEmbedded () const
 
void SetEmbedded (bool embed)
 
bool IsEngineAsset () const
 
void SetEngineAsset (bool engineAsset)
 
void SetName (const std::string &name)
 
void IncrementRefCount ()
 
void DecrementRefCount ()
 
void LoadFile (const char *path, AsyncLoadRequest *request=nullptr)
 
void LoadEmbedded (const EmbeddedFile *embeddedAsset, AsyncLoadRequest *request=nullptr)
 
void SaveFile (const char *path, Platform platform)
 
virtual bool Import (const std::string &path, ImportOptions *options=nullptr)
 
virtual const char * GetTypeImportExt ()
 
bool IsTransient () const
 
void SetTransient (bool transient)
 
uint64_t GetUuid () const
 
void SetUuid (uint64_t uuid)
 
void EnsureUuid ()
 
void WriteHeader (Stream &stream)
 
- Public Member Functions inherited from Object
virtual ~Object ()=default
 
virtual const char * RuntimeName () const =0
 
virtual const char * RuntimeParentName () const =0
 
virtual RuntimeId InstanceRuntimeId () const =0
 
virtual ObjectQueryInterface (RuntimeId id) const
 
virtual bool Is (RuntimeId id) const
 
virtual bool Is (const char *name) const
 
virtual bool DrawCustomProperty (Property &prop)
 
template<typename T >
T * As () const
 
virtual bool Equals (const Object *rhs) const
 

Static Public Member Functions

static bool HandlePropChange (class Datum *datum, uint32_t index, const void *newValue)
 
- Static Public Member Functions inherited from Asset
static AssetHeader ReadHeader (Stream &stream)
 
static std::string GetNameFromPath (const std::string &path)
 
static std::string GetDirectoryFromPath (const std::string &path)
 
static const char * GetNameFromTypeId (TypeId id)
 
static TypeId GetTypeIdFromName (const char *name)
 
- Static Public Member Functions inherited from Object
static const char * ClassRuntimeName ()
 

Protected Attributes

AssetRef mTexture
 
int32_t mTileWidth = 16
 
int32_t mTileHeight = 16
 
int32_t mMarginX = 0
 
int32_t mMarginY = 0
 
int32_t mSpacingX = 0
 
int32_t mSpacingY = 0
 
int32_t mAtlasColumns = 0
 
int32_t mAtlasRows = 0
 
std::vector< TileDefinitionmTiles
 
std::vector< NineBoxBrushDefmNineBoxBrushes
 
std::vector< AutotileSetmAutotileSets
 
- Protected Attributes inherited from Asset
uint32_t mVersion = 0
 
TypeId mType = INVALID_TYPE_ID
 
uint64_t mUuid = 0
 
bool mEmbedded = false
 
bool mLoaded = false
 
bool mEnableRefCount = true
 
bool mEngineAsset = false
 
bool mTransient = false
 
std::string mName = "Asset"
 
int32_t mRefCount = 0
 

Constructor & Destructor Documentation

◆ TileSet()

TileSet::TileSet ( )

◆ ~TileSet()

TileSet::~TileSet ( )
virtual

Member Function Documentation

◆ AddAutotileSet()

int32_t TileSet::AddAutotileSet ( const std::string &  name)

◆ AddNineBoxBrush()

int32_t TileSet::AddNineBoxBrush ( const std::string &  name)

◆ Create()

void TileSet::Create ( )
overridevirtual

Reimplemented from Asset.

◆ DECLARE_ASSET()

TileSet::DECLARE_ASSET ( TileSet  ,
Asset   
)

◆ Destroy()

void TileSet::Destroy ( )
overridevirtual

Reimplemented from Asset.

◆ GatherProperties()

void TileSet::GatherProperties ( std::vector< Property > &  outProps)
overridevirtual

Reimplemented from Asset.

◆ GetAtlasGridSize()

glm::ivec2 TileSet::GetAtlasGridSize ( ) const
inline

◆ GetAutotileSets()

const std::vector< AutotileSet > & TileSet::GetAutotileSets ( ) const
inline

◆ GetAutotileSetsMutable()

std::vector< AutotileSet > & TileSet::GetAutotileSetsMutable ( )
inline

◆ GetMarginX()

int32_t TileSet::GetMarginX ( ) const
inline

◆ GetMarginY()

int32_t TileSet::GetMarginY ( ) const
inline

◆ GetNineBoxBrushes()

const std::vector< NineBoxBrushDef > & TileSet::GetNineBoxBrushes ( ) const
inline

◆ GetNineBoxBrushesMutable()

std::vector< NineBoxBrushDef > & TileSet::GetNineBoxBrushesMutable ( )
inline

◆ GetNumTiles()

int32_t TileSet::GetNumTiles ( ) const

◆ GetSpacingX()

int32_t TileSet::GetSpacingX ( ) const
inline

◆ GetSpacingY()

int32_t TileSet::GetSpacingY ( ) const
inline

◆ GetTexture()

Texture * TileSet::GetTexture ( ) const

◆ GetTileDef()

const TileDefinition * TileSet::GetTileDef ( int32_t  tileIndex) const

◆ GetTileDefMutable()

TileDefinition * TileSet::GetTileDefMutable ( int32_t  tileIndex)

◆ GetTileHeight()

int32_t TileSet::GetTileHeight ( ) const
inline

◆ GetTiles()

const std::vector< TileDefinition > & TileSet::GetTiles ( ) const
inline

◆ GetTileUVs()

bool TileSet::GetTileUVs ( int32_t  tileIndex,
glm::vec2 &  outUV0,
glm::vec2 &  outUV1 
) const

◆ GetTileWidth()

int32_t TileSet::GetTileWidth ( ) const
inline

◆ GetTypeColor()

glm::vec4 TileSet::GetTypeColor ( )
overridevirtual

Reimplemented from Asset.

◆ GetTypeName()

const char * TileSet::GetTypeName ( )
overridevirtual

Reimplemented from Asset.

◆ HandlePropChange()

bool TileSet::HandlePropChange ( class Datum datum,
uint32_t  index,
const void *  newValue 
)
static

◆ HasTileTag()

bool TileSet::HasTileTag ( int32_t  tileIndex,
const std::string &  tag 
) const

◆ IsTileMemberOfAutotile()

bool TileSet::IsTileMemberOfAutotile ( int32_t  autotileIndex,
int32_t  tileIndex 
) const

◆ IsTileSolid()

bool TileSet::IsTileSolid ( int32_t  tileIndex) const

◆ LoadStream()

void TileSet::LoadStream ( Stream stream,
Platform  platform 
)
overridevirtual

Reimplemented from Asset.

◆ MatchAutotileRule()

int32_t TileSet::MatchAutotileRule ( int32_t  autotileIndex,
uint8_t  selfMask 
) const

◆ RebuildTileGrid()

void TileSet::RebuildTileGrid ( )

◆ RemoveAutotileSet()

void TileSet::RemoveAutotileSet ( int32_t  index)

◆ RemoveNineBoxBrush()

void TileSet::RemoveNineBoxBrush ( int32_t  index)

◆ SaveStream()

void TileSet::SaveStream ( Stream stream,
Platform  platform 
)
overridevirtual

Reimplemented from Asset.

◆ SetTexture()

void TileSet::SetTexture ( Texture tex)

◆ ShouldSnapshotForPie()

virtual bool TileSet::ShouldSnapshotForPie ( ) const
inlineoverridevirtual

Reimplemented from Asset.

◆ TileIndexToAtlasCoord()

glm::ivec2 TileSet::TileIndexToAtlasCoord ( int32_t  tileIndex) const

Member Data Documentation

◆ mAtlasColumns

int32_t TileSet::mAtlasColumns = 0
protected

◆ mAtlasRows

int32_t TileSet::mAtlasRows = 0
protected

◆ mAutotileSets

std::vector<AutotileSet> TileSet::mAutotileSets
protected

◆ mMarginX

int32_t TileSet::mMarginX = 0
protected

◆ mMarginY

int32_t TileSet::mMarginY = 0
protected

◆ mNineBoxBrushes

std::vector<NineBoxBrushDef> TileSet::mNineBoxBrushes
protected

◆ mSpacingX

int32_t TileSet::mSpacingX = 0
protected

◆ mSpacingY

int32_t TileSet::mSpacingY = 0
protected

◆ mTexture

AssetRef TileSet::mTexture
protected

◆ mTileHeight

int32_t TileSet::mTileHeight = 16
protected

◆ mTiles

std::vector<TileDefinition> TileSet::mTiles
protected

◆ mTileWidth

int32_t TileSet::mTileWidth = 16
protected

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