mirror of https://github.com/axmolengine/axmol.git
Fixed #10082 : Label and Text have different types for fontSize
This commit is contained in:
parent
96007b2793
commit
c6fc51a2d9
|
@ -39,7 +39,7 @@ _touchScaleChangeEnabled(false),
|
|||
_normalScaleValueX(1.0f),
|
||||
_normalScaleValueY(1.0f),
|
||||
_fontName("Thonburi"),
|
||||
_fontSize(10),
|
||||
_fontSize(10.f),
|
||||
_onSelectedScaleOffset(0.5),
|
||||
_labelRenderer(nullptr),
|
||||
_labelRendererAdaptDirty(true),
|
||||
|
@ -73,7 +73,7 @@ bool Text::init()
|
|||
return false;
|
||||
}
|
||||
|
||||
Text* Text::create(const std::string &textContent, const std::string &fontName, int fontSize)
|
||||
Text* Text::create(const std::string &textContent, const std::string &fontName, float fontSize)
|
||||
{
|
||||
Text *text = new (std::nothrow) Text;
|
||||
if (text && text->init(textContent, fontName, fontSize))
|
||||
|
@ -85,7 +85,7 @@ Text* Text::create(const std::string &textContent, const std::string &fontName,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
bool Text::init(const std::string &textContent, const std::string &fontName, int fontSize)
|
||||
bool Text::init(const std::string &textContent, const std::string &fontName, float fontSize)
|
||||
{
|
||||
bool ret = true;
|
||||
do
|
||||
|
@ -130,7 +130,7 @@ ssize_t Text::getStringLength()const
|
|||
return _labelRenderer->getStringLength();
|
||||
}
|
||||
|
||||
void Text::setFontSize(int size)
|
||||
void Text::setFontSize(float size)
|
||||
{
|
||||
if (_type == Type::SYSTEM)
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ void Text::setFontSize(int size)
|
|||
_labelRendererAdaptDirty = true;
|
||||
}
|
||||
|
||||
int Text::getFontSize()const
|
||||
float Text::getFontSize()const
|
||||
{
|
||||
return _fontSize;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
*/
|
||||
static Text* create(const std::string& textContent,
|
||||
const std::string& fontName,
|
||||
int fontSize);
|
||||
float fontSize);
|
||||
|
||||
/**
|
||||
* Changes the string value of label.
|
||||
|
@ -134,14 +134,14 @@ public:
|
|||
*
|
||||
* @param size The font size.
|
||||
*/
|
||||
void setFontSize(int size);
|
||||
void setFontSize(float size);
|
||||
|
||||
/**
|
||||
* Gets the font size of label.
|
||||
*
|
||||
* @return The font size.
|
||||
*/
|
||||
int getFontSize()const;
|
||||
float getFontSize()const;
|
||||
|
||||
/**
|
||||
* Sets the font name of label.
|
||||
|
@ -298,7 +298,7 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
virtual bool init() override;
|
||||
virtual bool init(const std::string& textContent,
|
||||
const std::string& fontName,
|
||||
int fontSize);
|
||||
float fontSize);
|
||||
|
||||
protected:
|
||||
virtual void initRenderer() override;
|
||||
|
@ -316,7 +316,7 @@ protected:
|
|||
float _normalScaleValueX;
|
||||
float _normalScaleValueY;
|
||||
std::string _fontName;
|
||||
int _fontSize;
|
||||
float _fontSize;
|
||||
float _onSelectedScaleOffset;
|
||||
Label* _labelRenderer;
|
||||
bool _labelRendererAdaptDirty;
|
||||
|
|
Loading…
Reference in New Issue