@@ -57,7 +57,7 @@ namespace cocos2d{
57
57
{
58
58
m_tDimensions = CCSizeMake ( dimensions.width * CC_CONTENT_SCALE_FACTOR (), dimensions.height * CC_CONTENT_SCALE_FACTOR () );
59
59
m_eAlignment = alignment;
60
- m_sFontName = fontName;
60
+ m_pFontName. reset ( new std::string ( fontName)) ;
61
61
m_fFontSize = fontSize * CC_CONTENT_SCALE_FACTOR ();
62
62
this ->setString (label);
63
63
return true ;
@@ -70,7 +70,7 @@ namespace cocos2d{
70
70
if (CCSprite::init ())
71
71
{
72
72
m_tDimensions = CCSizeZero;
73
- m_sFontName = fontName;
73
+ m_pFontName. reset ( new std::string ( fontName)) ;
74
74
m_fFontSize = fontSize * CC_CONTENT_SCALE_FACTOR ();
75
75
this ->setString (label);
76
76
return true ;
@@ -79,18 +79,18 @@ namespace cocos2d{
79
79
}
80
80
void CCLabelTTF::setString (const char *label)
81
81
{
82
- m_sString = string (label);
82
+ m_pString. reset ( new std:: string (label) );
83
83
84
84
CCTexture2D *texture;
85
85
if ( CCSize::CCSizeEqualToSize ( m_tDimensions, CCSizeZero ) )
86
86
{
87
87
texture = new CCTexture2D ();
88
- texture->initWithString (label, m_sFontName. c_str (), m_fFontSize);
88
+ texture->initWithString (label, m_pFontName-> c_str (), m_fFontSize);
89
89
}
90
90
else
91
91
{
92
92
texture = new CCTexture2D ();
93
- texture->initWithString (label, m_tDimensions, m_eAlignment, m_sFontName. c_str (), m_fFontSize);
93
+ texture->initWithString (label, m_tDimensions, m_eAlignment, m_pFontName-> c_str (), m_fFontSize);
94
94
}
95
95
this ->setTexture (texture);
96
96
texture->release ();
@@ -102,13 +102,13 @@ namespace cocos2d{
102
102
103
103
const char * CCLabelTTF::getString (void )
104
104
{
105
- return m_sString. c_str ();
105
+ return m_pString-> c_str ();
106
106
}
107
107
108
108
char * CCLabelTTF::description ()
109
109
{
110
110
char *ret = new char [100 ] ;
111
- sprintf (ret, " <CCLabelTTF | FontName = %s, FontSize = %.1f>" , m_sFontName. c_str (), m_fFontSize);
111
+ sprintf (ret, " <CCLabelTTF | FontName = %s, FontSize = %.1f>" , m_pFontName-> c_str (), m_fFontSize);
112
112
return ret;
113
113
}
114
114
}// namespace cocos2d
0 commit comments