资源简介
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
相关资源
- flash3.0小游戏
- Scrach 欢乐狙击手.sb2
- 随机森林R语言代码
- 计算机图形学 边填充算法实现代码
- 直流无刷电机方波驱动 stm32 例程代码
- 仿知乎界面小程序源代码
- 贪吃蛇源代码.fla
- 周立功开发板ProASIC3实验-syn_FIFO代码
- IMX385驱动代码.zip
- dotnet 写字板 实验 源代码 不好请要不
- 图像二维小波变换的实现源代码
- 八三编码器设计 VHDL代码 简单,包附
- linux应用层的华容道游戏源代码
- 交通咨询模拟系统完整代码
- http请求状态代码
- 数值分析所有实验代码
- 网上拍卖系统完整源代码
- 音乐代码转换软件 单片机编程时用
- CSMA/CD等动画演示加源代码
- silicon lab公司的收音IC SI47XX全套开发工
- 用51单片机实现G代码翻译
- 合同管理系统的源代码(附数据库)
- 用VC 编写的仿QQ聊天室程序源代码
- web班级网站设计代码
- 38k单片机红外发送代码、keil
- 小鸡快跑游戏.
- STM32F103 串口程序(完整版)
- 网络唤醒代码
- VPC3_DPV1源代码,Profibus
- PB做的托盘程序(最小化后在左下角显
评论
共有 条评论