facebook twitter hatena line email

「Cocos2dx/property」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(ページの作成:「==サンプルコード== cpp側にのみ記述、h側には記述不要。 #include "HelloWorldScene.h" USING_NS_CC; const char* mStr = "hoge_property"; // 通常prop...」)
(相違点なし)

2017年3月2日 (木) 17:36時点における版

サンプルコード

cpp側にのみ記述、h側には記述不要。

#include "HelloWorldScene.h"
USING_NS_CC;
const char* mStr = "hoge_property"; // 通常property
static const char* mStrStatic = "hoge_property_static"; // static_property
Scene* HelloWorld::createScene()
{
    auto scene = Scene::create();
    auto layer = HelloWorld::create();
    scene->addChild(layer);
    return scene;
}
bool HelloWorld::init()
{
    mStr = "hoge_property2";
    log("%s", mStr);
    mStrStatic = "hoge_property_static2";
    log("%s", mStrStatic);
    // 略
}