09 creating windows phone game with cocos2d-xna

19
Put People First 以人为本 基于 cocos2d-x for XNA Windows Phone 游戏开发 全新 全易

Upload: -

Post on 08-May-2015

337 views

Category:

Technology


0 download

DESCRIPTION

tory xu (microsoft) and xiaoming zhang

TRANSCRIPT

Page 1: 09   creating windows phone game with cocos2d-xna

Put People First 以人为本

基于cocos2d-x for XNA的 Windows Phone游戏开发

全新 ・ 全易

Page 2: 09   creating windows phone game with cocos2d-xna

徐玉涛 Tory Xu 技术平台合作经理 开发工具与平台事业部 微软(中国)有限公司 [email protected] 微博:@徐玉涛Tory Xu 欢迎

Page 3: 09   creating windows phone game with cocos2d-xna

以人为本 —— 联接消费者与开发者"

统⼀一的开发平台

不同的设备,⼀一致的体验

Page 4: 09   creating windows phone game with cocos2d-xna

Windows Phone 全新 · 全易

Page 5: 09   creating windows phone game with cocos2d-xna

全新

全易

市场机会

设备规格

90%

工具体系

游戏框架

游戏开发者的 全新 · 全易 "

Page 6: 09   creating windows phone game with cocos2d-xna

开源

Windows Phone 7.5

开放下载

工作量

50%

http://download.cocos2d-x.org MIT License

C# with XNA Hello World

Cocos2d-x for XNA"

Page 7: 09   creating windows phone game with cocos2d-xna

春”Phone” 开发者计划

8个第三方开发者 SDK版开放下载

Page 8: 09   creating windows phone game with cocos2d-xna

张小明"Cocos2d-x核心开发者 [email protected] 走进

cocos2d-x for XNA

Page 9: 09   creating windows phone game with cocos2d-xna

Ø Cocos2d-x for XNA与cocos2d-x的关系 Ø Cocos2d-x for XNA提供哪些功能,怎么用 Ø Cocos2d-x cocos2d-x for XNA

主要内容"

Page 10: 09   creating windows phone game with cocos2d-xna

class Engine: public API { public : string language; string supportPlatforms; }; // language = “c++” // supportPlatforms = “iOS Android …” class cocos2d-x: public Engine { public : virtual void addChild(CCNode*); };

class API { virtual void addChild(CCNode*)=0; … }; // language = “c#” // supportPlatfroms = “windows phone7” class cocos2d-x_for_xna : public Engine { public : virtual void addChild(CCNode*); };

Cocos2d-x for XNA与cocos2d-x关系"

Page 11: 09   creating windows phone game with cocos2d-xna

Cocos2d-x for XNA提供的功能"

Ø 显示图片 Ø 动画效果 Ø 粒子效果 Ø 显示文本 Ø 添加菜单 Ø 播放音乐音效 …

Page 12: 09   creating windows phone game with cocos2d-xna

// c++ CCSprite *pSprite = CCSprite::spriteWithFile(“helloworld.png”); pSprite->setPosition(ccp(100, 100)); addChild(pSprite); // c# CCSprite sprite = CCSprite.spriteWithFile(“helloworld”); sprite.position = new CCPoint(100, 100); addChild(sprite);

显示图片"

Page 13: 09   creating windows phone game with cocos2d-xna

// c++ CCMoveTo *moveTo = CCMoveTo::actionWithDuration(2, ccp(50, 50)); pSprite->runAction(moveTo); // c# CCMoveTo moveTo = CCMoveTo.actionWithDuration(2, new CCPoint(50, 50)); sprite.runAction(moveTo);

动画效果"

Page 14: 09   creating windows phone game with cocos2d-xna

// c++ CCParticleSystem *particle = CCParticleFlower::node(); particle->setTexture(pSprite->getTexture()); particle->setPosition(ccp(100, 100)); addChild(particle); // c# CCParticleSystem particle = new CCParticleFlower(); particle.texture = sprite.texture; particle.position = new CCPoint(100, 100); addChild(particle);

粒子效果"

Page 15: 09   creating windows phone game with cocos2d-xna

// c++ CCLabelTTF *pLabel = CCLabelTTF::labelWithString(“hello”, “Arial”, 20); pLabel->setPosition(ccp(100, 100)); addChild(pLabel); // c# CCLabelTTF label = CCLabelTTF.labelWithString(“hello”, “Arial”, 20); label.position = new CCPoint(100, 100); addChild(label);

显示文本"

Page 16: 09   creating windows phone game with cocos2d-xna

// c++ SimpleAudioEngine::sharedEngine()->playBackgroundMusic(“bg.mp3”); SimpleAudioEngine::sharedEngine()->playEffect(“effect.ogg”); // c# SimpleAudioEngine.sharedEngine().playBackgroundMusic(“bg”); SimpleAudioEngine.sharedEngine().playEffect(“effect”);

// c++ CCMenuItemLabel *pItemLabel = CCMenuItemLabel::itemWithLabel(“item”); CCMenu *pMenu = CCMenu::menuWithItems(pItemLabel, NULL); pMenu->setPosition(ccp(100, 100)); addChild(pMenu); // c# CCMenuItemLabel itemLabel = CCMenuItemLabel.itemWithLabel(“item”); CCMenu menu = CCMenu.menuWithItems(itemLabel); menu.position = new CCPoint(100, 100); addChild(menu);

添加菜单"

Page 17: 09   creating windows phone game with cocos2d-xna

// c++ SimpleAudioEngine::sharedEngine()->playBackgroundMusic(“bg.mp3”); SimpleAudioEngine::sharedEngine()->playEffect(“effect.ogg”); // c# SimpleAudioEngine.sharedEngine().playBackgroundMusic(“bg”); SimpleAudioEngine.sharedEngine().playEffect(“effect”);

播放音效"

Page 18: 09   creating windows phone game with cocos2d-xna

相同点: 1. 接口相同 2. 引擎框架相同 3. 同样的社区支持 不同点(语言差异): 1. 内存管理 2. 成员变量访问 3. 资源访问 4. 微软、诺基亚的大力支持

Cocos2d-x移植到cocos2d-x for XNA

Page 19: 09   creating windows phone game with cocos2d-xna

徐玉涛 [email protected] 张小明 [email protected]

谢谢 Thanks