Skip to content

Commit b485e13

Browse files
authored
CCMouseDispatcher::dispatchScrollMSG iOS
1 parent 2f7b9ee commit b485e13

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

bindings/2.2081/Cocos2d.bro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2492,7 +2492,7 @@ class cocos2d::CCMouseDispatcher : cocos2d::CCObject {
24922492
virtual ~CCMouseDispatcher() = imac 0x570bc0, m1 0x4be990, ios 0x2fe0f4;
24932493

24942494
void addDelegate(cocos2d::CCMouseDelegate*) = imac 0x570e20, m1 0x4bebec, ios 0x2fe23c;
2495-
bool dispatchScrollMSG(float, float) = imac 0x570ea0, m1 0x4bec84;
2495+
bool dispatchScrollMSG(float, float) = imac 0x570ea0, m1 0x4bec84, ios inline;
24962496
void forceAddDelegate(cocos2d::CCMouseDelegate*) = imac 0x570e70, m1 0x4bec48, ios inline;
24972497
void forceRemoveDelegate(cocos2d::CCMouseDelegate*) = imac 0x570d90, m1 0x4beb58, ios 0x2fe1a8;
24982498
void removeDelegate(cocos2d::CCMouseDelegate*) = imac 0x570ce0, m1 0x4bea90, ios 0x2fe160;

bindings/2.2081/inline/CCMouseDispatcher.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,40 @@
1111
void cocos2d::CCMouseDispatcher::forceAddDelegate(cocos2d::CCMouseDelegate* p0) {
1212
if (auto handler = CCMouseHandler::handlerWithDelegate(p0)) m_pMouseHandlers->addObject(handler);
1313
}
14+
15+
bool cocos2d::CCMouseDispatcher::dispatchScrollMSG(float x, float y) {
16+
m_bLocked = true;
17+
for (auto handler : geode::cocos::CCArrayExt<CCMouseHandler>(m_pMouseHandlers)) {
18+
if (!handler) continue;
19+
auto delegate = handler->getDelegate();
20+
if (!delegate) continue;
21+
delegate->scrollWheel(x, y);
22+
break;
23+
}
24+
m_bLocked = false;
25+
if (m_bToRemove) {
26+
m_bToRemove = false;
27+
if (m_pHandlersToRemove) {
28+
void* delegate;
29+
CCARRAYDATA_FOREACH(m_pHandlersToRemove, delegate) {
30+
forceRemoveDelegate(static_cast<CCMouseDelegate*>(delegate));
31+
}
32+
}
33+
ccCArrayRemoveAllValues(m_pHandlersToRemove);
34+
}
35+
36+
if (m_bToAdd) {
37+
m_bToAdd = false;
38+
if (m_pHandlersToAdd) {
39+
void* delegate;
40+
CCARRAYDATA_FOREACH(m_pHandlersToAdd, delegate) {
41+
forceAddDelegate(static_cast<CCMouseDelegate*>(delegate));
42+
}
43+
}
44+
ccCArrayRemoveAllValues(m_pHandlersToAdd);
45+
}
46+
47+
return true;
48+
}
1449
#endif
1550

0 commit comments

Comments
 (0)