Skip to content

Commit e9fb9bb

Browse files
committed
CCTexture2D::initWithString and update packages
1 parent 38ff9bb commit e9fb9bb

4 files changed

Lines changed: 25 additions & 37 deletions

File tree

bindings/2.2081/Cocos2d.bro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,7 +1934,7 @@ class cocos2d::CCLabelTTF : cocos2d::CCSprite, cocos2d::CCLabelProtocol {
19341934
virtual void setString(char const*) = imac 0x3bdb30, m1 0x33f980, ios 0x6e990;
19351935
virtual char const* getString() = imac 0x3bdd60, m1 0x33fb7c, ios 0x6eae8;
19361936

1937-
cocos2d::ccFontDefinition _prepareTextDefinition(bool) = imac 0x3be2a0, m1 0x33fff0, ios inline;
1937+
cocos2d::ccFontDefinition _prepareTextDefinition(bool) = imac 0x3be2a0, m1 0x33fff0, ios 0x6eb20;
19381938
void _updateWithTextDefinition(cocos2d::ccFontDefinition&, bool) = imac 0x3bda60, m1 0x33f8c8, ios inline;
19391939
char const* description() = imac 0x3bddb0, m1 0x33fbb4, ios inline;
19401940
void disableShadow(bool) = imac 0x3be0f0, m1 0x33fe50, ios inline;
@@ -4348,9 +4348,9 @@ class cocos2d::CCTexture2D : cocos2d::CCObject {
43484348
bool initWithETCFile(char const*) = imac 0x4793c0, m1 0x3e01ac;
43494349
bool initWithImage(cocos2d::CCImage*) = imac 0x478620, m1 0x3df40c, ios 0x12d7fc;
43504350
bool initWithPVRFile(char const*) = imac 0x4792e0, m1 0x3e00d8;
4351-
bool initWithString(char const*, cocos2d::ccFontDefinition*);
4352-
bool initWithString(char const*, char const*, float) = imac 0x478f30, m1 0x3dfd08;
4353-
bool initWithString(char const*, char const*, float, cocos2d::CCSize const&, cocos2d::CCTextAlignment, cocos2d::CCVerticalTextAlignment) = imac 0x478f90, m1 0x3dfd78;
4351+
bool initWithString(char const*, cocos2d::ccFontDefinition*) = m1 0x3dfec4, imac 0x4790d0, ios 0x12db2c;
4352+
bool initWithString(char const*, char const*, float) = imac 0x478f30, m1 0x3dfd08, ios inline;
4353+
bool initWithString(char const*, char const*, float, cocos2d::CCSize const&, cocos2d::CCTextAlignment, cocos2d::CCVerticalTextAlignment) = imac 0x478f90, m1 0x3dfd78, ios inline;
43544354
void* keepData(void*, unsigned int);
43554355
void releaseData(void*);
43564356
void releaseGLTexture() = imac 0x478260, m1 0x3df084;

bindings/2.2081/inline/CCLabelTTF.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -48,36 +48,6 @@ cocos2d::CCLabelTTF* cocos2d::CCLabelTTF::createWithFontDefinition(char const* p
4848
return nullptr;
4949
}
5050

51-
cocos2d::ccFontDefinition cocos2d::CCLabelTTF::_prepareTextDefinition(bool p0) {
52-
auto factor = CCDirector::sharedDirector()->getContentScaleFactor();
53-
54-
ccFontDefinition texDef;
55-
texDef.m_fontSize = p0 ? m_fFontSize * factor : m_fFontSize;
56-
texDef.m_fontName = *m_pFontName;
57-
texDef.m_alignment = m_hAlignment;
58-
texDef.m_vertAlignment = m_vAlignment;
59-
texDef.m_dimensions = p0 ? CCSize { m_tDimensions.width * factor, m_tDimensions.height * factor } : m_tDimensions;
60-
61-
if (m_strokeEnabled) {
62-
texDef.m_stroke.m_strokeEnabled = true;
63-
texDef.m_stroke.m_strokeColor = m_strokeColor;
64-
texDef.m_stroke.m_strokeSize = p0 ? m_strokeSize * factor : m_strokeSize;
65-
}
66-
else texDef.m_stroke.m_strokeEnabled = false;
67-
68-
if (m_shadowEnabled) {
69-
texDef.m_shadow.m_shadowEnabled = true;
70-
texDef.m_shadow.m_shadowBlur = m_shadowBlur;
71-
texDef.m_shadow.m_shadowOpacity = m_shadowOpacity;
72-
texDef.m_shadow.m_shadowOffset = p0 ? CCSize { m_shadowOffset.width * factor, m_shadowOffset.height * factor } : m_shadowOffset;
73-
}
74-
else texDef.m_shadow.m_shadowEnabled = false;
75-
76-
texDef.m_fontFillColor = m_textFillColor;
77-
78-
return texDef;
79-
}
80-
8151
void cocos2d::CCLabelTTF::_updateWithTextDefinition(cocos2d::ccFontDefinition& p0, bool p1) {
8252
m_tDimensions = p0.m_dimensions;
8353
m_hAlignment = p0.m_alignment;

bindings/2.2081/inline/CCTexture2D.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,22 @@ unsigned int cocos2d::CCTexture2D::bitsPerPixelForFormat(cocos2d::CCTexture2DPix
3333
return -1;
3434
}
3535
}
36+
37+
bool cocos2d::CCTexture2D::initWithString(char const* text, char const* fontName, float fontSize) {
38+
return this->initWithString(text, fontName, fontSize, { 0.f, 0.f }, kCCTextAlignmentCenter, kCCVerticalTextAlignmentTop);
39+
}
40+
41+
bool cocos2d::CCTexture2D::initWithString(char const* text, char const* fontName, float fontSize, cocos2d::CCSize const& dimensions, cocos2d::CCTextAlignment hAlignment, cocos2d::CCVerticalTextAlignment vAlignment) {
42+
ccFontDefinition tempDef;
43+
tempDef.m_shadow.m_shadowEnabled = false;
44+
tempDef.m_stroke.m_strokeEnabled = false;
45+
tempDef.m_fontName = std::string(fontName);
46+
tempDef.m_fontSize = fontSize;
47+
tempDef.m_dimensions = dimensions;
48+
tempDef.m_alignment = hAlignment;
49+
tempDef.m_vertAlignment = vAlignment;
50+
tempDef.m_fontFillColor = { 255, 255, 255 };
51+
return this->initWithString(text, &tempDef);
52+
}
3653
#endif
3754

test/members/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ include(../../cmake/CPM.cmake)
1313

1414
set(MAT_JSON_AS_INTERFACE ON)
1515
CPMAddPackage("gh:fmtlib/fmt#12.1.0")
16-
CPMAddPackage("gh:geode-sdk/result@1.3.3")
16+
CPMAddPackage("gh:geode-sdk/result@1.4.0")
1717
CPMAddPackage("gh:geode-sdk/json@3.2.3")
18-
CPMAddPackage("gh:geode-sdk/TulipHook@2.4.4")
18+
CPMAddPackage("gh:geode-sdk/TulipHook@3.1.7")
1919
CPMAddPackage("gh:zhihaoy/nontype_functional#8ec2e09")
20-
CPMAddPackage("gh:dankmeme01/arc#dcbd12e")
20+
set (ARC_FEATURE_FULL OFF CACHE BOOL "" FORCE)
21+
CPMAddPackage("gh:dankmeme01/arc@1.3.0")
2122

2223
if (WIN32)
2324
target_compile_definitions(fmt PRIVATE _HAS_ITERATOR_DEBUGGING=0)

0 commit comments

Comments
 (0)