From 2f21cad93b6973c124e82a5661c50e0b437e91a4 Mon Sep 17 00:00:00 2001 From: Neo Kim Date: Wed, 20 Feb 2013 16:31:22 +0900 Subject: [PATCH 1/6] Merge from upstream to origin --- scripting/javascript/bindings/generated | 2 +- tools/cxx-generator | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripting/javascript/bindings/generated b/scripting/javascript/bindings/generated index 35c9124a80..4731abe943 160000 --- a/scripting/javascript/bindings/generated +++ b/scripting/javascript/bindings/generated @@ -1 +1 @@ -Subproject commit 35c9124a808c8e67b5a9bef68d4ff4433dad8bd4 +Subproject commit 4731abe94375ad4b9bde20cfd8bd48d0e1538fb1 diff --git a/tools/cxx-generator b/tools/cxx-generator index b92f99a3e5..39286b435d 160000 --- a/tools/cxx-generator +++ b/tools/cxx-generator @@ -1 +1 @@ -Subproject commit b92f99a3e53c5d4c19eb166e649664bd7fd80bab +Subproject commit 39286b435de49cfb745297bc514ed9f7d6d1f7f9 From cbebbd82071e4fbf6177035d67ca97cea8ddb132 Mon Sep 17 00:00:00 2001 From: Neo Kim Date: Wed, 20 Feb 2013 16:50:32 +0900 Subject: [PATCH 2/6] Ignore 'DerivedData' directory --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index de228548e9..fc18a390d7 100644 --- a/.gitignore +++ b/.gitignore @@ -62,6 +62,7 @@ xcschememanagement.plist build/ .DS_Store xcuserdata/ +DerivedData/ # Ignore files built by bada .Simulator-Debug/ From a7c87f3b3888d80bec74466a890e8a64e216b499 Mon Sep 17 00:00:00 2001 From: Neo Kim Date: Wed, 20 Feb 2013 22:41:08 +0900 Subject: [PATCH 3/6] Add 'setFont' and 'setAnchorPoint' to CCEditBox --- extensions/GUI/CCEditBox/CCEditBox.cpp | 27 ++++++++++++++---- extensions/GUI/CCEditBox/CCEditBox.h | 8 ++++++ extensions/GUI/CCEditBox/CCEditBoxImpl.h | 2 ++ .../GUI/CCEditBox/CCEditBoxImplAndroid.cpp | 28 ++++++++++++++++--- .../GUI/CCEditBox/CCEditBoxImplAndroid.h | 2 ++ extensions/GUI/CCEditBox/CCEditBoxImplIOS.h | 4 +++ extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm | 24 ++++++++++++++-- .../EditBoxTest/EditBoxTest.cpp | 12 ++++++++ .../TestCpp/proj.android/jni/Application.mk | 1 + 9 files changed, 97 insertions(+), 11 deletions(-) diff --git a/extensions/GUI/CCEditBox/CCEditBox.cpp b/extensions/GUI/CCEditBox/CCEditBox.cpp index df7354a48f..244ee6e79d 100644 --- a/extensions/GUI/CCEditBox/CCEditBox.cpp +++ b/extensions/GUI/CCEditBox/CCEditBox.cpp @@ -124,6 +124,17 @@ const char* CCEditBox::getText(void) return NULL; } +void CCEditBox::setFont(const char* pFontName, int fontSize) +{ + if (pFontName != NULL) + { + if (m_pEditBoxImpl != NULL) + { + m_pEditBoxImpl->setFont(pFontName, fontSize); + } + } +} + void CCEditBox::setFontColor(const ccColor3B& color) { m_colText = color; @@ -219,6 +230,15 @@ void CCEditBox::setContentSize(const CCSize& size) } } +void CCEditBox::setAnchorPoint(const CCPoint& anchorPoint) +{ + CCControlButton::setAnchorPoint(anchorPoint); + if (m_pEditBoxImpl != NULL) + { + m_pEditBoxImpl->setAnchorPoint(anchorPoint); + } +} + void CCEditBox::visit(void) { CCControlButton::visit(); @@ -240,11 +260,8 @@ void CCEditBox::onExit(void) static CCRect getRect(CCNode * pNode) { - CCRect rc; - rc.origin = pNode->getPosition(); - rc.size = pNode->getContentSize(); - rc.origin.x -= rc.size.width / 2; - rc.origin.y -= rc.size.height / 2; + CCRect rc = pNode->boundingBox(); + rc.origin.y -= 4; return rc; } diff --git a/extensions/GUI/CCEditBox/CCEditBox.h b/extensions/GUI/CCEditBox/CCEditBox.h index d41e87d623..bff53fb2d9 100644 --- a/extensions/GUI/CCEditBox/CCEditBox.h +++ b/extensions/GUI/CCEditBox/CCEditBox.h @@ -211,6 +211,13 @@ public: * @return The text entered in the edit box. */ const char* getText(void); + + /** + * Set the font. + * @param pFontName The font name. + * @param fontSize The font size. + */ + void setFont(const char* pFontName, int fontSize); /** * Set the font color of the widget's text. @@ -273,6 +280,7 @@ public: /* override functions */ virtual void setPosition(const CCPoint& pos); virtual void setContentSize(const CCSize& size); + virtual void setAnchorPoint(const CCPoint& anchorPoint); virtual void visit(void); virtual void onExit(void); virtual void keyboardWillShow(CCIMEKeyboardNotificationInfo& info); diff --git a/extensions/GUI/CCEditBox/CCEditBoxImpl.h b/extensions/GUI/CCEditBox/CCEditBoxImpl.h index 79ec47ba08..2cc639921c 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImpl.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImpl.h @@ -40,6 +40,7 @@ public: virtual ~CCEditBoxImpl() {} virtual bool initWithSize(const CCSize& size) = 0; + virtual void setFont(const char* pFontName, int fontSize) = 0; virtual void setFontColor(const ccColor3B& color) = 0; virtual void setPlaceholderFontColor(const ccColor3B& color) = 0; virtual void setInputMode(EditBoxInputMode inputMode) = 0; @@ -59,6 +60,7 @@ public: virtual void setPosition(const CCPoint& pos) = 0; virtual void setContentSize(const CCSize& size) = 0; + virtual void setAnchorPoint(const CCPoint& anchorPoint) = 0; virtual void visit(void) = 0; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp index ee1e65e226..15aab27a67 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp @@ -72,14 +72,16 @@ bool CCEditBoxImplAndroid::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); @@ -88,6 +90,19 @@ bool CCEditBoxImplAndroid::initWithSize(const CCSize& size) return true; } +void CCEditBoxImplAndroid::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 CCEditBoxImplAndroid::setFontColor(const ccColor3B& color) { m_colText = color; @@ -196,6 +211,11 @@ void CCEditBoxImplAndroid::setContentSize(const CCSize& size) } +void CCEditBoxImplAndroid::setAnchorPoint(const CCPoint& anchorPoint) +{ // don't need to be implemented on android platform. + +} + void CCEditBoxImplAndroid::visit(void) { // don't need to be implemented on android platform. diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h index 6a6782e057..f6b508dc44 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h @@ -44,6 +44,7 @@ public: virtual ~CCEditBoxImplAndroid(); virtual bool initWithSize(const CCSize& size); + virtual void setFont(const char* pFontName, int fontSize); virtual void setFontColor(const ccColor3B& color); virtual void setPlaceholderFontColor(const ccColor3B& color); virtual void setInputMode(EditBoxInputMode inputMode); @@ -58,6 +59,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(); diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h index 8ff1126833..9e8f9e265c 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h @@ -74,6 +74,7 @@ public: virtual ~CCEditBoxImplIOS(); virtual bool initWithSize(const CCSize& size); + virtual void setFont(const char* pFontName, int fontSize); virtual void setFontColor(const ccColor3B& color); virtual void setPlaceholderFontColor(const ccColor3B& color); virtual void setInputMode(EditBoxInputMode inputMode); @@ -88,6 +89,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(); @@ -95,6 +97,8 @@ public: private: CCSize m_tContentSize; + CCPoint m_obPosition; + CCPoint m_obAnchorPoint; EditBoxImplIOS* m_systemControl; int m_nMaxTextLength; bool m_bInRetinaMode; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm index 2694cc15d3..fb1cecd079 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm @@ -69,6 +69,7 @@ if (!textField_) break; [textField_ setTextColor:[UIColor whiteColor]]; textField_.font = [UIFont systemFontOfSize:frameRect.size.height*2/3]; //TODO need to delete hard code here. + textField_.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; textField_.backgroundColor = [UIColor clearColor]; textField_.borderStyle = UITextBorderStyleNone; textField_.delegate = self; @@ -212,6 +213,7 @@ CCEditBoxImpl* __createSystemEditBox(CCEditBox* pEditBox) CCEditBoxImplIOS::CCEditBoxImplIOS(CCEditBox* pEditText) : CCEditBoxImpl(pEditText) , m_systemControl(NULL) +, m_obAnchorPoint(ccp(0.5f, 0.5f)) , m_nMaxTextLength(-1) { m_bInRetinaMode = [[EAGLView sharedEGLView] contentScaleFactor] == 2.0f ? true : false; @@ -253,6 +255,16 @@ bool CCEditBoxImplIOS::initWithSize(const CCSize& size) return false; } +void CCEditBoxImplIOS::setFont(const char* pFontName, int fontSize) +{ + if(pFontName == NULL) + return; + NSString * fntName = [NSString stringWithUTF8String:pFontName]; + UIFont *textFont = [UIFont fontWithName:fntName size:fontSize]; + if(textFont != nil) + [m_systemControl.textField setFont:textFont]; +} + void CCEditBoxImplIOS::setFontColor(const ccColor3B& color) { m_systemControl.textField.textColor = [UIColor colorWithRed:color.r / 255.0f green:color.g / 255.0f blue:color.b / 255.0f alpha:1.0f]; @@ -387,8 +399,9 @@ static CGPoint convertDesignCoordToScreenCoord(const CCPoint& designCoord, bool void CCEditBoxImplIOS::setPosition(const CCPoint& pos) { - //TODO should consider anchor point, the default value is (0.5, 0,5) - [m_systemControl setPosition:convertDesignCoordToScreenCoord(ccp(pos.x-m_tContentSize.width/2, pos.y+m_tContentSize.height/2), m_bInRetinaMode)]; + m_obPosition = pos; + CCPoint designCoord = ccp(pos.x - m_tContentSize.width * m_obAnchorPoint.x, pos.y + m_tContentSize.height * (1 - m_obAnchorPoint.y)); + [m_systemControl setPosition:convertDesignCoordToScreenCoord(designCoord, m_bInRetinaMode)]; } void CCEditBoxImplIOS::setContentSize(const CCSize& size) @@ -397,6 +410,13 @@ void CCEditBoxImplIOS::setContentSize(const CCSize& size) CCLOG("[Edit text] content size = (%f, %f)", size.width, size.height); } +void CCEditBoxImplIOS::setAnchorPoint(const CCPoint& anchorPoint) +{ + CCLOG("[Edit text] anchor point = (%f, %f)", anchorPoint.x, anchorPoint.y); + m_obAnchorPoint = anchorPoint; + setPosition(m_obPosition); +} + void CCEditBoxImplIOS::visit(void) { diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp b/samples/Cpp/TestCpp/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp index b7eaca9cc6..8ead3db531 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp @@ -38,8 +38,14 @@ EditBoxTest::EditBoxTest() // top m_pEditName = CCEditBox::create(editBoxSize, CCScale9Sprite::create("extensions/green_edit.png")); m_pEditName->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height*3/4)); +#ifdef CC_TARGET_OS_IPHONE + m_pEditName->setFont("Paint Boy", 25); +#else + m_pEditName->setFont("fonts/Paint Boy.ttf", 25); +#endif m_pEditName->setFontColor(ccRED); m_pEditName->setPlaceHolder("Name:"); + m_pEditName->setPlaceholderFontColor(ccWHITE); m_pEditName->setMaxLength(8); m_pEditName->setReturnType(kKeyboardReturnTypeDone); m_pEditName->setDelegate(this); @@ -48,6 +54,11 @@ EditBoxTest::EditBoxTest() // middle 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)); +#ifdef CC_TARGET_OS_IPHONE + m_pEditPassword->setFont("A Damn Mess", 30); +#else + m_pEditPassword->setFont("fonts/A Damn Mess.ttf", 30); +#endif m_pEditPassword->setFontColor(ccGREEN); m_pEditPassword->setPlaceHolder("Password:"); m_pEditPassword->setMaxLength(6); @@ -59,6 +70,7 @@ EditBoxTest::EditBoxTest() // bottom m_pEditEmail = CCEditBox::create(CCSizeMake(editBoxSize.width, editBoxSize.height), CCScale9Sprite::create("extensions/yellow_edit.png")); m_pEditEmail->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/4)); + m_pEditEmail->setAnchorPoint(ccp(0.5, 1.0f)); m_pEditEmail->setPlaceHolder("Email:"); m_pEditEmail->setInputMode(kEditBoxInputModeEmailAddr); m_pEditEmail->setDelegate(this); diff --git a/samples/Cpp/TestCpp/proj.android/jni/Application.mk b/samples/Cpp/TestCpp/proj.android/jni/Application.mk index 743886713b..8e1ca3452d 100644 --- a/samples/Cpp/TestCpp/proj.android/jni/Application.mk +++ b/samples/Cpp/TestCpp/proj.android/jni/Application.mk @@ -1,2 +1,3 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 +APP_ABI = armeabi-v7a From 7da2dc953de054f066a374e760d785b52c50276a Mon Sep 17 00:00:00 2001 From: Neo Kim Date: Wed, 20 Feb 2013 22:52:49 +0900 Subject: [PATCH 4/6] Move height adjustment code from 'getRect' to 'keyboardWillShow' --- extensions/GUI/CCEditBox/CCEditBox.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/GUI/CCEditBox/CCEditBox.cpp b/extensions/GUI/CCEditBox/CCEditBox.cpp index 244ee6e79d..8608cfdec8 100644 --- a/extensions/GUI/CCEditBox/CCEditBox.cpp +++ b/extensions/GUI/CCEditBox/CCEditBox.cpp @@ -260,15 +260,15 @@ void CCEditBox::onExit(void) static CCRect getRect(CCNode * pNode) { - CCRect rc = pNode->boundingBox(); - rc.origin.y -= 4; - return rc; + return pNode->boundingBox(); } void CCEditBox::keyboardWillShow(CCIMEKeyboardNotificationInfo& info) { // CCLOG("CCEditBox::keyboardWillShow"); CCRect rectTracked = getRect(this); + // some adjustment for margin between the keyboard and the edit box. + rectTracked.origin.y -= 4; // if the keyboard area doesn't intersect with the tracking node area, nothing needs to be done. if (!rectTracked.intersectsRect(info.end)) From d42d847fb35d5bcca8703b7fcbce8ac89916eb86 Mon Sep 17 00:00:00 2001 From: Neo Kim Date: Mon, 25 Feb 2013 15:05:38 +0900 Subject: [PATCH 5/6] Added 'setPlaceholderFont()' to CCEditBox --- extensions/GUI/CCEditBox/CCEditBox.cpp | 11 +++++++++++ extensions/GUI/CCEditBox/CCEditBox.h | 7 +++++++ extensions/GUI/CCEditBox/CCEditBoxImpl.h | 1 + extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp | 8 ++++++++ extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h | 1 + extensions/GUI/CCEditBox/CCEditBoxImplIOS.h | 1 + extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm | 5 +++++ 7 files changed, 34 insertions(+) diff --git a/extensions/GUI/CCEditBox/CCEditBox.cpp b/extensions/GUI/CCEditBox/CCEditBox.cpp index 8608cfdec8..e9c2e48434 100644 --- a/extensions/GUI/CCEditBox/CCEditBox.cpp +++ b/extensions/GUI/CCEditBox/CCEditBox.cpp @@ -144,6 +144,17 @@ void CCEditBox::setFontColor(const ccColor3B& color) } } +void CCEditBox::setPlaceholderFont(const char* pFontName, int fontSize) +{ + if (pFontName != NULL) + { + if (m_pEditBoxImpl != NULL) + { + m_pEditBoxImpl->setPlaceholderFont(pFontName, fontSize); + } + } +} + void CCEditBox::setPlaceholderFontColor(const ccColor3B& color) { m_colText = color; diff --git a/extensions/GUI/CCEditBox/CCEditBox.h b/extensions/GUI/CCEditBox/CCEditBox.h index bff53fb2d9..b25437a918 100644 --- a/extensions/GUI/CCEditBox/CCEditBox.h +++ b/extensions/GUI/CCEditBox/CCEditBox.h @@ -224,6 +224,13 @@ public: */ void setFontColor(const ccColor3B& color); + /** + * Set the placeholder's font. + * @param pFontName The font name. + * @param fontSize The font size. + */ + void setPlaceholderFont(const char* pFontName, int fontSize); + /** * Set the font color of the placeholder text when the edit box is empty. * Not supported on IOS. diff --git a/extensions/GUI/CCEditBox/CCEditBoxImpl.h b/extensions/GUI/CCEditBox/CCEditBoxImpl.h index 2cc639921c..950579333c 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImpl.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImpl.h @@ -42,6 +42,7 @@ public: virtual bool initWithSize(const CCSize& size) = 0; virtual void setFont(const char* pFontName, int fontSize) = 0; virtual void setFontColor(const ccColor3B& color) = 0; + virtual void setPlaceholderFont(const char* pFontName, int fontSize) = 0; virtual void setPlaceholderFontColor(const ccColor3B& color) = 0; virtual void setInputMode(EditBoxInputMode inputMode) = 0; virtual void setInputFlag(EditBoxInputFlag inputFlag) = 0; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp index 15aab27a67..e0c70b06c4 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp @@ -109,6 +109,14 @@ void CCEditBoxImplAndroid::setFontColor(const ccColor3B& color) m_pLabel->setColor(color); } +void CCEditBoxImplAndroid::setPlaceholderFont(const char* pFontName, int fontSize) +{ + if(m_pLabelPlaceHolder != NULL) { + m_pLabelPlaceHolder->setFontName(pFontName); + m_pLabelPlaceHolder->setFontSize(fontSize); + } +} + void CCEditBoxImplAndroid::setPlaceholderFontColor(const ccColor3B& color) { m_colPlaceHolder = color; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h index f6b508dc44..7dea554800 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h @@ -46,6 +46,7 @@ public: 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); diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h index 9e8f9e265c..8a70af58fa 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h @@ -76,6 +76,7 @@ public: 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); diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm index fb1cecd079..15f334611d 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm @@ -270,6 +270,11 @@ void CCEditBoxImplIOS::setFontColor(const ccColor3B& color) m_systemControl.textField.textColor = [UIColor colorWithRed:color.r / 255.0f green:color.g / 255.0f blue:color.b / 255.0f alpha:1.0f]; } +void CCEditBoxImplIOS::setPlaceholderFont(const char* pFontName, int fontSize) +{ + // TODO need to be implemented. +} + void CCEditBoxImplIOS::setPlaceholderFontColor(const ccColor3B& color) { // TODO need to be implemented. From 93195ebe1759a7326948549f8d53653511161cad Mon Sep 17 00:00:00 2001 From: Neo Kim Date: Mon, 25 Feb 2013 15:44:38 +0900 Subject: [PATCH 6/6] Modified a preprocessor line which distinguishes device platform in CCEditBox test code. --- .../Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp b/samples/Cpp/TestCpp/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp index 8ead3db531..fc77574529 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp @@ -38,7 +38,7 @@ EditBoxTest::EditBoxTest() // top m_pEditName = CCEditBox::create(editBoxSize, CCScale9Sprite::create("extensions/green_edit.png")); m_pEditName->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height*3/4)); -#ifdef CC_TARGET_OS_IPHONE +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) m_pEditName->setFont("Paint Boy", 25); #else m_pEditName->setFont("fonts/Paint Boy.ttf", 25); @@ -54,7 +54,7 @@ EditBoxTest::EditBoxTest() // middle 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)); -#ifdef CC_TARGET_OS_IPHONE +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) m_pEditPassword->setFont("A Damn Mess", 30); #else m_pEditPassword->setFont("fonts/A Damn Mess.ttf", 30);