mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-16 20:41:47 +01:00
Reformat + Basic animation system
General fixes
This commit is contained in:
45
Game/GridSystem/WorldGridManager.h
Normal file
45
Game/GridSystem/WorldGridManager.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
#include <array>
|
||||
|
||||
#include "structs.h"
|
||||
|
||||
static const int WORLD_WIDTH = 34;
|
||||
static const int WORLD_HEIGHT = 34;
|
||||
|
||||
static const int TILE_WIDTH = 50;
|
||||
static const int TILE_HEIGHT = 50;
|
||||
|
||||
class WorldTile;
|
||||
|
||||
struct surroundingTiles
|
||||
{
|
||||
std::array<WorldTile *, 8> tiles;
|
||||
|
||||
//Center of the surrounding tiles is 0, 0
|
||||
void SetTile(int x, int y, WorldTile* tile) {
|
||||
tiles[x + y * 3] = tile;
|
||||
}
|
||||
|
||||
WorldTile * GetTile(int x, int y) {
|
||||
return tiles[x + y * 3];
|
||||
}
|
||||
};
|
||||
|
||||
class WorldGridManager
|
||||
{
|
||||
public:
|
||||
WorldGridManager();
|
||||
~WorldGridManager();
|
||||
|
||||
WorldGridManager(const WorldGridManager& other) = default;
|
||||
|
||||
WorldTile * GetTileAtIndex(const int x, const int y) const;
|
||||
WorldTile * GetTileAtWorldPos(const Point2f& pos) const;
|
||||
|
||||
void SetTileAtIndex(const int x, const int y, WorldTile* tile);
|
||||
|
||||
private:
|
||||
std::array<std::array<WorldTile *, WORLD_WIDTH>, WORLD_HEIGHT> m_worldTiles;
|
||||
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user