added TileMaps to TSE

This commit is contained in:
2026-02-08 18:09:46 +01:00
parent ea2dc4f6b5
commit 330d4b26dc
12 changed files with 643 additions and 9 deletions

View File

@@ -33,3 +33,24 @@ void TSE::TileSet::GetSpriteAt(int x, int y, Sprite &s)
s = Sprite(tex, Rect(startpos, endpos));
}
int TSE::TileSet::GetSpriteIdAt(int x, int y)
{
if(x < 0 || x >= resx || y < 0 || y >= resy)
{
TSE_ERROR("The sprite you are trying to access is out of range");
return -1;
}
return y * resx + x;
}
uint TSE::TileSet::GetTextueID()
{
return tex->GetTextureId();
}
TSE::Vector2 TSE::TileSet::GetCount()
{
return Vector2(resx, resy);
}

View File

@@ -18,6 +18,9 @@ namespace TSE
void SetTexture(Texture* tex);
void GetSpriteAt(int x, int y, Sprite& s);
int GetSpriteIdAt(int x, int y);
uint GetTextueID();
Vector2 GetCount();
inline void SetCount(Vector2& v)
{
@@ -27,5 +30,6 @@ namespace TSE
{
GetSpriteAt(v.x, v.y, s);
};
};
} // namespace TSE

View File

@@ -110,7 +110,7 @@ namespace TSE
Matrix4x4 Transformable::GetLocalMatrix() const
{
return Matrix4x4::ToTranslationMatrix(position) * Matrix4x4::ToRotationMatrix(rotation) * Matrix4x4::ToScaleMatrix(scale);;
return Matrix4x4::ToTranslationMatrix(position) * Matrix4x4::ToRotationMatrix(rotation) * Matrix4x4::ToScaleMatrix(scale);
}
Matrix4x4 Transformable::GetGlobalMatrix() const