2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

レイヤー背景の指定

Posted at

Layer クラスの派生クラスで、背景を指定する場合、

  1. 背景スプライトを生成し、addChild() する。
  2. draw() メソッドをオーバライドし、DrawPrimitives::drawSolidRect() で描画する。

などの方法があるが、それらより LayerColor オブジェクトを生成し、addChild() する方法の方が画面サイズを気にしなくていいので、楽で、お薦めだぞ。

bool GameLayer::init()
{
  :
  // 背景レイヤー設定
  auto layerColorBG = LayerColor::create(Color4B(128, 128, 128, 255));
  this->addChild(layerColorBG);
  :
}

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?