Skip to content

Commit 99b8ba4

Browse files
committed
Platform-based bindings
1 parent c746c6d commit 99b8ba4

File tree

4 files changed

+55
-37
lines changed

4 files changed

+55
-37
lines changed

bindings/2.2081/Cocos2d.bro

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -348,21 +348,21 @@ class cocos2d::CCAnimationFrame : cocos2d::CCObject {
348348

349349
[[link(win, android)]]
350350
class cocos2d::CCApplication : cocos2d::CCApplicationProtocol {
351-
CCApplication();
351+
CCApplication() = m1 0x2b65e8, imac 0x3293f0, ios 0x1abe78;
352352
virtual ~CCApplication() = imac 0x329420, m1 0x2b6610, ios 0x1abea4;
353353

354354
static cocos2d::CCApplication* sharedApplication() = imac 0x329520, m1 0x2b66ec, ios 0x1abff0;
355355

356-
virtual int run();
356+
virtual int run() = m1 0x2b6684, imac 0x329490, ios 0x1abf04;
357357
virtual void setAnimationInterval(double) = imac 0x3294d0, m1 0x2b66b8, ios 0x1abfc4;
358358
virtual cocos2d::ccLanguageType getCurrentLanguage() = imac 0x329530, m1 0x2b66f8, ios 0x1ac00c;
359359
virtual cocos2d::TargetPlatform getTargetPlatform() = imac 0x329510, m1 0x2b66e4, ios 0x1ac1d0;
360360
virtual void openURL(char const*) = imac 0x32a230, m1 0x2b6fb4, ios 0x1abf38;
361361

362362
[[missing(android, ios)]]
363-
gd::string const& getResourceRootPath();
363+
gd::string const& getResourceRootPath() = m1 0x2b6ccc, imac 0x329b20;
364364
[[missing(android, ios)]]
365-
gd::string const& getStartupScriptFilename();
365+
gd::string const& getStartupScriptFilename() = m1 0x2b6fac, imac 0x32a220;
366366
[[missing(android, mac, ios)]]
367367
int getTimeElapsed();
368368
[[missing(android, mac, ios)]]
@@ -376,9 +376,9 @@ class cocos2d::CCApplication : cocos2d::CCApplicationProtocol {
376376
[[missing(android, mac, ios)]]
377377
void resetForceTimer();
378378
[[missing(android, ios)]]
379-
void setResourceRootPath(gd::string const&);
379+
void setResourceRootPath(gd::string const&) = m1 0x2b691c, imac 0x329760;
380380
[[missing(android, ios)]]
381-
void setStartupScriptFilename(gd::string const&);
381+
void setStartupScriptFilename(gd::string const&) = m1 0x2b6cd4, imac 0x329b30;
382382
[[missing(android, mac, ios)]]
383383
void setupVerticalSync();
384384
[[missing(android, mac, ios)]]
@@ -794,7 +794,7 @@ class cocos2d::CCDelayTime : cocos2d::CCActionInterval {
794794

795795
[[link(win, android)]]
796796
class cocos2d::CCDevice {
797-
static int getDPI();
797+
static int getDPI() = m1 0x54a8c0, imac 0x6274c0;
798798
}
799799

800800
[[link(win, android)]]
@@ -1343,13 +1343,12 @@ class cocos2d::CCEGLViewProtocol {
13431343
virtual void handleTouchesEnd(int, int*, float*, float*, double) = imac 0x510590, m1 0x46734c, ios 0x2e7290;
13441344
virtual void handleTouchesCancel(int, int*, float*, float*, double) = imac 0x510620, m1 0x4673f8, ios 0x2e733c;
13451345

1346-
double getPlatformTimestamp();
1347-
float getScaleX() const;
1348-
float getScaleY() const;
1349-
void getSetOfTouchesEndOrCancel(cocos2d::CCSet&, int, int*, float*, float*);
1350-
char const* getViewName();
1351-
cocos2d::CCRect const& getViewPortRect() const = imac 0x5106b0, m1 0x4674a4, ios inline;
1352-
void updateDesignResolutionSize();
1346+
float getScaleX() const = m1 0x4674ac, imac 0x5106c0, ios 0x2e73f0;
1347+
float getScaleY() const = m1 0x4674b4, imac 0x5106d0, ios 0x2e73f8;
1348+
void getSetOfTouchesEndOrCancel(cocos2d::CCSet&, int, int*, float*, float*, double) = m1 0x4671b8, imac 0x510400, ios 0x2e7138;
1349+
char const* getViewName() = m1 0x466d34, imac 0x50ff70, ios inline;
1350+
cocos2d::CCRect const& getViewPortRect() const = imac 0x5106b0, m1 0x4674a4, ios 0x2e73e8;
1351+
void updateDesignResolutionSize() = m1 0x4674c0, imac 0x5106f0;
13531352
}
13541353

13551354
[[link(win, android)]]
@@ -1423,11 +1422,11 @@ class cocos2d::CCFadeTo : cocos2d::CCActionInterval {
14231422

14241423
[[link(win, android)]]
14251424
class cocos2d::CCFileUtils : cocos2d::TypeInfo {
1426-
protected CCFileUtils();
1425+
protected CCFileUtils() = m1 0x3ac624, imac 0x43ab10, ios 0x1509a4;
14271426
// CCFileUtils(cocos2d::CCFileUtils const&);
1428-
virtual ~CCFileUtils();
1427+
virtual ~CCFileUtils() = m1 0x3ac660, imac 0x43ab60, ios 0x1509e0;
14291428

1430-
static void purgeFileUtils();
1429+
static void purgeFileUtils() = m1 0x3ac5f0, imac 0x43aae0, ios 0x150970;
14311430
static cocos2d::CCFileUtils* sharedFileUtils() = imac 0x60b8d0, m1 0x531b28, ios 0x23620c;
14321431

14331432
virtual void addSearchPath(char const*) = imac 0x43d220, m1 0x3aec64, ios 0x151fc0;
@@ -1459,7 +1458,7 @@ class cocos2d::CCFileUtils : cocos2d::TypeInfo {
14591458
virtual bool shouldUseHD() = imac 0x43b170, m1 0x3accc4, ios 0x150e38;
14601459
virtual bool writeToFile(cocos2d::CCDictionary*, gd::string const&) = imac 0x43aac0, m1 0x3ac5e0, ios 0x150960;
14611460

1462-
void removeAllPaths();
1461+
void removeAllPaths() = m1 0x3af324, imac 0x43d8d0, ios inline;
14631462
}
14641463

14651464
[[link(win, android)]]
@@ -1659,15 +1658,17 @@ class cocos2d::CCImage : cocos2d::CCObject {
16591658

16601659
bool _initWithJpgData(void*, int);
16611660
bool _initWithPngData(void*, int);
1662-
bool _initWithRawData(void*, int, int, int, int, bool);
1661+
bool _initWithRawData(void*, int, int, int, int, bool) = m1 0x3ef8cc, imac 0x48a0a0, ios inline;
16631662
bool _initWithTiffData(void*, int);
16641663
// bool _initWithWebpData(void*, int);
16651664
bool _saveImageToJPG(char const*);
16661665
bool _saveImageToPNG(char const*, bool);
16671666
bool initWithImageData(void*, int, cocos2d::CCImage::EImageFormat, int, int, int, int) = imac 0x489a30, m1 0x3ef41c, ios 0x2b19c;
16681667
bool initWithImageFile(char const*, cocos2d::CCImage::EImageFormat) = imac 0x489820, m1 0x3ef070, ios 0x2b088;
1669-
bool initWithImageFileThreadSafe(char const*, cocos2d::CCImage::EImageFormat) = imac 0x48a000, m1 0x3ef814;
1670-
bool initWithString(char const*, int, int, cocos2d::CCImage::ETextAlign, char const*, int);
1668+
bool initWithImageFileThreadSafe(char const*, cocos2d::CCImage::EImageFormat) = imac 0x48a000, m1 0x3ef814, ios 0x2b3ac;
1669+
bool initWithString(char const*, int, int, cocos2d::CCImage::ETextAlign, char const*, int) = m1 0x3ef948, imac 0x48a120, ios inline;
1670+
[[missing(win, mac)]]
1671+
bool initWithStringShadowStroke(char const*, int, int, cocos2d::CCImage::ETextAlign, char const*, int, float, float, float, bool, float, float, float, float, bool, float, float, float, float) = ios 0x2b458;
16711672
// bool hasAlpha();
16721673
// bool isPremultipliedAlpha();
16731674
bool saveToFile(char const*, bool);
@@ -3645,17 +3646,17 @@ class cocos2d::CCRotateTo : cocos2d::CCActionInterval {
36453646

36463647
[[link(win, android)]]
36473648
class cocos2d::CCSAXParser {
3648-
CCSAXParser();
3649-
~CCSAXParser();
3649+
CCSAXParser() = m1 0x13c610, imac 0x176090;
3650+
~CCSAXParser() = m1 0x13c61c, imac 0x1760b0;
36503651

3651-
static void endElement(void*, cocos2d::CC_XML_CHAR const*);
3652-
static void startElement(void*, cocos2d::CC_XML_CHAR const*, const CC_XML_CHAR **);
3653-
static void textHandler(void*, cocos2d::CC_XML_CHAR const*, int);
3652+
static void endElement(void*, cocos2d::CC_XML_CHAR const*) = m1 0x13c574, imac 0x175ff0;
3653+
static void startElement(void*, cocos2d::CC_XML_CHAR const*, cocos2d::CC_XML_CHAR const**) = m1 0x13c518, imac 0x175fa0;
3654+
static void textHandler(void*, cocos2d::CC_XML_CHAR const*, int) = m1 0x13c5ec, imac 0x176060;
36543655

3655-
bool init(char const*);
3656-
bool parse(char const*);
3657-
bool parse(char const*, unsigned int);
3658-
void setDelegator(cocos2d::CCSAXDelegator*);
3656+
bool init(char const*) = m1 0x13c620, imac 0x1760c0;
3657+
bool parse(char const*) = m1 0x13c6cc, imac 0x176170;
3658+
bool parse(char const*, unsigned int) = m1 0x13c628, imac 0x1760d0;
3659+
void setDelegator(cocos2d::CCSAXDelegator*) = m1 0x13c7cc, imac 0x176260;
36593660
}
36603661

36613662
[[link(win, android)]]
@@ -4460,10 +4461,9 @@ class cocos2d::CCTexturePVR : cocos2d::CCObject {
44604461

44614462
[[link(win, android)]]
44624463
class cocos2d::CCThread {
4464+
~CCThread() = m1 0x358a5c, imac 0x3d97c0, ios 0x34f700;
44634465

4464-
~CCThread();
4465-
4466-
void createAutoreleasePool();
4466+
void createAutoreleasePool() = m1 0x358a88, imac 0x3d97e0, ios 0x34f72c;
44674467
}
44684468

44694469
[[link(win, android)]]
@@ -4516,8 +4516,8 @@ class cocos2d::CCTileMapAtlas : cocos2d::CCAtlasNode {
45164516

45174517
[[link(win, android)]]
45184518
class cocos2d::CCTime {
4519-
static int gettimeofdayCocos2d(cocos2d::cc_timeval*, void*);
4520-
static double timersubCocos2d(cocos2d::cc_timeval*, cocos2d::cc_timeval*);
4519+
static int gettimeofdayCocos2d(cocos2d::cc_timeval*, void*) = m1 0x2af3d4, imac 0x3217c0, ios 0x1d43ac;
4520+
static double timersubCocos2d(cocos2d::cc_timeval*, cocos2d::cc_timeval*) = m1 0x2af3f4, imac 0x3217e0, ios 0x1d43cc;
45214521
}
45224522

45234523
[[link(win, android)]]

bindings/2.2081/inline/CCEGLViewProtocol.cpp

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

1010
#if defined(GEODE_IS_IOS)
11-
cocos2d::CCRect const& cocos2d::CCEGLViewProtocol::getViewPortRect() const {
12-
return m_obViewPortRect;
11+
const char* cocos2d::CCEGLViewProtocol::getViewName() {
12+
return m_szViewName;
1313
}
1414
#endif
1515

bindings/2.2081/inline/CCFileUtils.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::CCFileUtils::removeAllPaths() {
12+
m_searchPathArray.clear();
13+
}
1114
#endif
1215

bindings/2.2081/inline/CCImage.cpp

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

1010
#if defined(GEODE_IS_IOS)
11+
bool cocos2d::CCImage::_initWithRawData(void* data, int dataLen, int width, int height, int bitsPerComponent, bool preMulti) {
12+
if (width == 0 || height == 0) return false;
13+
m_nBitsPerComponent = bitsPerComponent;
14+
m_nWidth = width;
15+
m_nHeight = height;
16+
m_bHasAlpha = true;
17+
auto size = width * height * 4;
18+
m_pData = new unsigned char[size];
19+
memcpy(m_pData, data, size);
20+
return true;
21+
}
22+
23+
bool cocos2d::CCImage::initWithString(const char* text, int width, int height, cocos2d::CCImage::ETextAlign align, const char* font, int size) {
24+
return this->initWithStringShadowStroke(text, width, height, align, font, size);
25+
}
1126
#endif
1227

0 commit comments

Comments
 (0)