fix world previews generation

This commit is contained in:
MihailRis
2025-11-22 19:23:46 +03:00
parent acea4604fe
commit 6bc549dd90
5 changed files with 38 additions and 25 deletions
+1 -23
View File
@@ -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: