mirror of
https://github.com/geode-sdk/geode.git
synced 2025-02-17 00:30:26 -05:00
fine
This commit is contained in:
parent
3ede15b6e2
commit
9a47d611cc
2 changed files with 11 additions and 16 deletions
|
@ -33,11 +33,21 @@ namespace geode {
|
|||
protected:
|
||||
std::string m_id;
|
||||
|
||||
static auto& pools() {
|
||||
static std::unordered_map<std::string, EventListenerPool*> s_pools;
|
||||
return s_pools;
|
||||
}
|
||||
|
||||
public:
|
||||
using Ev = DispatchEvent<Args...>;
|
||||
using Callback = ListenerResult(Args...);
|
||||
|
||||
EventListenerPool* getPool() const override;
|
||||
EventListenerPool* getPool() const override {
|
||||
if (pools().count(m_id) == 0) {
|
||||
pools()[m_id] = new DefaultEventListenerPool();
|
||||
}
|
||||
return pools()[m_id];
|
||||
}
|
||||
|
||||
ListenerResult handle(utils::MiniFunction<Callback> fn, Ev* event) {
|
||||
if (event->getID() == m_id) {
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
#include <Geode/loader/Dispatch.hpp>
|
||||
#include <Geode/utils/ranges.hpp>
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
static std::unordered_map<std::string, EventListenerPool*> s_pools;
|
||||
|
||||
EventListenerPool* DispatchFilter::getPool() const {
|
||||
if (s_pools.count(m_id) == 0) {
|
||||
s_pools[m_id] = new DefaultEventListenerPool();
|
||||
}
|
||||
return s_pools[m_id];
|
||||
}
|
Loading…
Reference in a new issue