Fix digging

This commit is contained in:
Bram Verhulst
2024-04-20 20:20:54 +02:00
parent ebda39f690
commit 5477b8a7f2
11 changed files with 258 additions and 126 deletions

View File

@@ -18,7 +18,7 @@ enum class GroundTileTypes
class GroundTileType
{
public:
GroundTileType(const std::string& filePath, GroundTileTypes type): m_filePath(filePath), m_type(type) {
GroundTileType(const std::string&& filePath, GroundTileTypes type): m_filePath(filePath), m_type(type) {
}
virtual ~GroundTileType() = default;
bool operator==(const GroundTileType& rhs) const {
@@ -53,7 +53,7 @@ private:
class RandomGroundTile : public GroundTileType
{
public:
RandomGroundTile(const std::string& filePath, GroundTileTypes type, int maxRandom): GroundTileType(filePath, type), m_maxRandom(maxRandom) {
RandomGroundTile(const std::string& filePath, GroundTileTypes type, int maxRandom): GroundTileType(std::move(filePath), type), m_maxRandom(maxRandom) {
}
~RandomGroundTile() override = default;
@@ -96,6 +96,8 @@ namespace Tiles
static GroundTileType* HARD_LEFT = new GroundTileType("tiles/dirt/special/hardLeft.png", GroundTileTypes::Hard);
static GroundTileType* HARD_RIGHT = new GroundTileType("tiles/dirt/special/hardRight.png", GroundTileTypes::Hard);
static GroundTileType* HARD_MIDDLE = new GroundTileType("tiles/dirt/special/hardMiddle.png", GroundTileTypes::Hard);
static GroundTileType* GRASS = new RandomGroundTile("tiles/dirt/special/grass[0].png", GroundTileTypes::Dirt, 2);
}
}
@@ -125,6 +127,7 @@ public:
}
void SetTileType(GroundTileType* type) {
m_GroundTileType = type;
m_pTexture = TextureManager::GetInstance()->GetTexture(type->getPath()); //Chage the texture when setting a new type
}
Collision::TileCollisionRect GetCollisionRect();
@@ -133,7 +136,6 @@ public:
private:
void DrawSide(const TileDirection& direction);
Vector2f m_Position;
GroundTileType* m_GroundTileType;