Skip to content

Instantly share code, notes, and snippets.

@tks2shimizu
Created January 13, 2013 15:58
Show Gist options
  • Save tks2shimizu/4524796 to your computer and use it in GitHub Desktop.
Save tks2shimizu/4524796 to your computer and use it in GitHub Desktop.
ラベルの画像化
#include "HelloWorldScene.h"
#include "SimpleAudioEngine.h"
using namespace cocos2d;
using namespace CocosDenshion;
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();
//文字列の生成
CCLabelBMFont* label = CCLabelBMFont::create("Hello World", "font1.fnt");
label->setPosition(ccp(winSize.width / 2,
winSize.height / 2));
label->setScale(2.0);
this->addChild(label);
return true;
}
//#ifndef __HELLOWORLD_SCENE_H__
//#define __HELLOWORLD_SCENE_H__
#include "cocos2d.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