mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-23 07:57:51 -05:00
add EventListener::getFilter
This commit is contained in:
parent
704e6ba0db
commit
5cdfbc3e67
3 changed files with 19 additions and 4 deletions
|
@ -408,12 +408,12 @@ class cocos2d::CCMenu {
|
|||
virtual auto registerWithTouchDispatcher() = mac 0x438cd0, ios 0x131f8c;
|
||||
virtual auto onExit() = mac 0x438bd0, ios 0x131ed4;
|
||||
virtual auto removeChild(cocos2d::CCNode*, bool) = mac 0x438c20, ios 0x15e630;
|
||||
auto initWithArray(cocos2d::CCArray*) = mac 0x4389f0, ios 0x131d04;
|
||||
auto itemForTouch(cocos2d::CCTouch*) = mac 0x438dd0;
|
||||
bool initWithArray(cocos2d::CCArray*) = mac 0x4389f0, ios 0x131d04;
|
||||
cocos2d::CCMenuItem* itemForTouch(cocos2d::CCTouch*) = mac 0x438dd0;
|
||||
}
|
||||
|
||||
class cocos2d::CCMenuItem {
|
||||
auto initWithTarget(cocos2d::CCObject*, cocos2d::SEL_MenuHandler) = mac 0x1fb7f0;
|
||||
bool initWithTarget(cocos2d::CCObject*, cocos2d::SEL_MenuHandler) = mac 0x1fb7f0;
|
||||
virtual ~CCMenuItem() = mac 0x1fb8e0, ios 0x2cdf4;
|
||||
virtual auto activate() = mac 0x1fba70, ios 0x2ceb0;
|
||||
virtual auto selected() = mac 0x1fb9e0, ios 0x2ce2e;
|
||||
|
|
13
loader/include/Geode/cocos/base_nodes/CCNode.h
vendored
13
loader/include/Geode/cocos/base_nodes/CCNode.h
vendored
|
@ -990,13 +990,24 @@ public:
|
|||
GEODE_DLL void swapChildIndices(CCNode* first, CCNode* second);
|
||||
|
||||
template <class Filter, class... Args>
|
||||
geode::EventListenerProtocol* addEventListener(typename Filter::Callback callback, Args&&... args) {
|
||||
geode::EventListenerProtocol* addEventListener(
|
||||
geode::utils::MiniFunction<typename Filter::Callback> callback, Args&&... args
|
||||
) {
|
||||
auto listener = new geode::EventListener<Filter>(
|
||||
callback, Filter(this, std::forward<Args>(args)...)
|
||||
);
|
||||
this->addEventListenerInternal(listener);
|
||||
return listener;
|
||||
}
|
||||
template <class Ev, class... Args>
|
||||
geode::EventListenerProtocol* addEventListener(
|
||||
geode::utils::MiniFunction<geode::ListenerResult(Ev*)> callback,
|
||||
Args&&... args
|
||||
) {
|
||||
return this->template addEventListener<typename Ev::Filter>(
|
||||
callback, std::forward<Args>(args)...
|
||||
);
|
||||
}
|
||||
GEODE_DLL void removeEventListener(geode::EventListenerProtocol* listener);
|
||||
|
||||
/// @{
|
||||
|
|
|
@ -120,6 +120,10 @@ namespace geode {
|
|||
m_filter = filter;
|
||||
}
|
||||
|
||||
T getFilter() const {
|
||||
return m_filter;
|
||||
}
|
||||
|
||||
protected:
|
||||
utils::MiniFunction<Callback> m_callback = nullptr;
|
||||
T m_filter;
|
||||
|
|
Loading…
Reference in a new issue