资源简介
Vs2013+cocos2dx贪吃蛇,3个场景的切换,代码有注释
代码片段和文件信息
#include “AppDelegate.h“
#include “HomeScene.h“
USING_NS_CC;
AppDelegate::AppDelegate() {
}
AppDelegate::~AppDelegate()
{
}
//if you want a different contextjust modify the value of glContextAttrs
//it will takes effect on all platforms
void AppDelegate::initGLContextAttrs()
{
//set OpenGL context attributionsnow can only set six attributions:
//redgreenbluealphadepthstencil
GLContextAttrs glContextAttrs = {8 8 8 8 24 8};
GLView::setGLContextAttrs(glContextAttrs);
}
// If you want to use packages manager to install more packages
// don‘t modify or remove this function
static int register_all_packages()
{
return 0; //flag for packages manager
}
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLViewImpl::create(“My Game“);
director->setOpenGLView(glview);
}
// turn on display FPS
director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don‘t call this
director->setAnimationInterval(1.0 / 60);
register_all_packages();
// create a scene. it‘s an autorelease object
auto scene = HomeScene::CreateScene();
// run
director->runWithScene(scene);
return true;
}
// This function will be called when the app is inactive. When comes a phone callit‘s be invoked too
void AppDelegate::applicationDidEnterBackground() {
Director::getInstance()->stopAnimation();
// if you use SimpleAudioEngine it must be pause
// SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
}
// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground() {
Director::getInstance()->startAnimation();
// if you use SimpleAudioEngine it must resume here
// SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-07-10 23:57 snake\
文件 1959 2016-07-11 20:43 snake\AppDelegate.cpp
文件 987 2016-07-10 02:15 snake\AppDelegate.h
文件 120252 2016-07-10 11:46 snake\apple.png
文件 1454 2016-07-12 00:07 snake\GameOverScene.cpp
文件 282 2016-07-11 20:55 snake\GameOverScene.h
文件 6062 2016-07-11 23:50 snake\HelloWorldScene.cpp
文件 1473 2016-07-12 00:07 snake\HelloWorldScene.h
文件 1103 2016-07-12 00:07 snake\HomeScene.cpp
文件 180 2016-07-11 20:34 snake\HomeScene.h
文件 1941 2016-07-12 00:09 snake\SnakeSprite.cpp
文件 800 2016-07-12 00:07 snake\SnakeSprite.h
- 上一篇:ssh+jbpm项目某集团OA
- 下一篇:改进粒子群算法对BP神经网络的优化
相关资源
- cocos2dx3.x使用socket创建服务端和客户端
- GoogleObbDownloadProject
- A星寻路Cocos2dx3.3自动寻路代码
- lua搓牌效果,已实现了四边
- cocos2dx实现自定义2D地形
- cocos2dx-3.0功能强大的richText控件源码
- 我所理解的Cocos2dx pdf 地址
- 17种cocos2d-x小游戏源码+素材,从2.x到
- Flash转cocos2dx骨骼动画
- 仿Flappy游戏cocos2dx3.0beta源码BY懒骨头
- CocosCreator小球发射线
- 将.pvr.ccz和plist文件还原为多个原图
- cocos引擎老版本集合cocos2d-x-2.2.1 - 3
- 微软雅黑字体
- spine-runtimes-3.8.rar
- 17种游戏源码+素材
- 半透明屏蔽罩和弹出框的实现
- cocos2dx 3.x宝石消除小游戏demo
- Cocos2dx游戏开发系列笔记18:《跑酷》
评论
共有 条评论