started placement, its broken though
This commit is contained in:
+15
-8
@@ -12,6 +12,13 @@ struct Chunk;
|
||||
struct Layer;
|
||||
struct Map;
|
||||
|
||||
struct Coordinate {
|
||||
int x, y;
|
||||
|
||||
Coordinate();
|
||||
Coordinate(int X, int Y);
|
||||
};
|
||||
|
||||
struct Tile {
|
||||
ID id;
|
||||
ID spriteid;
|
||||
@@ -26,26 +33,26 @@ struct Tile {
|
||||
};
|
||||
|
||||
struct Chunk {
|
||||
raylib::Vector2 position;
|
||||
Coordinate position;
|
||||
std::vector<Tile> tiles; // dynamic instead of fixed array
|
||||
Layer* owner;
|
||||
|
||||
void Draw(raylib::Rectangle aera);
|
||||
|
||||
Chunk(Vector2 pos, Layer* Owner);
|
||||
Chunk(Coordinate pos, Layer* Owner);
|
||||
Chunk(); // default constructor
|
||||
};
|
||||
|
||||
struct Vector2Hash {
|
||||
std::size_t operator()(const Vector2& v) const noexcept;
|
||||
struct CoordinateHash {
|
||||
std::size_t operator()(const Coordinate& c) const noexcept;
|
||||
};
|
||||
|
||||
struct Vector2Eq {
|
||||
bool operator()(const Vector2& a, const Vector2& b) const noexcept;
|
||||
struct CoordinateEq {
|
||||
bool operator()(const Coordinate& a, const Coordinate& b) const noexcept;
|
||||
};
|
||||
|
||||
struct Layer {
|
||||
std::unordered_map<Vector2, Chunk, Vector2Hash, Vector2Eq> chunks;
|
||||
std::unordered_map<Coordinate, Chunk, CoordinateHash, CoordinateEq> chunks;
|
||||
ID id;
|
||||
bool DEBUG;
|
||||
Map* owner;
|
||||
@@ -67,7 +74,7 @@ enum Actions{
|
||||
|
||||
struct packet {
|
||||
Actions action;
|
||||
Vector2 position;
|
||||
Coordinate position;
|
||||
int data;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user