资源简介
cocos2d-x 2048小游戏源码+素材
代码片段和文件信息
#include “AppDelegate.h“
#include “SplashScene.h“
USING_NS_CC;
static cocos2d::Size designResolutionSize = cocos2d::Size(320 480);
static cocos2d::Size smallResolutionSize = cocos2d::Size(480 320);
static cocos2d::Size mediumResolutionSize = cocos2d::Size(1024 768);
static cocos2d::Size largeResolutionSize = cocos2d::Size(2048 1536);
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) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
glview = GLViewImpl::createWithRect(“Game2048“ Rect(0 0 designResolutionSize.width designResolutionSize.height));
#else
glview = GLViewImpl::create(“Game2048“);
#endif
director->setOpenGLView(glview);
}
// turn on display FPS
director->setDisplayStats(false);
// set FPS. the default value is 1.0/60 if you don‘t call this
director->setAnimationInterval(1.0 / 60);
// Set the design resolution
glview->setDesignResolutionSize(designResolutionSize.width designResolutionSize.height ResolutionPolicy::EXACT_FIT);
Size frameSize = glview->getframeSize();
// if the frame‘s height is larger than the height of medium size.
if (frameSize.height > mediumResolutionSize.height)
{
director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height largeResolutionSize.width/designResolutionSize.width));
}
// if the frame‘s height is larger than the height of small size.
else if (frameSize.height > smallResolutionSize.height)
{
director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height mediumResolutionSize.width/designResolutionSize.width));
}
// if the frame‘s height is smaller than the height of medium size.
else
{
director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height smallResolutionSize.width/designResolutionSize.width));
}
register_all_packages();
// create a scene. it‘s an autorelease object
auto scene = SplashScene::createScene();
// run
director->runWithScene(scene);
return true;
}
// This function will be
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3585 2017-05-15 14:56 Classes\AppDelegate.cpp
文件 987 2017-05-13 15:17 Classes\AppDelegate.h
文件 320 2017-05-13 20:39 Classes\GameDefine.h
文件 1454 2017-05-15 07:48 Classes\GameOver.cpp
文件 328 2017-05-14 22:26 Classes\GameOver.h
文件 10793 2017-05-15 13:42 Classes\GameScene.cpp
文件 773 2017-05-15 12:27 Classes\GameScene.h
文件 3058 2017-05-15 15:02 Classes\MoveTiled.cpp
文件 450 2017-05-15 12:27 Classes\MoveTiled.h
文件 1959 2017-05-15 15:06 Classes\SplashScene.cpp
文件 362 2017-05-13 18:26 Classes\SplashScene.h
文件 3596 2017-05-13 15:17 Resources\CloseNormal.png
文件 2810 2017-05-13 15:17 Resources\CloseSelected.png
文件 778552 2017-05-13 15:17 Resources\fonts\arial.ttf
文件 12762 2013-09-21 15:45 Resources\fonts\futura-48.fnt
文件 178532 2013-09-21 15:45 Resources\fonts\futura-48.png
文件 25776 2017-05-13 15:17 Resources\fonts\Marker Felt.ttf
文件 37864 2017-05-13 15:17 Resources\HelloWorld.png
文件 0 2017-05-13 15:17 Resources\res\.gitkeep
文件 1845418 2004-02-19 17:45 Resources\sound\bg.mp3
文件 3896 2001-02-14 08:25 Resources\sound\dodge1.wav
文件 7820 2002-02-20 19:41 Resources\sound\magic.WAV
文件 207 2017-05-13 17:10 Resources\strings.xm
目录 0 2017-05-13 17:08 Resources\fonts
目录 0 2017-05-13 15:17 Resources\res
目录 0 2017-05-15 12:37 Resources\sound
目录 0 2017-05-15 14:42 Classes
目录 0 2017-05-15 12:08 Resources
----------- --------- ---------- ----- ----
2921302 28
............此处省略1个文件信息
- 上一篇:STM32F103+MC20GRPS源码
- 下一篇:three.js 导入fbx
相关资源
- 双二阶广义积分器SOGI软件锁相(基于
- TMF8801驱动参考代码
- 代码项目“生成”微博、知乎、
- ARM9指令cache的verilog代码
- STM32+TMC5160代码电路图.rar
- 压缩感知常见测量矩阵一维仿真信号
- 很久以前的MUD游戏源码和mudos
- pppd2.4.7源代码以及拨号脚本
- Apache Subversion1.10.3服务端SVN
- ARM7TDMI-S在嵌入式系统中的Bootloader代码
- 基于Sun技术创建世界级游戏的安全架
- 酒店预订管理系统源代码
- 酷冷至尊开阳星游戏鼠标驱动 v1.08 官
- Xyratex欲部分收购Ario的RAID代码
- 迪龙游戏手柄驱动 v6.0.0.619 绿色免费
- Marvell 88W8686 WiFi模块的ADHOC热点创建代
- 机会路由源代码+仿真工具(SCORP)
- 批量替换证件照片的底色(含源代码
- cocos2d-x飞机大战项目
- 编译原理实验:词法分析,语法分析
- 40款h5游戏+21款热门测试吸粉
- 分享一个远程控制软件源代码
- BLE-CC254x-1.3.2 蓝牙官方源代码
- createKeep
- 使用delphi+intraweb进行微信开发1~4代码
- 基于Freemarker模板的代码生成器后台代
- Ubuntu下操作Excel,qt代码
- 代码之美高清中文版,强烈推荐!
- opencl编程指南随书代码
- 初学Visual Basic 2010代码
评论
共有 条评论