Skip to content

Commit d2c2998

Browse files
committed
CCCamera and CCConfiguration bindings
1 parent 46d2165 commit d2c2998

4 files changed

Lines changed: 151 additions & 36 deletions

File tree

bindings/2.2081/Cocos2d.bro

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -605,21 +605,21 @@ class cocos2d::CCCallFuncO : cocos2d::CCCallFunc, cocos2d::TypeInfo {
605605
[[link(win, android)]]
606606
class cocos2d::CCCamera : cocos2d::CCObject {
607607
// private CCCamera(cocos2d::CCCamera const&);
608-
CCCamera();
609-
virtual ~CCCamera();
608+
CCCamera() = m1 0x4b50c8, imac 0x566570, ios 0x19e470;
609+
virtual ~CCCamera() = m1 0x4b5138, imac 0x5665d0, ios inline;
610610

611-
static float getZEye();
611+
static float getZEye() = m1 0x4b51dc, imac 0x566690, ios inline;
612612

613-
char const* description();
614-
void getCenterXYZ(float*, float*, float*);
615-
void getEyeXYZ(float*, float*, float*);
616-
void getUpXYZ(float*, float*, float*);
617-
void init();
618-
void locate();
619-
void restore();
620-
void setCenterXYZ(float, float, float);
621-
void setEyeXYZ(float, float, float);
622-
void setUpXYZ(float, float, float);
613+
char const* description() = m1 0x4b5154, imac 0x566610, ios inline;
614+
void getCenterXYZ(float*, float*, float*) = m1 0x4b52bc, imac 0x5667e0, ios inline;
615+
void getEyeXYZ(float*, float*, float*) = m1 0x4b52a0, imac 0x5667b0, ios inline;
616+
void getUpXYZ(float*, float*, float*) = m1 0x4b52d8, imac 0x566810, ios inline;
617+
void init() = m1 0x4b5080, imac 0x566530, ios inline;
618+
void locate() = m1 0x4b51e4, imac 0x5666a0, ios 0x19e544;
619+
void restore() = m1 0x4b5194, imac 0x566650, ios 0x19e4fc;
620+
void setCenterXYZ(float, float, float) = m1 0x4b5278, imac 0x566770, ios inline;
621+
void setEyeXYZ(float, float, float) = m1 0x4b5264, imac 0x566750, ios inline;
622+
void setUpXYZ(float, float, float) = m1 0x4b528c, imac 0x566790, ios inline;
623623
}
624624

625625
[[link(win, android)]]
@@ -726,31 +726,31 @@ class cocos2d::CCComponentContainer {
726726

727727
[[link(win, android)]]
728728
class cocos2d::CCConfiguration : cocos2d::CCObject {
729-
CCConfiguration();
729+
CCConfiguration() = m1 0x46f6cc, imac 0x519030, ios inline;
730730
// CCConfiguration(cocos2d::CCConfiguration const&);
731-
virtual ~CCConfiguration();
731+
virtual ~CCConfiguration() = m1 0x46f9dc, imac 0x519350, ios 0x32491c;
732732

733-
static void purgeConfiguration();
733+
static void purgeConfiguration() = m1 0x470478, imac 0x519d40, ios 0x324fec;
734734
static cocos2d::CCConfiguration* sharedConfiguration() = imac 0x519cb0, m1 0x4703f8, ios 0x324f78;
735735

736736
bool checkForGLExtension(gd::string const&) const = imac 0x519c80, m1 0x4703c4, ios 0x324f44;
737-
void dumpInfo() const;
738-
void gatherGPUInfo();
739-
bool getBool(char const*, bool) const;
740-
char const* getCString(char const*, char const*) const;
741-
int getMaxModelviewStackDepth() const;
742-
int getMaxTextureSize() const;
743-
int getMaxTextureUnits() const;
744-
double getNumber(char const*, double) const;
745-
cocos2d::CCObject* getObject(char const*) const;
746-
bool init();
747-
void loadConfigFile(char const*);
748-
void setObject(char const*, cocos2d::CCObject*);
749-
bool supportsBGRA8888() const;
750-
bool supportsDiscardFramebuffer() const;
751-
bool supportsNPOT() const;
752-
bool supportsPVRTC() const;
753-
bool supportsShareableVAO() const;
737+
void dumpInfo() const = m1 0x46fa88, imac 0x519410, ios 0x32496c;
738+
void gatherGPUInfo() = m1 0x46fb28, imac 0x519490, ios 0x3249f4;
739+
bool getBool(char const*, bool) const = m1 0x470600, imac 0x519f10, ios 0x3250d4;
740+
char const* getCString(char const*, char const*) const = m1 0x4704e4, imac 0x519df0, ios 0x325038;
741+
int getMaxModelviewStackDepth() const = m1 0x4704ac, imac 0x519d80, ios inline;
742+
int getMaxTextureSize() const = m1 0x4704a4, imac 0x519d70, ios 0x325018;
743+
int getMaxTextureUnits() const = m1 0x4704b4, imac 0x519d90, ios inline;
744+
double getNumber(char const*, double) const = m1 0x470740, imac 0x51a050, ios 0x325198;
745+
cocos2d::CCObject* getObject(char const*) const = m1 0x4708b8, imac 0x51a1b0, ios inline;
746+
bool init() = m1 0x46f72c, imac 0x5190b0, ios 0x324760;
747+
void loadConfigFile(char const*) = m1 0x470abc, imac 0x51a380, ios inline;
748+
void setObject(char const*, cocos2d::CCObject*) = m1 0x4709bc, imac 0x51a290, ios inline;
749+
bool supportsBGRA8888() const = m1 0x4704cc, imac 0x519dc0, ios 0x325030;
750+
bool supportsDiscardFramebuffer() const = m1 0x4704d4, imac 0x519dd0, ios inline;
751+
bool supportsNPOT() const = m1 0x4704bc, imac 0x519da0, ios 0x325020;
752+
bool supportsPVRTC() const = m1 0x4704c4, imac 0x519db0, ios 0x325028;
753+
bool supportsShareableVAO() const = m1 0x4704dc, imac 0x519de0, ios inline;
754754
}
755755

756756
[[link(win, android)]]
@@ -929,7 +929,7 @@ class cocos2d::CCDirector : cocos2d::CCObject, cocos2d::TypeInfo {
929929
// void setActualDeltaTime(float);
930930
void setAlphaBlending(bool);
931931
void setContentScaleFactor(float);
932-
void setDefaultValues() = imac 0x482850, m1 0x3e8814;
932+
void setDefaultValues() = ios 0x1751a4, imac 0x482850, m1 0x3e8814;
933933
void setDelegate(cocos2d::CCDirectorDelegate*);
934934
void setDeltaTime(float);
935935
void setDepthTest(bool) = imac 0x482ba0, m1 0x3e8ad4, ios 0x175454;
@@ -3368,7 +3368,7 @@ class cocos2d::CCPoolManager {
33683368

33693369
[[link(win, android)]]
33703370
class cocos2d::CCPrettyPrinter : cocos2d::CCDataVisitor {
3371-
CCPrettyPrinter(int) = win inline, imac 0x4b5120, m1 0x416360, ios 0x24e5cc;
3371+
CCPrettyPrinter(int) = win inline, imac 0x4b5230, m1 0x41649c, ios 0x24e5cc;
33723372

33733373
virtual void clear() = imac 0x4b52d0, m1 0x416550, ios 0x24e6c0;
33743374
virtual gd::string getResult() = imac 0x4b5300, m1 0x416574, ios 0x24e6e4;

bindings/2.2081/Kazmath.bro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ kmVec3* const kmMat3RotationToAxisAngle(kmVec3*, float*, kmMat3 const*);
5353
[[link(win, android)]]
5454
kmMat4* const kmMat4Fill(kmMat4*, float const*);
5555
[[link(win, android)]]
56-
kmMat4* const kmMat4Identity(kmMat4*);
56+
kmMat4* const kmMat4Identity(kmMat4*) = m1 0x352508, imac 0x3d26a0, ios 0x3b2a40;
5757
[[link(win, android)]]
5858
kmMat4* const kmMat4Inverse(kmMat4*, kmMat4 const*);
5959
[[link(win, android)]]

bindings/2.2081/inline/CCCamera.cpp

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

1010
#if defined(GEODE_IS_IOS)
11+
cocos2d::CCCamera::~CCCamera() {}
12+
13+
const char* cocos2d::CCCamera::description() {
14+
return CCString::createWithFormat("<CCCamera | center = (%.2f,%.2f,%.2f)>", m_fCenterX, m_fCenterY, m_fCenterZ)->getCString();
15+
}
16+
17+
float cocos2d::CCCamera::getZEye() {
18+
return FLT_EPSILON;
19+
}
20+
21+
void cocos2d::CCCamera::init() {
22+
this->restore();
23+
}
24+
25+
void cocos2d::CCCamera::setEyeXYZ(float eyeX, float eyeY, float eyeZ) {
26+
m_fEyeX = eyeX;
27+
m_fEyeY = eyeY;
28+
m_fEyeZ = eyeZ;
29+
m_bDirty = true;
30+
}
31+
32+
void cocos2d::CCCamera::setCenterXYZ(float centerX, float centerY, float centerZ) {
33+
m_fCenterX = centerX;
34+
m_fCenterY = centerY;
35+
m_fCenterZ = centerZ;
36+
m_bDirty = true;
37+
}
38+
39+
void cocos2d::CCCamera::setUpXYZ(float upX, float upY, float upZ) {
40+
m_fUpX = upX;
41+
m_fUpY = upY;
42+
m_fUpZ = upZ;
43+
m_bDirty = true;
44+
}
45+
46+
void cocos2d::CCCamera::getEyeXYZ(float* eyeX, float* eyeY, float* eyeZ) {
47+
*eyeX = m_fEyeX;
48+
*eyeY = m_fEyeY;
49+
*eyeZ = m_fEyeZ;
50+
}
51+
52+
void cocos2d::CCCamera::getCenterXYZ(float* centerX, float* centerY, float* centerZ) {
53+
*centerX = m_fCenterX;
54+
*centerY = m_fCenterY;
55+
*centerZ = m_fCenterZ;
56+
}
57+
58+
void cocos2d::CCCamera::getUpXYZ(float* upX, float* upY, float* upZ) {
59+
*upX = m_fUpX;
60+
*upY = m_fUpY;
61+
*upZ = m_fUpZ;
62+
}
1163
#endif
1264

bindings/2.2081/inline/CCConfiguration.cpp

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

1010
#if defined(GEODE_IS_IOS)
11+
cocos2d::CCConfiguration::CCConfiguration() {
12+
m_nMaxTextureSize = 0;
13+
m_nMaxModelviewStackDepth = 0;
14+
m_bSupportsPVRTC = false;
15+
m_bSupportsNPOT = false;
16+
m_bSupportsBGRA8888 = false;
17+
m_bSupportsDiscardFramebuffer = false;
18+
m_bSupportsShareableVAO = false;
19+
m_nMaxSamplesAllowed = 0;
20+
m_nMaxTextureUnits = 0;
21+
m_pGlExtensions = nullptr;
22+
m_pValueDict = nullptr;
23+
}
24+
25+
int cocos2d::CCConfiguration::getMaxModelviewStackDepth() const {
26+
return m_nMaxModelviewStackDepth;
27+
}
28+
29+
int cocos2d::CCConfiguration::getMaxTextureUnits() const {
30+
return m_nMaxTextureUnits;
31+
}
32+
33+
cocos2d::CCObject* cocos2d::CCConfiguration::getObject(const char* key) const {
34+
return m_pValueDict->objectForKey(key);
35+
}
36+
37+
void cocos2d::CCConfiguration::loadConfigFile(const char* filename) {
38+
auto dict = CCDictionary::createWithContentsOfFile(filename);
39+
40+
auto metadataOk = false;
41+
if (auto metadata = geode::cast::typeinfo_cast<CCDictionary*>(dict->objectForKey("metadata"))) {
42+
if (auto format = geode::cast::typeinfo_cast<CCString*>(metadata->objectForKey("format"))) {
43+
if (format->intValue() == 1) metadataOk = true;
44+
}
45+
}
46+
47+
if (!metadataOk) return;
48+
49+
auto data = geode::cast::typeinfo_cast<CCDictionary*>(dict->objectForKey("data"));
50+
if (!data) return;
51+
52+
CCDictElement* element;
53+
CCDictElement* temp;
54+
HASH_ITER(hh, data->m_pElements, element, temp) {
55+
if (!m_pValueDict->objectForKey(element->getStrKey())) {
56+
m_pValueDict->setObject(element->getObject(), element->getStrKey() );
57+
}
58+
}
59+
60+
CCDirector::sharedDirector()->setDefaultValues();
61+
}
62+
63+
void cocos2d::CCConfiguration::setObject(const char* key, cocos2d::CCObject* value) {
64+
m_pValueDict->setObject(value, key);
65+
}
66+
67+
bool cocos2d::CCConfiguration::supportsDiscardFramebuffer() const {
68+
return m_bSupportsDiscardFramebuffer;
69+
}
70+
71+
bool cocos2d::CCConfiguration::supportsShareableVAO() const {
72+
return m_bSupportsShareableVAO;
73+
}
1174
#endif
1275

0 commit comments

Comments
 (0)