Classed/AppDelegate.cpp 文件内容如下:

#include "cocos2d.h"
#include "CCEGLView.h"
#include "AppDelegate.h"
#include "HelloWorldScene.h"
#include "SimpleAudioEngine.h" using namespace CocosDenshion; USING_NS_CC; AppDelegate::AppDelegate()
{
} AppDelegate::~AppDelegate()
{
SimpleAudioEngine::end();
} bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director(导演初始化)
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); // turn on display FPS(设置显示状态信息:当前对象个数 每一帧使用时间 当前游戏整体运行帧数)
pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this(设置游戏帧率为每秒60帧)
pDirector->setAnimationInterval(1.0 / ); // create a scene. it's an autorelease object
CCScene *pScene = HelloWorld::scene(); // run (运行 HelloWorld 场景)
pDirector->runWithScene(pScene);
return true;
} // This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground()
{
//对整个游戏设置暂停
CCDirector::sharedDirector()->stopAnimation();
//设置暂停音乐
SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
} // this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground()
{
//设置游戏继续
CCDirector::sharedDirector()->startAnimation();
//设置音乐继续播放
SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
} /*
此类含义是当整个项目启动后,Cocos2d-x引擎会从各个平台的入口函数中接管,然后调用
AppDelegate类中的 applicationDidFinishLaunching 函数。
当程序用户切入运行后台的时候,会响应 AppDelegate 类中的 applicationDidEnterBackground 函数。
当程序用户从设备运行后台切回到当前运行程序时,会响应 AppDelegate 类中的 applicationWillEnterForeground函数。
*/

最新文章

  1. QuanbenSoft Windows Runtime (Windows Store)Apps 应用及其框架总览
  2. java运算优先级
  3. JS-Math对象
  4. 解决(空密码的root)提示修改phpmyadmin用户密码
  5. hive中导入json格式的数据(hive分区表)
  6. 未在本地计算机上注册“Microsoft.Jet.OLEDB.4.0”提供程序的处理方式
  7. JavaScript Comparison and Logical Operators
  8. DBMS_RLS包实现数据库表中的行级安全控制
  9. angularjs自定义日期过滤器,如:周日(前天 21:24)
  10. Mahout之(二)协同过滤推荐
  11. 老司机的奇怪noip模拟T3-zhugeliang
  12. express session 和 socketio session关联
  13. 2)实现github自动登陆获取信息
  14. linux内核期中总结
  15. Android Studio 版本间区别
  16. spark work目录处理 And HDFS空间都去哪了?
  17. loading加载和layer.js
  18. CSS加DIV布局
  19. 关于 Vue 方法前面的美元符号
  20. python中hashlib md5

热门文章

  1. getMeasuredHeight(),getScrollY(),getHeight()的区别和联系
  2. 使用java命令运行class文件带包名时出错
  3. Laravel开发:Laravel核心——Ioc服务容器源码解析(服务器绑定)
  4. js网页视频播放: vcastr22 、 flowplayer 、 jwplayer
  5. 页游手游服务器(五)sql缓存层
  6. Codeforces441C_Valera and Tubes(暴力)
  7. Python 中奇妙的下划线
  8. (转)Javascript模块化编程(一):模块的写法
  9. QT设置QToolBar带有图标和文字
  10. 机器学习Coursera学习总结