#include <TextInputTest.h>
◆ callbackRemoveNodeWhenDidAction()
| void TextFieldTTFActionTest::callbackRemoveNodeWhenDidAction |
( |
Node * |
node | ) |
|
◆ CREATE_FUNC()
◆ onClickTrackNode()
| void TextFieldTTFActionTest::onClickTrackNode |
( |
bool |
bClicked, |
|
|
const cocos2d::Vec2 & |
touchPos |
|
) |
| |
|
overridevirtual |
◆ onDraw()
| bool TextFieldTTFActionTest::onDraw |
( |
cocos2d::TextFieldTTF * |
sender | ) |
|
|
virtual |
◆ onEnter()
| void TextFieldTTFActionTest::onEnter |
( |
| ) |
|
|
overridevirtual |
重载 TestCase .
在文件 TextInputTest.cpp 第 217 行定义.
225 FadeOut::create(0.25),
226 FadeIn::create(0.25),
233 auto s = Director::getInstance()->getWinSize();
235 _textField = TextFieldTTF::textFieldWithPlaceHolder(
"<click here for input>",
242#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
245 _textField->setPosition(Vec2(s.width / 2, s.height/2 + 50));
247 _textField->setPosition(Vec2(s.width / 2, s.height / 2));
virtual void onEnter() override
cocos2d::TextFieldTTF * _textField
cocos2d::Action * _textFieldAction
引用了 _action, _charLimit, _textField, _textFieldAction, KeyboardNotificationLayer::_trackNode, FONT_NAME, FONT_SIZE , 以及 TestCase::onEnter().
◆ onExit()
| void TextFieldTTFActionTest::onExit |
( |
| ) |
|
|
overridevirtual |
◆ onTextFieldAttachWithIME()
| bool TextFieldTTFActionTest::onTextFieldAttachWithIME |
( |
cocos2d::TextFieldTTF * |
sender | ) |
|
|
overridevirtual |
◆ onTextFieldDeleteBackward()
| bool TextFieldTTFActionTest::onTextFieldDeleteBackward |
( |
cocos2d::TextFieldTTF * |
sender, |
|
|
const char * |
delText, |
|
|
size_t |
nLen |
|
) |
| |
|
overridevirtual |
在文件 TextInputTest.cpp 第 326 行定义.
330 this->addChild(label);
333 auto beginPos = sender->getPosition();
334 auto textfieldSize = sender->getContentSize();
335 auto labelSize = label->getContentSize();
336 beginPos.x += (textfieldSize.width - labelSize.width) / 2.0f;
338 auto winSize = Director::getInstance()->getWinSize();
339 Vec2 endPos(- winSize.width / 4.0f, winSize.height * (0.5 + (
float)rand() / (2.0f * RAND_MAX)));
342 float rotateDuration = 0.2f;
344 label->setPosition(beginPos);
346 auto seq = Sequence::create(
348 MoveTo::create(duration, endPos),
350 RotateBy::create(rotateDuration, (rand()%2) ? 360 : -360),
352 FadeOut::create(duration),
356 label->runAction(seq);
void callbackRemoveNodeWhenDidAction(Node *node)
引用了 callbackRemoveNodeWhenDidAction(), FONT_NAME , 以及 FONT_SIZE.
◆ onTextFieldDetachWithIME()
| bool TextFieldTTFActionTest::onTextFieldDetachWithIME |
( |
cocos2d::TextFieldTTF * |
sender | ) |
|
|
overridevirtual |
◆ onTextFieldInsertText()
| bool TextFieldTTFActionTest::onTextFieldInsertText |
( |
cocos2d::TextFieldTTF * |
sender, |
|
|
const char * |
text, |
|
|
size_t |
nLen |
|
) |
| |
|
overridevirtual |
在文件 TextInputTest.cpp 第 281 行定义.
297 this->addChild(label);
298 Color3B color(226, 121, 7);
299 label->setColor(color);
302 auto endPos = sender->getPosition();
303 if (sender->getCharCount())
305 endPos.x += sender->getContentSize().width / 2;
307 auto inputTextSize = label->getContentSize();
308 Vec2 beginPos(endPos.x, Director::getInstance()->getWinSize().height - inputTextSize.height * 2);
310 float duration = 0.5;
311 label->setPosition(beginPos);
314 auto seq = Sequence::create(
316 MoveTo::create(duration, endPos),
317 ScaleTo::create(duration, 1),
318 FadeOut::create(duration),
322 label->runAction(seq);
引用了 _charLimit, callbackRemoveNodeWhenDidAction(), FONT_NAME , 以及 FONT_SIZE.
◆ subtitle()
| std::string TextFieldTTFActionTest::subtitle |
( |
| ) |
const |
|
overridevirtual |
◆ _action
| bool TextFieldTTFActionTest::_action |
|
private |
◆ _charLimit
| size_t TextFieldTTFActionTest::_charLimit |
|
private |
◆ _textField
| cocos2d::TextFieldTTF* TextFieldTTFActionTest::_textField |
|
private |
◆ _textFieldAction
| cocos2d::Action* TextFieldTTFActionTest::_textFieldAction |
|
private |
该类的文档由以下文件生成:
- /Users/yujizhu/Documents/Git/cocos2d-x-4.0/tests/cpp-tests/Classes/TextInputTest/TextInputTest.h
- /Users/yujizhu/Documents/Git/cocos2d-x-4.0/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp