文字をカスタマイズする – Ver3.x
Labelクラスでは、文字に色々と装飾を加えることができます。
シャドウ(影)
文字に影を入れることができます。enableShadow()メソッドを利用します。
enableShadow(const Color4B & shadowColor = Color4B::BLACK, const Size & offset = Size(2,-2), int blurRadius = 0 )
- 引数1:影の色(Color4B型)
- 引数2:影のオフセット(Size型)
- 引数3:影の大きさ(int型)
//具体例 auto text = Label::createWithSystemFont("Text テキスト (シャドウ)", "Arial", 48); text->setPosition(Point(winSize.width/2,winSize.height/3*2)); text->setColor(Color3B::WHITE); text->enableShadow(Color4B::RED,Size(-2,-4),2); this->addChild(text);
アウトライン
文字の周りにアウトラインを設定できます。enableOutline()を利用します。
void enableOutline (const Color4B & outlineColor, int outlineSize = -1 )
- 引数1:アウトラインの色(Color4B型)
- 引数2:アウトラインの大きさ(int型)
//具体例 auto text2 = Label::createWithSystemFont("Text2 テキスト2 (アウトライン)", "Arial", 32); text2->setPosition(Point(winSize.width/2,winSize.height/2)); text2->setColor(Color3B::WHITE); text2->enableOutline(Color4B::BLACK,5); // 色と大きさを指定します。 this->addChild(text2);
経営育成ゲーム「わたしの動物園」をリリースしました!
cocos2dxを使って作成したアプリを作成しました。
無料で遊べますので、ぜひゲーム作りの参考にしてみて下さい!
【Sponsored Link】
更新履歴
- 2015年1月29日 : Jniを利用する
- 2015年1月27日 : デバックのための、ログの利用
- 2015年1月24日 : Android – 新規ファイルの追加と保存場所
- 2014年6月13日 : OSを判別する
- 2014年6月13日 : 効果音を再生する