mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-16 14:41:49 +01:00
Remove Point2f, replace with Vector2f
This commit is contained in:
@@ -18,8 +18,8 @@ WorldGridManager::~WorldGridManager() {
|
||||
}
|
||||
surroundingTiles WorldGridManager::GetSurroundingTiles(const WorldTile* world_tile) {
|
||||
surroundingTiles tiles;
|
||||
Point2f pos = world_tile->GetPosition();
|
||||
Point2f gridCoords = this->GetIndexFromPosition(pos);
|
||||
Vector2f pos = world_tile->GetPosition();
|
||||
Vector2f gridCoords = this->GetIndexFromPosition(pos);
|
||||
int x = gridCoords.x;
|
||||
//TODO: Stupid fix, fix this
|
||||
int y = gridCoords.y - 1;
|
||||
@@ -38,10 +38,10 @@ surroundingTiles WorldGridManager::GetSurroundingTiles(const WorldTile* world_ti
|
||||
return tiles;
|
||||
|
||||
}
|
||||
Point2f WorldGridManager::GetIndexFromPosition(Point2f position) {
|
||||
Vector2f WorldGridManager::GetIndexFromPosition(Vector2f position) {
|
||||
int x = int(position.x / TILE_WIDTH + WORLD_WIDTH / 2);
|
||||
int y = int(-position.y / TILE_HEIGHT);
|
||||
return Point2f{ 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) {
|
||||
@@ -50,7 +50,7 @@ WorldTile * WorldGridManager::GetTileAtIndex(const int x, const int y) const {
|
||||
}
|
||||
return m_worldTiles[x][y];
|
||||
}
|
||||
WorldTile * WorldGridManager::GetTileAtWorldPos(const Point2f& pos) const {
|
||||
WorldTile * WorldGridManager::GetTileAtWorldPos(const Vector2f& pos) const {
|
||||
int x = int(pos.x / TILE_WIDTH + WORLD_WIDTH / 2);
|
||||
int y = int(-pos.y / TILE_HEIGHT);
|
||||
if (x < 0 || x >= WORLD_WIDTH || y < 0 || y >= WORLD_HEIGHT) {
|
||||
|
||||
Reference in New Issue
Block a user