VoxelEngine/src/world/LevelEvents.cpp
InfiniteCoder c7755040bd voxels/
2024-08-04 22:42:44 +03:00

18 lines
453 B
C++

#include "LevelEvents.hpp"
#include <voxels/Chunk.hpp>
using std::vector;
void LevelEvents::listen(lvl_event_type type, const chunk_event_func& func) {
auto& callbacks = chunk_callbacks[type];
callbacks.push_back(func);
}
void LevelEvents::trigger(lvl_event_type type, Chunk* chunk) {
const auto& callbacks = chunk_callbacks[type];
for (const chunk_event_func& func : callbacks) {
func(type, chunk);
}
}