mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-18 22:29:20 +01:00
Started on GuiIcon, General fixes
This commit is contained in:
@@ -20,31 +20,15 @@ WorldGridManager::~WorldGridManager() {
|
||||
delete m_worldTiles[x][y];
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "Deleting static" << std::endl;
|
||||
// delete Tiles::AIR;
|
||||
// delete Tiles::DIRT;
|
||||
//
|
||||
// delete Tiles::Hazards::LAVA;
|
||||
// delete Tiles::Hazards::STONE;
|
||||
//
|
||||
// delete Tiles::Ores::BRONZE;
|
||||
// delete Tiles::Ores::GOLD;
|
||||
// delete Tiles::Ores::IRON;
|
||||
//
|
||||
// delete Tiles::Special::GRASS;
|
||||
// delete Tiles::Special::HARD_LEFT;
|
||||
// delete Tiles::Special::HARD_MIDDLE;
|
||||
// delete Tiles::Special::HARD_RIGHT;
|
||||
}
|
||||
|
||||
surroundingTiles WorldGridManager::GetSurroundingTiles(const WorldTile* world_tile) {
|
||||
surroundingTiles tiles;
|
||||
Vector2f pos = world_tile->GetPosition();
|
||||
Vector2f gridCoords = this->GetIndexFromPosition(pos);
|
||||
int x = gridCoords.x;
|
||||
const int x = (int)gridCoords.x;
|
||||
//TODO: Stupid fix, fix this
|
||||
int y = gridCoords.y - 1;
|
||||
const int y = (int)gridCoords.y - 1;
|
||||
|
||||
tiles.SetTile(TileDirection::TopLeft, this->GetTileAtIndex(x - 1, y - 1));
|
||||
tiles.SetTile(TileDirection::TopMiddle, this->GetTileAtIndex(x, y - 1));
|
||||
@@ -58,12 +42,12 @@ surroundingTiles WorldGridManager::GetSurroundingTiles(const WorldTile* world_ti
|
||||
tiles.SetTile(TileDirection::BottomRight, this->GetTileAtIndex(x + 1, y + 1));
|
||||
|
||||
return tiles;
|
||||
|
||||
|
||||
}
|
||||
Vector2f WorldGridManager::GetIndexFromPosition(Vector2f position) {
|
||||
int x = int(position.x / TILE_WIDTH + WORLD_WIDTH / 2);
|
||||
int y = int(-position.y / TILE_HEIGHT);
|
||||
return Vector2f{ float(x), float(y) };
|
||||
return Vector2f { float(x), float(y) };
|
||||
}
|
||||
WorldTile * WorldGridManager::GetTileAtIndex(const int x, const int y) const {
|
||||
if (x < 0 || x >= WORLD_WIDTH || y < 0 || y >= WORLD_HEIGHT) {
|
||||
|
||||
Reference in New Issue
Block a user