Skip to content

Commit 40cc39f

Browse files
committed
Particle bindings
1 parent b79dff5 commit 40cc39f

File tree

3 files changed

+96
-46
lines changed

3 files changed

+96
-46
lines changed

bindings/2.2081/Cocos2d.bro

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2884,11 +2884,11 @@ class cocos2d::CCParallaxNode : cocos2d::CCNode {
28842884

28852885
[[link(win, android)]]
28862886
class cocos2d::CCParticleBatchNode : cocos2d::CCNode, cocos2d::CCTextureProtocol {
2887-
CCParticleBatchNode();
2888-
virtual ~CCParticleBatchNode();
2887+
CCParticleBatchNode() = m1 0x349cfc, imac 0x3c8820;
2888+
virtual ~CCParticleBatchNode() = m1 0x349d4c, imac 0x3c88a0;
28892889

2890-
static cocos2d::CCParticleBatchNode* create(char const*, unsigned int);
2891-
static cocos2d::CCParticleBatchNode* createWithTexture(cocos2d::CCTexture2D*, unsigned int);
2890+
static cocos2d::CCParticleBatchNode* create(char const*, unsigned int) = m1 0x349f64, imac 0x3c8ad0;
2891+
static cocos2d::CCParticleBatchNode* createWithTexture(cocos2d::CCTexture2D*, unsigned int) = m1 0x349e1c, imac 0x3c8990;
28922892

28932893
virtual void addChild(cocos2d::CCNode*) = imac 0x3c8c20, m1 0x34a0c4;
28942894
virtual void addChild(cocos2d::CCNode*, int) = imac 0x3c8c30, m1 0x34a0c8;
@@ -2903,17 +2903,17 @@ class cocos2d::CCParticleBatchNode : cocos2d::CCNode, cocos2d::CCTextureProtocol
29032903
virtual cocos2d::ccBlendFunc getBlendFunc() = imac 0x3c9880, m1 0x34adf8;
29042904
virtual void visit() = imac 0x3c8bb0, m1 0x34a040;
29052905

2906-
unsigned int addChildHelper(cocos2d::CCParticleSystem*, int, int);
2907-
void disableParticle(unsigned int);
2908-
void getCurrentIndex(unsigned int*, unsigned int*, cocos2d::CCNode*, int);
2909-
void increaseAtlasCapacityTo(unsigned int);
2910-
bool initWithFile(char const*, unsigned int);
2911-
bool initWithTexture(cocos2d::CCTexture2D*, unsigned int);
2912-
void insertChild(cocos2d::CCParticleSystem*, unsigned int);
2913-
void removeChildAtIndex(unsigned int, bool);
2914-
unsigned int searchNewPositionInChildrenForZ(int);
2915-
void updateAllAtlasIndexes();
2916-
void updateBlendFunc();
2906+
unsigned int addChildHelper(cocos2d::CCParticleSystem*, int, int) = m1 0x34a1f8, imac 0x3c8d40;
2907+
void disableParticle(unsigned int) = m1 0x34ac80, imac 0x3c9700;
2908+
void getCurrentIndex(unsigned int*, unsigned int*, cocos2d::CCNode*, int) = m1 0x34a898, imac 0x3c9320;
2909+
void increaseAtlasCapacityTo(unsigned int) = m1 0x34ac78, imac 0x3c96e0;
2910+
bool initWithFile(char const*, unsigned int) = m1 0x349ff0, imac 0x3c8b70;
2911+
bool initWithTexture(cocos2d::CCTexture2D*, unsigned int) = m1 0x349e98, imac 0x3c8a10;
2912+
void insertChild(cocos2d::CCParticleSystem*, unsigned int) = m1 0x34a34c, imac 0x3c8e80;
2913+
void removeChildAtIndex(unsigned int, bool) = m1 0x34ab24, imac 0x3c9590;
2914+
unsigned int searchNewPositionInChildrenForZ(int) = m1 0x34a504, imac 0x3c9010;
2915+
void updateAllAtlasIndexes() = m1 0x34a9ac, imac 0x3c9430;
2916+
void updateBlendFunc() = m1 0x34acc8, imac 0x3c9750;
29172917
}
29182918

29192919
[[link(win, android)]]
@@ -2940,32 +2940,32 @@ class cocos2d::CCParticleFire : cocos2d::CCParticleSystemQuad {
29402940

29412941
[[link(win, android)]]
29422942
class cocos2d::CCParticleFireworks : cocos2d::CCParticleSystemQuad {
2943-
static cocos2d::CCParticleFireworks* create();
2944-
static cocos2d::CCParticleFireworks* createWithTotalParticles(unsigned int);
2943+
static cocos2d::CCParticleFireworks* create() = m1 0x3ead6c, imac 0x485280;
2944+
static cocos2d::CCParticleFireworks* createWithTotalParticles(unsigned int) = m1 0x3eadfc, imac 0x485300;
29452945

29462946
virtual bool initWithTotalParticles(unsigned int) = imac 0x485380, m1 0x3eae90;
29472947
}
29482948

29492949
[[link(win, android)]]
29502950
class cocos2d::CCParticleFlower : cocos2d::CCParticleSystemQuad {
2951-
static cocos2d::CCParticleFlower* create();
2952-
static cocos2d::CCParticleFlower* createWithTotalParticles(unsigned int);
2951+
static cocos2d::CCParticleFlower* create() = m1 0x3eb5b8, imac 0x485a80;
2952+
static cocos2d::CCParticleFlower* createWithTotalParticles(unsigned int) = m1 0x3eb648, imac 0x485b00;
29532953

29542954
virtual bool initWithTotalParticles(unsigned int) = imac 0x485b80, m1 0x3eb6dc;
29552955
}
29562956

29572957
[[link(win, android)]]
29582958
class cocos2d::CCParticleGalaxy : cocos2d::CCParticleSystemQuad {
2959-
static cocos2d::CCParticleGalaxy* create();
2960-
static cocos2d::CCParticleGalaxy* createWithTotalParticles(unsigned int);
2959+
static cocos2d::CCParticleGalaxy* create() = m1 0x3eb2a8, imac 0x4857a0;
2960+
static cocos2d::CCParticleGalaxy* createWithTotalParticles(unsigned int) = m1 0x3eb338, imac 0x485820;
29612961

29622962
virtual bool initWithTotalParticles(unsigned int) = imac 0x4858a0, m1 0x3eb3cc;
29632963
}
29642964

29652965
[[link(win, android)]]
29662966
class cocos2d::CCParticleMeteor : cocos2d::CCParticleSystemQuad {
2967-
static cocos2d::CCParticleMeteor* create();
2968-
static cocos2d::CCParticleMeteor* createWithTotalParticles(unsigned int);
2967+
static cocos2d::CCParticleMeteor* create() = m1 0x3eb8c8, imac 0x485d70;
2968+
static cocos2d::CCParticleMeteor* createWithTotalParticles(unsigned int) = m1 0x3eb958, imac 0x485df0;
29692969

29702970
virtual bool initWithTotalParticles(unsigned int) = imac 0x485e70, m1 0x3eb9ec;
29712971
}
@@ -2983,8 +2983,8 @@ class cocos2d::CCParticleRain : cocos2d::CCParticleSystemQuad {
29832983

29842984
[[link(win, android)]]
29852985
class cocos2d::CCParticleSmoke : cocos2d::CCParticleSystemQuad {
2986-
static cocos2d::CCParticleSmoke* create();
2987-
static cocos2d::CCParticleSmoke* createWithTotalParticles(unsigned int);
2986+
static cocos2d::CCParticleSmoke* create() = m1 0x3ec1e8, imac 0x486600;
2987+
static cocos2d::CCParticleSmoke* createWithTotalParticles(unsigned int) = m1 0x3ec278, imac 0x486680;
29882988

29892989
virtual bool initWithTotalParticles(unsigned int) = imac 0x486700, m1 0x3ec30c;
29902990
}
@@ -3002,16 +3002,16 @@ class cocos2d::CCParticleSnow : cocos2d::CCParticleSystemQuad {
30023002

30033003
[[link(win, android)]]
30043004
class cocos2d::CCParticleSpiral : cocos2d::CCParticleSystemQuad {
3005-
static cocos2d::CCParticleSpiral* create();
3006-
static cocos2d::CCParticleSpiral* createWithTotalParticles(unsigned int);
3005+
static cocos2d::CCParticleSpiral* create() = m1 0x3ebbe0, imac 0x486060;
3006+
static cocos2d::CCParticleSpiral* createWithTotalParticles(unsigned int) = m1 0x3ebc70, imac 0x4860e0;
30073007

30083008
virtual bool initWithTotalParticles(unsigned int) = imac 0x486160, m1 0x3ebd04;
30093009
}
30103010

30113011
[[link(win, android)]]
30123012
class cocos2d::CCParticleSun : cocos2d::CCParticleSystemQuad {
3013-
static cocos2d::CCParticleSun* create();
3014-
static cocos2d::CCParticleSun* createWithTotalParticles(unsigned int);
3013+
static cocos2d::CCParticleSun* create() = m1 0x3eafd4, imac 0x4854f0;
3014+
static cocos2d::CCParticleSun* createWithTotalParticles(unsigned int) = m1 0x3eb064, imac 0x485570;
30153015

30163016
virtual bool initWithTotalParticles(unsigned int) = imac 0x4855f0, m1 0x3eb0f8;
30173017
}
@@ -3050,8 +3050,8 @@ class cocos2d::CCParticleSystem : cocos2d::CCNode, cocos2d::CCTextureProtocol {
30503050
CCParticleSystem() = imac 0x7c6a00, m1 0x6cba14, ios 0x193210;
30513051
virtual ~CCParticleSystem() = imac 0x7c8b50, m1 0x6cd8d0, ios 0x19478c;
30523052

3053-
static cocos2d::CCParticleSystem* create(char const*) = imac 0x7c6bc0, m1 0x6cbb60;
3054-
static cocos2d::CCParticleSystem* createWithTotalParticles(unsigned int);
3053+
static cocos2d::CCParticleSystem* create(char const*) = imac 0x7c6bc0, m1 0x6cbb60, ios inline;
3054+
static cocos2d::CCParticleSystem* createWithTotalParticles(unsigned int) = m1 0x6cbe48, imac 0x7c6e90, ios inline;
30553055

30563056
virtual void update(float) = imac 0x7c9f90, m1 0x6ce94c, ios 0x1955d4;
30573057
virtual bool init() = imac 0x7c6f00, m1 0x6cbed4, ios 0x1934d4;
@@ -3155,8 +3155,8 @@ class cocos2d::CCParticleSystem : cocos2d::CCNode, cocos2d::CCTextureProtocol {
31553155
virtual cocos2d::CCTexture2D* getTexture() = imac 0x7caf90, m1 0x6cf634, ios 0x196170;
31563156
virtual void setTexture(cocos2d::CCTexture2D*) = imac 0x7cae50, m1 0x6cf4f4, ios 0x1960a0;
31573157

3158-
bool addParticle();
3159-
void calculateWorldSpace();
3158+
bool addParticle() = m1 0x6cda34, imac 0x7c8ce0, ios 0x194808;
3159+
void calculateWorldSpace() = m1 0x6ce78c, imac 0x7c9d60, ios 0x19543c;
31603160
// unsigned int getAtlasIndex() const;
31613161
// bool getDontCleanupOnFinish() const;
31623162
// bool getDynamicRotationIsDir() const;
@@ -3179,20 +3179,20 @@ class cocos2d::CCParticleSystem : cocos2d::CCNode, cocos2d::CCTextureProtocol {
31793179
// bool getStartRadiusEqualToEnd() const;
31803180
// bool getStartSizeEqualToEnd() const;
31813181
// bool getStartSpinEqualToEnd() const;
3182-
float getTimeElapsed();
3182+
float getTimeElapsed() = m1 0x6cd8c8, imac 0x7c8b40, ios 0x194784;
31833183
void initParticle(cocos2d::sCCParticle*) = imac 0x7c8d50, m1 0x6cdaa0, ios 0x194860;
31843184
bool initWithDictionary(cocos2d::CCDictionary*, bool) = imac 0x7c88d0, m1 0x6cd6dc, ios inline;
31853185
bool initWithDictionary(cocos2d::CCDictionary*, char const*, bool) = imac 0x7c6f20, m1 0x6cbee8, ios 0x1934e8;
31863186
bool initWithFile(char const*, bool) = imac 0x7c6c20, m1 0x6cbbe4, ios 0x193368;
3187-
bool isFull();
3188-
void loadDefaults();
3187+
bool isFull() = m1 0x6cda8c, imac 0x7c8d30, ios inline;
3188+
void loadDefaults() = m1 0x6cfaec, imac 0x7cb7a0, ios inline;
31893189
void loadScaledDefaults(float) = imac 0x7cb830, m1 0x6cfb68, ios 0x196638;
31903190
void resetSystem() = imac 0x7c9df0, m1 0x6ce7fc, ios 0x1954ac;
31913191
void resumeSystem() = imac 0x7c9de0, m1 0x6ce7f0, ios 0x1954a0;
3192-
void saveDefaults();
3192+
void saveDefaults() = m1 0x6cd6ec, imac 0x7c88f0, ios 0x19457c;
31933193
void stopSystem() = imac 0x7c9db0, m1 0x6ce7dc, ios 0x19548c;
31943194
// void toggleUniformColorMode(bool);
3195-
void updateVisible();
3195+
void updateVisible() = m1 0x6ce924, imac 0x7c9f60, ios inline;
31963196

31973197
gd::string m_sPlistFile;
31983198
float m_fElapsed;
@@ -3303,19 +3303,19 @@ class cocos2d::CCParticleSystemQuad : cocos2d::CCParticleSystem {
33033303
virtual void postStep() = imac 0x603490, m1 0x52ad2c, ios 0x253d14;
33043304
virtual void setTexture(cocos2d::CCTexture2D*) = imac 0x602fc0, m1 0x52a88c, ios 0x2539b0;
33053305

3306-
bool allocMemory() = imac 0x6023f0, m1 0x52a03c;
3307-
void initIndices();
3308-
void initTexCoordsWithRect(cocos2d::CCRect const&) = imac 0x602cf0, m1 0x52a618;
3309-
void listenBackToForeground(cocos2d::CCObject*);
3306+
bool allocMemory() = imac 0x6023f0, m1 0x52a03c, ios 0x25335c;
3307+
void initIndices() = m1 0x52a11c, imac 0x6024e0, ios 0x25342c;
3308+
void initTexCoordsWithRect(cocos2d::CCRect const&) = imac 0x602cf0, m1 0x52a618, ios 0x2537ec;
3309+
void listenBackToForeground(cocos2d::CCObject*) = m1 0x52b04c, imac 0x603aa0, ios inline;
33103310
// unsigned char getOpacity();
33113311
void setDisplayFrame(cocos2d::CCSpriteFrame*) = imac 0x6030e0, m1 0x52a9d8, ios 0x253a18;
33123312
// void setOpacity(unsigned char);
3313-
void setTextureWithRect(cocos2d::CCTexture2D*, cocos2d::CCRect const&);
3313+
void setTextureWithRect(cocos2d::CCTexture2D*, cocos2d::CCRect const&) = m1 0x52a818, imac 0x602f60, ios 0x25393c;
33143314
[[missing(mac, ios)]]
33153315
void setupVBO();
33163316
[[missing(win, android)]]
3317-
void setupVBOandVAO() = imac 0x6027d0, m1 0x52a18c;
3318-
void updateTexCoords();
3317+
void setupVBOandVAO() = imac 0x6027d0, m1 0x52a18c, ios 0x25349c;
3318+
void updateTexCoords() = m1 0x52a804, imac 0x602f40, ios inline;
33193319

33203320
cocos2d::ccV3F_C4B_T2F_Quad* m_pQuads;
33213321
uint16_t* m_pIndices;

bindings/2.2081/inline/CCParticleSystem.cpp

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,48 @@
88
#endif
99

1010
#if defined(GEODE_IS_IOS)
11+
cocos2d::CCParticleSystem* cocos2d::CCParticleSystem::create(const char* plistFile) {
12+
auto ret = new CCParticleSystem();
13+
if (ret->initWithFile(plistFile, false)) {
14+
ret->autorelease();
15+
return ret;
16+
}
17+
delete ret;
18+
return nullptr;
19+
}
20+
21+
cocos2d::CCParticleSystem* cocos2d::CCParticleSystem::createWithTotalParticles(unsigned int numberOfParticles) {
22+
auto ret = new CCParticleSystem();
23+
if (ret->initWithTotalParticles(numberOfParticles, false)) {
24+
ret->autorelease();
25+
return ret;
26+
}
27+
delete ret;
28+
return nullptr;
29+
}
30+
1131
bool cocos2d::CCParticleSystem::initWithDictionary(cocos2d::CCDictionary* p0, bool p1) {
12-
return cocos2d::CCParticleSystem::initWithDictionary(p0, "", p1);
32+
return this->initWithDictionary(p0, "", p1);
33+
}
34+
35+
bool cocos2d::CCParticleSystem::isFull() {
36+
return m_uParticleCount == m_uTotalParticles;
37+
}
38+
39+
void cocos2d::CCParticleSystem::loadDefaults() {
40+
m_fStartSize = m_fDefaultStartSize;
41+
m_fStartSizeVar = m_fDefaultStartSizeVar;
42+
m_fEndSize = m_fDefaultEndSize;
43+
m_tPosVar = m_tDefaultPosVar;
44+
m_fAngle = m_fDefaultAngle;
45+
if (m_nEmitterMode == kCCParticleModeGravity) {
46+
this->setSpeed(m_fDefaultModeASpeed);
47+
this->setSpeedVar(m_fDefaultModeASpeedVar);
48+
}
49+
}
50+
51+
void cocos2d::CCParticleSystem::updateVisible() {
52+
m_bVisible = *reinterpret_cast<bool*>(reinterpret_cast<uintptr_t>(&m_bUsingSchedule) + 1) && m_uParticleCount != 0;
1353
}
1454
#endif
1555

bindings/2.2081/inline/CCParticleSystemQuad.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,15 @@ cocos2d::CCParticleSystemQuad* cocos2d::CCParticleSystemQuad::create() {
1818
CC_SAFE_DELETE(pParticleSystemQuad);
1919
return nullptr;
2020
}
21+
22+
void cocos2d::CCParticleSystemQuad::listenBackToForeground(cocos2d::CCObject* obj) {
23+
this->setupVBOandVAO();
24+
}
25+
26+
void cocos2d::CCParticleSystemQuad::updateTexCoords() {
27+
if (m_pTexture) {
28+
this->initTexCoordsWithRect(m_tTextureRect);
29+
}
30+
}
2131
#endif
2232

0 commit comments

Comments
 (0)