started implementing the tilesystem, rendering is broken, all chunks are at 0,0

This commit is contained in:
nosch
2025-09-02 01:02:54 +02:00
parent 05e538117c
commit 904983d633
5 changed files with 95 additions and 31 deletions
+22 -4
View File
@@ -5,6 +5,7 @@
#include <unordered_map>
#include <vector>
#include <array>
#include "iostream"
// Forward declarations
struct Chunk;
@@ -29,9 +30,9 @@ struct Chunk {
Tile tiles[64]; // dynamic instead of fixed array
Layer* owner;
void Draw();
void Draw(raylib::Rectangle aera);
Chunk(Layer* Owner);
Chunk(Vector2 pos, Layer* Owner);
Chunk(); // default constructor
};
@@ -49,19 +50,36 @@ struct Layer {
bool DEBUG;
Map* owner;
void Draw();
void Draw(raylib::Rectangle aera);
Layer(ID Id, Map* Owner);
Layer(); // default constructor
};
enum Actions{
place,
destroy,
rotate,
open,
close,
drop,
};
struct packet {
Actions action;
Vector2 position;
int data;
};
struct Map {
std::array<Layer, 4> layers; // ground/water/void/decoration
int worldtime;
bool DEBUG;
Map();
void Draw();
void Draw(raylib::Rectangle aera);
void Init();
void Update(float deltatime, packet datapacket);
};
#endif // !TILEBASE_HPP