-
-
Save tks2shimizu/1b028502d7cd04e8e1cb to your computer and use it in GitHub Desktop.
テキスト入力(2)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "HelloWorldScene.h" | |
USING_NS_CC; | |
USING_NS_CC_EXT; | |
CCScene* HelloWorld::scene() | |
{ | |
CCScene *scene = CCScene::create(); | |
HelloWorld *layer = HelloWorld::create(); | |
scene->addChild(layer); | |
return scene; | |
} | |
bool HelloWorld::init() | |
{ | |
if ( !CCLayer::init() ) | |
{ | |
return false; | |
} | |
CCSize winSize = CCDirector::sharedDirector()->getWinSize(); | |
CCEditBox* editBox = CCEditBox::create(CCSizeMake(400, 100), | |
CCScale9Sprite::create("textfield.png")); | |
editBox->setPosition(ccp(winSize.width / 2, winSize.height / 2)); | |
editBox->setFontColor(ccBLACK); | |
this->addChild(editBox); | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __HELLOWORLD_SCENE_H__ | |
#define __HELLOWORLD_SCENE_H__ | |
#include "cocos2d.h" | |
#include "cocos-ext.h" | |
class HelloWorld : public cocos2d::CCLayer | |
{ | |
public: | |
virtual bool init(); | |
static cocos2d::CCScene* scene(); | |
CREATE_FUNC(HelloWorld); | |
}; | |
#endif // __HELLOWORLD_SCENE_H__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment