New world format, fixes

This commit is contained in:
MihailRis
2023-11-05 15:32:46 +03:00
committed by GitHub
parent 0c65b13f4e
commit 0cf8382e95
21 changed files with 350 additions and 173 deletions
+23
View File
@@ -0,0 +1,23 @@
#ifndef WORLD_LEVEL_EVENTS_H_
#define WORLD_LEVEL_EVENTS_H_
#include <functional>
#include <vector>
#include <unordered_map>
class Chunk;
enum lvl_event_type {
EVT_CHUNK_HIDDEN,
};
typedef std::function<void(lvl_event_type, Chunk*)> chunk_event_func;
class LevelEvents {
std::unordered_map<lvl_event_type, std::vector<chunk_event_func>> chunk_callbacks;
public:
void listen(lvl_event_type type, chunk_event_func func);
void trigger(lvl_event_type type, Chunk* chunk);
};
#endif // WORLD_LEVEL_EVENTS_H_