1
1

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.

Zwoptexを使ってみる

Posted at

テクスチャアトラスを簡単に作れるツール Zwoptex を使ってみます。

ツール自体は簡単!
ドラッグアンドドロップでファイルを追加し、Publishボタンを押すだけです。

画面はこんな感じです。
zwoptex_ss.png

出力されるファイルは2つあります。

  • plistファイル
  • pngファイル

黒と白の画像を交互に入れ替えるアニメーションのサンプルです。

サンプル
	// 最初にplistファイルを読み込む.
	auto cache = SpriteFrameCache::getInstance();
	cache->addSpriteFramesWithFile("test-0001-default.plist");
	
	// Spriteを表示する.
	auto sprite = Sprite::createWithSpriteFrameName("black.png");
	sprite->setPosition(100, 100);
	this->addChild(sprite);
	
	// アニメーションさせる.
	Vector<SpriteFrame *> frames;
	frames.pushBack(cache->getSpriteFrameByName("black.png"));
	frames.pushBack(cache->getSpriteFrameByName("white.png"));
	Animation *animation = Animation::createWithSpriteFrames(frames, 0.5f);
	Animate *animate = Animate::create(animation);
	RepeatForever *repeat = RepeatForever::create(animate);
	sprite->runAction(repeat);

簡単ですね。

以上

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?