资源简介
Cocos2d-x 3.2 自动更新
使用AssetsManager更新游戏资源包
代码片段和文件信息
#include “AppDelegate.h“
#include
#include
#include “Upgrade.h“
#include “AppMacros.h“
USING_NS_CC;
using namespace std;
AppDelegate::AppDelegate() {
}
AppDelegate::~AppDelegate()
{
}
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLView::create(“Cpp Empty Test“);
director->setOpenGLView(glview);
}
director->setOpenGLView(glview);
// Set the design resolution
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
// a bug in DirectX 11 level9-x on the device prevents ResolutionPolicy::NO_BORDER from working correctly
glview->setDesignResolutionSize(designResolutionSize.width designResolutionSize.height ResolutionPolicy::SHOW_ALL);
#else
glview->setDesignResolutionSize(designResolutionSize.width designResolutionSize.height ResolutionPolicy::NO_BORDER);
#endif
Size frameSize = glview->getframeSize();
vector searchPath;
// In this demo we select resource according to the frame‘s height.
// If the resource size is different from design resolution size you need to set contentScaleFactor.
// We use the ratio of resource‘s height to the height of design resolution
// this can make sure that the resource‘s height could fit for the height of design resolution.
// if the frame‘s height is larger than the height of medium resource size select large resource.
if (frameSize.height > mediumResource.size.height)
{
searchPath.push_back(largeResource.directory);
director->setContentScaleFactor(MIN(largeResource.size.height/designResolutionSize.height largeResource.size.width/designResolutionSize.width));
}
// if the frame‘s height is larger than the height of small resource size select medium resource.
else if (frameSize.height > smallResource.size.height)
{
searchPath.push_back(mediumResource.directory);
director->setContentScaleFactor(MIN(mediumResource.size.height/designResolutionSize.height mediumResource.size.width/designResolutionSize.width));
}
// if the frame‘s height is smaller than the height of medium resource size select small resource.
else
{
searchPath.push_back(smallResource.directory);
director->setContentScaleFactor(MIN(smallResource.size.height/designResolutionSize.height smallResource.size.width/designResolutionSize.width));
}
// set searching path
FileUtils::getInstance()->setSearchPaths(searchPath);
// 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);
// create a scene. it‘s an autorelease object
auto scene = Scene::create();
auto layer = Upgrade::create();
scene->addChild(layer);
// run
director->runWithScene(scene);
return true;
}
//
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3609 2014-07-28 08:40 Classes\AppDelegate.cpp
文件 947 2014-07-11 10:15 Classes\AppDelegate.h
文件 2732 2014-07-11 10:15 Classes\AppMacros.h
文件 3201 2014-07-28 09:00 Classes\HelloWorldScene.cpp
文件 594 2014-07-15 10:32 Classes\HelloWorldScene.h
文件 3908 2014-07-28 08:56 Classes\Upgrade.cpp
文件 884 2014-07-28 08:41 Classes\Upgrade.h
目录 0 2014-07-28 09:00 Classes\
相关资源
- micaps3.2的介绍
- PhysX3.2SDK地址.txt
- POSCMS3.2.18商业版完整源码带模块(仅
- polyfx v3.2最新建筑生长插件多边形粒子
- nexus3.22
- STM32 TFT3.2彩屏R61509V测试程序
- Blazemeter_v3.2.2
- 硒化卡拉胶 GB 1903.23-2016 食品安全国家
- 富硒食用菌粉 GB 1903.22-2016 食品安全国
- 富硒酵母 GB 1903.21-2016 食品安全国家标
- D-生物素 GB 1903.25-2016 食品安全国家标
- 维生素C磷酸酯镁 GB 1903.24-2016 食品安
- Optimized ScrollView Adapter-V3.2.unitypackage
- Redis3.2--64位
- Ext3.2中文API 最全最详细的文档
- extjs3.2.0 源码工程
- 用于客户端自动检测并更新的启动器
- SSD-Z V15.03.22 汉化版(固态硬盘检测使
- Tiled Map Editor(一)
- Tiled Map Editor(三)
- cocos2d-x3.10 翻页、翻牌效果的实现
- cocos2d-x游戏源码
- U盘修复工具3.2.rar
-
Nativexm
l 3.29 - SumatraPDF(pdf阅读器)v3.2.10593中文便携
- 802.11ax_D3.2
- ENVI_HJ1A1B_Tools V3.2.zip
- 医疗门诊小程序V3.2.3全开源完整安装
- 最新EasyUI-1.3.2中文版API
- 102、1290:采药《信息学奥赛一本通》
评论
共有 条评论