AppDelegate的使用
来源:互联网 发布:php setcookie 作用域 编辑:程序博客网 时间:2024/05/29 07:58
AppDelegate.h
#ifndef __APP_DELEGATE_H__#define __APP_DELEGATE_H__#include "cocos2d.h"/**@简单的 cocos2d 的应用.原因是私有的产业是实现隐藏一些由CCDirector接口调用。*/class AppDelegate : private cocos2d::CCApplication{public: AppDelegate(); virtual ~AppDelegate(); /** @简单实现CCDirector和CCScene init代码在这里 @返回 true 初始化成功,程序继续。 @返回 false 初始化失败,程序终止。. */ virtual bool applicationDidFinishLaunching(); /** @简短的函数被称为当应用程序输入的背景 @应用程序的参数的指针 */ virtual void applicationDidEnterBackground(); /** @简短的函数被称为当应用程序进入前台 @应用程序的参数的指针 */ virtual void applicationWillEnterForeground();};#endif // __APP_DELEGATE_H__
AppDelegate.cpp
#include "cocos2d.h"#include "CCEGLView.h"#include "AppDelegate.h"#include "HelloWorldScene.h"USING_NS_CC;AppDelegate::AppDelegate(){}AppDelegate::~AppDelegate(){}bool AppDelegate::applicationDidFinishLaunching(){ // 初始化导演类 CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); // t打开显示FPS pDirector->setDisplayStats(true); // 设置帧/秒。默认值是1.0/60,你也可以不叫这个 pDirector->setAnimationInterval(1.0 / 60); // 创建一个场景。这是一个生成自动释放对象 CCScene *pScene = HelloWorld::scene(); // 运行 pDirector->runWithScene(pScene); return true;}// 这个函数会被调用的应用程序是不活跃的时候void AppDelegate::applicationDidEnterBackground(){ CCDirector::sharedDirector()->stopAnimation();}// 这个函数会被调用的应用程序时再次活跃起来void AppDelegate::applicationWillEnterForeground(){ CCDirector::sharedDirector()->startAnimation();}
- AppDelegate的使用
- AppDelegate.h中各个方法的使用
- AppDelegate文件的介绍和使用
- 使用category 为 AppDelegate 的代码分层
- 使用category 为 AppDelegate 的代码分层
- iOS之UIApplecation和appdelegate的使用
- 使用appdelegate的变量做全局变量的方法
- 使用 SDWebImage 应该在 AppDelegate 写的代码
- AppDelegate的科幻用法
- AppDelegate的详解
- AppDelegate的科幻用法
- AppDelegate的科幻用法
- IOS的AppDelegate 事件
- AppDelegate的详解
- AppDelegate的运用
- AppDelegate的详解
- AppDelegate的详解
- iOS AppDelegate的详解
- 【xinfanqie】电脑的出生日期如何计算
- VC 中窗口的销毁
- 栈的push、pop序列(29)
- 【三层架构系列】之初识庐山真面目
- 【xinfanqie】忘记开机密码如何处理
- AppDelegate的使用
- 为存储浏览器的历史设计数据结构
- 解决php中rename乱码
- Access Point Compatibility of MRF24WB
- JAVA的可变类与不可变类
- POJ 4052 Hrinity 解题报告
- sql server2008 更改登录名的默认数据库
- 纯净ubuntu系统上安装nagios并使用
- JavaScript-html标题滚动效果