mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 05:21:49 +00:00
fix world previews generation
This commit is contained in:
parent
acea4604fe
commit
6bc549dd90
5 changed files with 38 additions and 25 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "delegates.hpp"
|
||||
#include "graphics/core/commons.hpp"
|
||||
#include "util/CallbacksSet.hpp"
|
||||
#include "window/input.hpp"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
|
@ -23,29 +24,6 @@ namespace gui {
|
|||
using OnNumberChange = std::function<void(GUI&, double)>;
|
||||
using OnStringChange = std::function<void(GUI&, const std::string&)>;
|
||||
|
||||
template<typename... Args>
|
||||
class CallbacksSet {
|
||||
public:
|
||||
using Func = std::function<void(Args...)>;
|
||||
private:
|
||||
std::unique_ptr<std::vector<Func>> callbacks;
|
||||
public:
|
||||
void listen(const Func& callback) {
|
||||
if (callbacks == nullptr) {
|
||||
callbacks = std::make_unique<std::vector<Func>>();
|
||||
}
|
||||
callbacks->push_back(callback);
|
||||
}
|
||||
|
||||
void notify(Args&&... args) {
|
||||
if (callbacks) {
|
||||
for (auto& callback : *callbacks) {
|
||||
callback(std::forward<Args>(args)...);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<class TagT, typename... Args>
|
||||
class TaggedCallbacksSet {
|
||||
public:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue