More Related Content
More from Akihiro Matsuura
More from Akihiro Matsuura (16)
Cocos2dx tips
- 2. Agenda
• テクスチャ
• PVR
• CCSpriteBatchNode
• マルチスレッド処理
• サブスレッドでテクスチャをロード
• SQLite3
- 7. CCSpriteBatchNode* batchNode =
CCSpriteBatchNode::batchNodeWithFile("texture.png");
this->addChild(batchNode, 0);
CCSprite* sprite =
CCSprite::spriteWithSpriteFrameName("sprite.png");
batchNode->addChild(sprite);
- 9. void *SelectScene::preparePlay(void *ptr) {
CCThread thread;
thread.createAutoreleasePool();
SelectScene* scene = (SelectScene*)ptr;
// prepare play
MusicManager::sharedObject()->prepareMusicPlay();
// load texture
ThemeManager::sharedObject()->loadThemeTexture();
scene->isPreparePlay = false;
return NULL;
}
- 10. サブスレッドでテクスチャをロード
• サブスレッドでロードすると画像が読み込ま
れない
• CCTextureCache::addImageAsync クラスを使
用してテクスチャの画像をロード
• コールバック関数で画像ロード後にテクス
チャをロードする
- 11. SQLite
• SQLite のソースをプロジェクトに追加
• #include “sqlite.h”
• sqlite_open, sqlite_close... api
http://www.cocos2d-x.org/boards/6/topics/7006
Editor's Notes
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n