Skip to content

Instantly share code, notes, and snippets.

@tks2shimizu
Created July 10, 2013 05:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tks2shimizu/1b028502d7cd04e8e1cb to your computer and use it in GitHub Desktop.
Save tks2shimizu/1b028502d7cd04e8e1cb to your computer and use it in GitHub Desktop.
テキスト入力(2)
#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;
}
#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