mirror of https://github.com/axmolengine/axmol.git
fixed #1749: Fixed compilation errors for win32.
This commit is contained in:
parent
56797db85c
commit
0ece3056ee
|
@ -66,14 +66,16 @@ bool CCEditBoxImplWin::initWithSize(const CCSize& size)
|
|||
{
|
||||
//! int fontSize = getFontSizeAccordingHeightJni(size.height-12);
|
||||
m_pLabel = CCLabelTTF::create("", "", size.height-12);
|
||||
m_pLabel->setAnchorPoint(ccp(0, 0));
|
||||
m_pLabel->setPosition(ccp(5, 2));
|
||||
// align the text vertically center
|
||||
m_pLabel->setAnchorPoint(ccp(0, 0.5f));
|
||||
m_pLabel->setPosition(ccp(5, size.height / 2.0f));
|
||||
m_pLabel->setColor(m_colText);
|
||||
m_pEditBox->addChild(m_pLabel);
|
||||
|
||||
m_pLabelPlaceHolder = CCLabelTTF::create("", "", size.height-12);
|
||||
m_pLabelPlaceHolder->setAnchorPoint(ccp(0, 0));
|
||||
m_pLabelPlaceHolder->setPosition(ccp(5, 2));
|
||||
// align the text vertically center
|
||||
m_pLabelPlaceHolder->setAnchorPoint(ccp(0, 0.5f));
|
||||
m_pLabelPlaceHolder->setPosition(ccp(5, size.height / 2.0f));
|
||||
m_pLabelPlaceHolder->setVisible(false);
|
||||
m_pLabelPlaceHolder->setColor(m_colPlaceHolder);
|
||||
m_pEditBox->addChild(m_pLabelPlaceHolder);
|
||||
|
@ -82,12 +84,33 @@ bool CCEditBoxImplWin::initWithSize(const CCSize& size)
|
|||
return true;
|
||||
}
|
||||
|
||||
void CCEditBoxImplWin::setFont(const char* pFontName, int fontSize)
|
||||
{
|
||||
if(m_pLabel != NULL) {
|
||||
m_pLabel->setFontName(pFontName);
|
||||
m_pLabel->setFontSize(fontSize);
|
||||
}
|
||||
|
||||
if(m_pLabelPlaceHolder != NULL) {
|
||||
m_pLabelPlaceHolder->setFontName(pFontName);
|
||||
m_pLabelPlaceHolder->setFontSize(fontSize);
|
||||
}
|
||||
}
|
||||
|
||||
void CCEditBoxImplWin::setFontColor(const ccColor3B& color)
|
||||
{
|
||||
m_colText = color;
|
||||
m_pLabel->setColor(color);
|
||||
}
|
||||
|
||||
void CCEditBoxImplWin::setPlaceholderFont(const char* pFontName, int fontSize)
|
||||
{
|
||||
if(m_pLabelPlaceHolder != NULL) {
|
||||
m_pLabelPlaceHolder->setFontName(pFontName);
|
||||
m_pLabelPlaceHolder->setFontSize(fontSize);
|
||||
}
|
||||
}
|
||||
|
||||
void CCEditBoxImplWin::setPlaceholderFontColor(const ccColor3B& color)
|
||||
{
|
||||
m_colPlaceHolder = color;
|
||||
|
@ -191,6 +214,11 @@ void CCEditBoxImplWin::setContentSize(const CCSize& size)
|
|||
{
|
||||
}
|
||||
|
||||
void CCEditBoxImplWin::setAnchorPoint(const CCPoint& anchorPoint)
|
||||
{ // don't need to be implemented on win32 platform.
|
||||
|
||||
}
|
||||
|
||||
void CCEditBoxImplWin::visit(void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -44,7 +44,9 @@ public:
|
|||
virtual ~CCEditBoxImplWin();
|
||||
|
||||
virtual bool initWithSize(const CCSize& size);
|
||||
virtual void setFont(const char* pFontName, int fontSize);
|
||||
virtual void setFontColor(const ccColor3B& color);
|
||||
virtual void setPlaceholderFont(const char* pFontName, int fontSize);
|
||||
virtual void setPlaceholderFontColor(const ccColor3B& color);
|
||||
virtual void setInputMode(EditBoxInputMode inputMode);
|
||||
virtual void setInputFlag(EditBoxInputFlag inputFlag);
|
||||
|
@ -58,6 +60,7 @@ public:
|
|||
virtual void setPlaceHolder(const char* pText);
|
||||
virtual void setPosition(const CCPoint& pos);
|
||||
virtual void setContentSize(const CCSize& size);
|
||||
virtual void setAnchorPoint(const CCPoint& anchorPoint);
|
||||
virtual void visit(void);
|
||||
virtual void doAnimationWhenKeyboardMove(float duration, float distance);
|
||||
virtual void openKeyboard();
|
||||
|
|
|
@ -55,9 +55,9 @@ EditBoxTest::EditBoxTest()
|
|||
m_pEditPassword = CCEditBox::create(editBoxSize, CCScale9Sprite::create("extensions/orange_edit.png"));
|
||||
m_pEditPassword->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2));
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
m_pEditPassword->setFont("A Damn Mess", 30);
|
||||
m_pEditPassword->setFont("American Typewriter", 30);
|
||||
#else
|
||||
m_pEditPassword->setFont("fonts/A Damn Mess.ttf", 30);
|
||||
m_pEditPassword->setFont("fonts/American Typewriter.ttf", 30);
|
||||
#endif
|
||||
m_pEditPassword->setFontColor(ccGREEN);
|
||||
m_pEditPassword->setPlaceHolder("Password:");
|
||||
|
|
Loading…
Reference in New Issue