66class WackyBypassFont : public CCLabelBMFont {
77protected:
88 void setFntFile (std::filesystem::path fnt) {
9- auto conf = FNTConfigLoadFile (fnt.string ().c_str ());
10- m_sFntFile = fnt.string ();
9+ auto fntString = string::pathToString (fnt);
10+ auto conf = FNTConfigLoadFile (fntString.c_str ());
11+ m_sFntFile = fntString;
1112 if (!conf) {
1213 log::error (" !conf ?????" );
1314 return ;
@@ -16,7 +17,7 @@ class WackyBypassFont : public CCLabelBMFont {
1617 if (m_pConfiguration)
1718 m_pConfiguration->release ();
1819 m_pConfiguration = conf;
19- conf->m_sAtlasName = fnt.replace_extension (" png" ). string ( );
20+ conf->m_sAtlasName = string::pathToString ( fnt.replace_extension (" png" ));
2021
2122 this ->setTexture (
2223 CCTextureCache::sharedTextureCache ()->addImage (conf->getAtlasName (), false )
@@ -52,7 +53,7 @@ std::filesystem::path PackInfoPopup::getPathInPack(const char* filename) const {
5253
5354 auto fname = std::filesystem::path (filename);
5455 fname.replace_filename (
55- fname.stem (). string ( ) + suffix + fname.extension (). string ( )
56+ string::pathToString ( fname.stem ()) + suffix + string::pathToString ( fname.extension ())
5657 );
5758
5859 if (std::filesystem::exists (m_pack->getResourcesPath () / fname)) {
@@ -62,8 +63,10 @@ std::filesystem::path PackInfoPopup::getPathInPack(const char* filename) const {
6263 }
6364}
6465
65- bool PackInfoPopup::init () {
66- if (!Popup::init (320 .f , 200 .f , this ->getPathInPack (" GJ_square01.png" ).string ().c_str ())) return false ;
66+ bool PackInfoPopup::init (const std::shared_ptr<Pack>& pack) {
67+ if (!Popup::init (320 .f , 200 .f , string::pathToString (this ->getPathInPack (" GJ_square01.png" )).c_str ())) return false ;
68+
69+ m_pack = pack;
6770
6871 auto title = WackyBypassFont::create (
6972 m_pack->getDisplayName ().c_str (),
@@ -96,8 +99,8 @@ bool PackInfoPopup::init() {
9699 auto defaultBtnSize =
97100 defaultBtnLabel->getScaledContentSize () + CCSize { 20 .f , 15 .f };
98101
99- auto defaultBtnSpr = CCScale9Sprite ::create (
100- this ->getPathInPack (" GJ_button_01.png" ). string (). c_str ( ),
102+ auto defaultBtnSpr = NineSlice ::create (
103+ string::pathToString ( this ->getPathInPack (" GJ_button_01.png" )),
101104 { 0 , 0 , 40 , 40 }
102105 );
103106 defaultBtnSpr->setContentSize (defaultBtnSize);
@@ -123,8 +126,8 @@ bool PackInfoPopup::init() {
123126 auto altBtnSize =
124127 altBtnLabel->getScaledContentSize () + CCSize { 20 .f , 15 .f };
125128
126- auto altBtnSpr = CCScale9Sprite ::create (
127- this ->getPathInPack (" GJ_button_02.png" ). string (). c_str ( ),
129+ auto altBtnSpr = NineSlice ::create (
130+ string::pathToString ( this ->getPathInPack (" GJ_button_02.png" )),
128131 { 0 , 0 , 40 , 40 }
129132 );
130133 altBtnSpr->setContentSize (altBtnSize);
@@ -144,8 +147,7 @@ bool PackInfoPopup::init() {
144147
145148PackInfoPopup* PackInfoPopup::create (const std::shared_ptr<Pack>& pack) {
146149 auto ret = new PackInfoPopup;
147- ret->m_pack = pack;
148- if (ret->init ()) {
150+ if (ret->init (pack)) {
149151 ret->autorelease ();
150152 return ret;
151153 }
0 commit comments