auto 変数 = String( テキストリテラル );
《String》.append( テキストリテラル );
《String》.appendWithFormat( フォーマット文字列 , 値…… );
char* 変数 = 《String》.getCString();
int 変数 = 《String》.intValule();
uint 変数 = 《String》.uintValule();
float 変数 = 《String》.floatValule();
double 変数 = 《String》.doubleValule();
※リストが表示されない場合
AddBlockなどの広告ブロックツールがONになっているとリストなどが表示されない場合があります。これらのツールをOFFにしてみてください。
#pragma execution_character_set("utf-8") #include "HelloWorldScene.h" USING_NS_CC; Scene* HelloWorld::createScene() { auto scene = Scene::create(); auto layer = HelloWorld::create(); scene->addChild(layer); return scene; } bool HelloWorld::init() { if (!Layer::init()) { return false; } Size visibleSize = Director::getInstance()->getVisibleSize(); Vec2 origin = Director::getInstance()->getVisibleOrigin(); Director::getInstance()->setDisplayStats(false); // stats OFF auto str = String("★サンプルテキスト★"); str.append("\n ・追加するテキスト"); str.appendWithFormat("\n \\%i.", 1234567); auto label = Label::createWithTTF(str.getCString(), "fonts/msgothic.ttc", 48); label->setAnchorPoint(Vec2(0, 1)); label->setPosition(origin.x, origin.y + visibleSize.height); this->addChild(label, 1); return true; }
<< 前へ |