started implementing the tilesystem, rendering is broken, all chunks are at 0,0
This commit is contained in:
+22
-4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user