Skip to content

Commit 69e3b6c

Browse files
committed
Very touchy bindings
1 parent ca96a82 commit 69e3b6c

5 files changed

Lines changed: 77 additions & 29 deletions

File tree

bindings/2.2081/Cocos2d.bro

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4189,9 +4189,7 @@ class cocos2d::CCSpriteFrameCache : cocos2d::CCObject {
41894189

41904190
[[link(win, android)]]
41914191
class cocos2d::CCStandardTouchHandler : cocos2d::CCTouchHandler {
4192-
virtual ~CCStandardTouchHandler();
4193-
4194-
static cocos2d::CCStandardTouchHandler* handlerWithDelegate(cocos2d::CCTouchDelegate*, int);
4192+
static cocos2d::CCStandardTouchHandler* handlerWithDelegate(cocos2d::CCTouchDelegate*, int) = m1 0x3e7584, imac 0x481470, ios 0xc604;
41954193

41964194
virtual bool initWithDelegate(cocos2d::CCTouchDelegate*, int) = imac 0x481410, m1 0x3e7514, ios 0xc5ec;
41974195
}
@@ -4244,14 +4242,14 @@ class cocos2d::CCTargetedAction : cocos2d::CCActionInterval {
42444242
class cocos2d::CCTargetedTouchHandler : cocos2d::CCTouchHandler {
42454243
virtual ~CCTargetedTouchHandler() = imac 0x4816d0, m1 0x3e77b8, ios 0xc784;
42464244

4247-
static cocos2d::CCTargetedTouchHandler* handlerWithDelegate(cocos2d::CCTouchDelegate*, int, bool);
4245+
static cocos2d::CCTargetedTouchHandler* handlerWithDelegate(cocos2d::CCTouchDelegate*, int, bool) = m1 0x3e7644, imac 0x481550, ios 0xc698;
42484246

42494247
cocos2d::CCSet* getClaimedTouches() = imac 0x481540, m1 0x3e763c, ios 0xc690;
4250-
bool initWithDelegate(cocos2d::CCTouchDelegate*, int, bool);
4248+
bool initWithDelegate(cocos2d::CCTouchDelegate*, int, bool) = m1 0x3e7724, imac 0x481640, ios 0xc728;
42514249
// CCTargetedTouchHandler(cocos2d::CCTargetedTouchHandler const&);
42524250
// CCTargetedTouchHandler();
4253-
bool isSwallowsTouches();
4254-
void setSwallowsTouches(bool);
4251+
bool isSwallowsTouches() = m1 0x3e762c, imac 0x481520, ios 0xc688;
4252+
void setSwallowsTouches(bool) = m1 0x3e7634, imac 0x481530, ios inline;
42554253

42564254
bool m_bSwallowsTouches;
42574255
cocos2d::CCSet* m_pClaimedTouches;
@@ -4685,9 +4683,9 @@ class cocos2d::CCTouch : cocos2d::CCObject {
46854683
cocos2d::CCPoint getLocation() const = imac 0x59640, m1 0x4cd68, ios 0x2fe630;
46864684
cocos2d::CCPoint getLocationInView() const = imac 0x595e0, m1 0x4cd44, ios 0x2fe624;
46874685
cocos2d::CCPoint getPreviousLocation() const = imac 0x59670, m1 0x4cd94, ios inline;
4688-
cocos2d::CCPoint getPreviousLocationInView() const = imac 0x59600, m1 0x4cd50;
4686+
cocos2d::CCPoint getPreviousLocationInView() const = imac 0x59600, m1 0x4cd50, ios inline;
46894687
cocos2d::CCPoint getStartLocation() const = imac 0x596a0, m1 0x4cdc0, ios inline;
4690-
cocos2d::CCPoint getStartLocationInView() const;
4688+
cocos2d::CCPoint getStartLocationInView() const = m1 0x4cd5c, imac 0x59620, ios inline;
46914689

46924690
int m_nId;
46934691
bool m_startPointCaptured;
@@ -4701,40 +4699,40 @@ class cocos2d::CCTouchDelegate {
47014699
// CCTouchDelegate(cocos2d::CCTouchDelegate const&);
47024700
// CCTouchDelegate();
47034701

4704-
virtual void setPreviousPriority(int);
4705-
virtual int getPreviousPriority();
4702+
virtual void setPreviousPriority(int) = mac inline, ios inline;
4703+
virtual int getPreviousPriority() = mac inline, ios inline;
47064704
}
47074705

47084706
[[link(win, android)]]
47094707
class cocos2d::CCTouchDispatcher : cocos2d::CCObject, cocos2d::EGLTouchDelegate {
47104708
// CCTouchDispatcher(cocos2d::CCTouchDispatcher const&);
47114709
// CCTouchDispatcher();
4712-
virtual ~CCTouchDispatcher();
4710+
virtual ~CCTouchDispatcher() = m1 0x42a778, imac 0x4cbaa0, ios 0x14ebbc;
47134711

47144712
virtual void touchesBegan(cocos2d::CCSet*, cocos2d::CCEvent*) = imac 0x4ccba0, m1 0x42b888, ios 0x14f69c;
47154713
virtual void touchesMoved(cocos2d::CCSet*, cocos2d::CCEvent*) = imac 0x4ccbe0, m1 0x42b8bc, ios 0x14f6d0;
47164714
virtual void touchesEnded(cocos2d::CCSet*, cocos2d::CCEvent*) = imac 0x4ccc20, m1 0x42b8f0, ios 0x14f704;
47174715
virtual void touchesCancelled(cocos2d::CCSet*, cocos2d::CCEvent*) = imac 0x4ccc60, m1 0x42b924, ios 0x14f738;
47184716

47194717
void addPrioTargetedDelegate(cocos2d::CCTouchDelegate*, int, bool) = imac 0x4cbcb0, m1 0x42a984, ios 0x14ed58;
4720-
void addStandardDelegate(cocos2d::CCTouchDelegate*, int);
4718+
void addStandardDelegate(cocos2d::CCTouchDelegate*, int) = m1 0x42ac20, imac 0x4cbf20, ios 0x14ef54;
47214719
void addTargetedDelegate(cocos2d::CCTouchDelegate*, int, bool) = imac 0x4cbcd0, m1 0x42a99c, ios 0x14ed70;
4722-
void decrementForcePrio(int);
4720+
void decrementForcePrio(int) = m1 0x42a840, imac 0x4cbba0, ios inline;
47234721
cocos2d::CCTouchHandler* findHandler(cocos2d::CCTouchDelegate*) = imac 0x4cc2b0, m1 0x42b000, ios 0x14f200;
4724-
cocos2d::CCTouchHandler* findHandler(cocos2d::CCArray*, cocos2d::CCTouchDelegate*);
4725-
void forceAddHandler(cocos2d::CCTouchHandler*, cocos2d::CCArray*);
4726-
void forceRemoveAllDelegates();
4722+
cocos2d::CCTouchHandler* findHandler(cocos2d::CCArray*, cocos2d::CCTouchDelegate*) = m1 0x42af14, imac 0x4cc1f0, ios 0x14f150;
4723+
void forceAddHandler(cocos2d::CCTouchHandler*, cocos2d::CCArray*) = m1 0x42ab4c, imac 0x4cbe50, ios 0x14ee80;
4724+
void forceRemoveAllDelegates() = m1 0x42af98, imac 0x4cc250, ios inline;
47274725
void forceRemoveDelegate(cocos2d::CCTouchDelegate*) = imac 0x4cc040, m1 0x42ad54, ios 0x14efe8;
4728-
void incrementForcePrio(int);
4726+
void incrementForcePrio(int) = m1 0x42a824, imac 0x4cbb90, ios inline;
47294727
bool init() = imac 0x4cba00, m1 0x42a6f0, ios 0x14eb34;
4730-
bool isDispatchEvents();
4728+
bool isDispatchEvents() = m1 0x42a6e0, imac 0x4cb9e0, ios inline;
47314729
bool isUsingForcePrio() = imac 0x4cbca0, m1 0x42a974, ios 0x14ed48;
47324730
void rearrangeHandlers(cocos2d::CCArray* handlers) = imac 0x4cc370, m1 0x42b0dc, ios inline;
47334731
void registerForcePrio(cocos2d::CCObject*, int) = imac 0x4cbbb0, m1 0x42a85c, ios 0x14ec68;
4734-
void removeAllDelegates();
4732+
void removeAllDelegates() = m1 0x42afc0, imac 0x4cc280, ios 0x14f1bc;
47354733
void removeDelegate(cocos2d::CCTouchDelegate*) = imac 0x4cc130, m1 0x42ae48, ios 0x14f0d4;
47364734
// int getTargetPrio() const;
4737-
void setDispatchEvents(bool);
4735+
void setDispatchEvents(bool) = m1 0x42a6e8, imac 0x4cb9f0, ios 0x14eb2c;
47384736
void setPriority(int p1, cocos2d::CCTouchDelegate* p2) = imac 0x4cc3f0, m1 0x42b164, ios inline;
47394737
void touches(cocos2d::CCSet*, cocos2d::CCEvent*, unsigned int) = imac 0x4cc540, m1 0x42b2d4, ios 0x14f2c0;
47404738
void unregisterForcePrio(cocos2d::CCObject*) = imac 0x4cbc50, m1 0x42a910, ios 0x14ece4;
@@ -4757,17 +4755,17 @@ class cocos2d::CCTouchDispatcher : cocos2d::CCObject, cocos2d::EGLTouchDelegate
47574755
class cocos2d::CCTouchHandler : cocos2d::CCObject {
47584756
virtual ~CCTouchHandler() = imac 0x4812f0, m1 0x3e740c, ios 0xc580;
47594757

4760-
static cocos2d::CCTouchHandler* handlerWithDelegate(cocos2d::CCTouchDelegate*, int);
4758+
static cocos2d::CCTouchHandler* handlerWithDelegate(cocos2d::CCTouchDelegate*, int) = m1 0x3e72f4, imac 0x4811e0, ios inline;
47614759

47624760
// CCTouchHandler(cocos2d::CCTouchHandler const&);
47634761
// CCTouchHandler();
47644762
virtual bool initWithDelegate(cocos2d::CCTouchDelegate*, int) = imac 0x481290, m1 0x3e739c, ios 0xc524;
47654763

47664764
cocos2d::CCTouchDelegate* getDelegate() = imac 0x481120, m1 0x3e7260, ios 0xc514;
4767-
int getEnabledSelectors();
4768-
int getPriority() = imac 0x4811a0, m1 0x3e72d4, ios inline;
4769-
void setDelegate(cocos2d::CCTouchDelegate*);
4770-
void setEnalbedSelectors(int);
4765+
int getEnabledSelectors() = m1 0x3e72e4, imac 0x4811c0, ios inline;
4766+
int getPriority() = imac 0x4811a0, m1 0x3e72d4, ios 0xc51c;
4767+
void setDelegate(cocos2d::CCTouchDelegate*) = m1 0x3e7268, imac 0x481130, ios inline;
4768+
void setEnalbedSelectors(int) = m1 0x3e72ec, imac 0x4811d0, ios inline;
47714769
void setPriority(int prio) = imac 0x4811b0, m1 0x3e72dc, ios inline;
47724770

47734771
cocos2d::CCTouchDelegate* m_pDelegate;

bindings/2.2081/inline/CCTargetedTouchHandler.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88
#endif
99

1010
#if defined(GEODE_IS_IOS)
11+
void cocos2d::CCTargetedTouchHandler::setSwallowsTouches(bool bSwallowsTouches) {
12+
m_bSwallowsTouches = bSwallowsTouches;
13+
}
1114
#endif
1215

bindings/2.2081/inline/CCTouch.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,16 @@ cocos2d::CCPoint cocos2d::CCTouch::getPreviousLocation() const {
1616
return CCDirector::sharedDirector()->convertToGL(m_prevPoint);
1717
}
1818

19+
cocos2d::CCPoint cocos2d::CCTouch::getPreviousLocationInView() const {
20+
return m_prevPoint;
21+
}
22+
1923
cocos2d::CCPoint cocos2d::CCTouch::getStartLocation() const {
2024
return CCDirector::sharedDirector()->convertToGL(m_startPoint);
2125
}
26+
27+
cocos2d::CCPoint cocos2d::CCTouch::getStartLocationInView() const {
28+
return m_startPoint;
29+
}
2230
#endif
2331

bindings/2.2081/inline/CCTouchDispatcher.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,25 @@
88
#endif
99

1010
#if defined(GEODE_IS_IOS)
11+
void cocos2d::CCTouchDispatcher::decrementForcePrio(int priority) {
12+
m_forcePrio -= priority;
13+
m_targetPrio += priority;
14+
}
15+
16+
void cocos2d::CCTouchDispatcher::forceRemoveAllDelegates() {
17+
m_pStandardHandlers->removeAllObjects();
18+
m_pTargetedHandlers->removeAllObjects();
19+
}
20+
21+
void cocos2d::CCTouchDispatcher::incrementForcePrio(int priority) {
22+
m_forcePrio += priority;
23+
m_targetPrio -= priority;
24+
}
25+
26+
bool cocos2d::CCTouchDispatcher::isDispatchEvents() {
27+
return m_bDispatchEvents;
28+
}
29+
1130
void cocos2d::CCTouchDispatcher::rearrangeHandlers(cocos2d::CCArray* handlers) {
1231
std::sort(handlers->data->arr, handlers->data->arr + handlers->data->num, [](const CCObject* p1, const CCObject* p2) {
1332
return ((CCTouchHandler*)p1)->getPriority() < ((CCTouchHandler*)p2)->getPriority();

bindings/2.2081/inline/CCTouchHandler.cpp

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,32 @@
88
#endif
99

1010
#if defined(GEODE_IS_IOS)
11-
int cocos2d::CCTouchHandler::getPriority() {
12-
return m_nPriority;
11+
int cocos2d::CCTouchHandler::getEnabledSelectors() {
12+
return m_nEnabledSelectors;
13+
}
14+
15+
cocos2d::CCTouchHandler* cocos2d::CCTouchHandler::handlerWithDelegate(cocos2d::CCTouchDelegate* delegate, int priority) {
16+
auto ret = new CCTouchHandler();
17+
if (ret->initWithDelegate(delegate, priority)) {
18+
ret->autorelease();
19+
return ret;
20+
}
21+
ret->release();
22+
return nullptr;
23+
}
24+
25+
void cocos2d::CCTouchHandler::setDelegate(cocos2d::CCTouchDelegate* delegate) {
26+
if (delegate) geode::cast::typeinfo_cast<cocos2d::CCObject*>(delegate)->retain();
27+
if (m_pDelegate) geode::cast::typeinfo_cast<cocos2d::CCObject*>(m_pDelegate)->release();
28+
m_pDelegate = delegate;
29+
}
30+
31+
void cocos2d::CCTouchHandler::setEnalbedSelectors(int value) {
32+
m_nEnabledSelectors = value;
1333
}
1434

1535
void cocos2d::CCTouchHandler::setPriority(int prio) {
16-
m_nPriority = prio;
36+
m_nPriority = prio;
1737
}
1838
#endif
1939

0 commit comments

Comments
 (0)