资源简介
cocos2dx 3.17 写的2048游戏,开发语言是C++,使用windows10+VS2017开发,楼主测试可以编译安卓apk,只上传了class和resource文件夹,大家自己新建个项目添加进去吧。
已知bug:
连续快速移动方块数字会变大,正常使用不会,应该是动画没做判断

代码片段和文件信息
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co. Ltd.
http://www.cocos2d-x.org
Permission is hereby granted free of charge to any person obtaining a copy
of this software and associated documentation files (the “Software“) to deal
in the Software without restriction including without limitation the rights
to use copy modify merge publish distribute sublicense and/or sell
copies of the Software and to permit persons to whom the Software is
furnished to do so subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER
LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include “AppDelegate.h“
#include “HelloWorldScene.h“
// #define USE_AUDIO_ENGINE 1
// #define USE_SIMPLE_AUDIO_ENGINE 1
#if USE_AUDIO_ENGINE && USE_SIMPLE_AUDIO_ENGINE
#error “Don‘t use AudioEngine and SimpleAudioEngine at the same time. Please just select one in your game!“
#endif
#if USE_AUDIO_ENGINE
#include “audio/include/AudioEngine.h“
using namespace cocos2d::experimental;
#elif USE_SIMPLE_AUDIO_ENGINE
#include “audio/include/SimpleAudioEngine.h“
using namespace CocosDenshion;
#endif
USING_NS_CC;
static cocos2d::Size designResolutionSize = cocos2d::Size(480 320);
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 USE_AUDIO_ENGINE
AudioEngine::end();
#elif USE_SIMPLE_AUDIO_ENGINE
SimpleAudioEngine::end();
#endif
}
// if you want a different context modify the value of glContextAttrs
// it will affect all platforms
void AppDelegate::initGLContextAttrs()
{
// set OpenGL context attributes: redgreenbluealphadepthstencilmultisamplesCount
GLContextAttrs glContextAttrs = {8 8 8 8 24 8 0};
GLView::setGLContextAttrs(glContextAttrs);
}
// if you want to use the package 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_PLATFO
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5743 2018-07-02 23:40 Classes\AppDelegate.cpp
文件 2225 2018-07-02 09:19 Classes\AppDelegate.h
文件 3567 2018-07-02 23:42 Classes\Card.cpp
文件 819 2018-07-02 22:50 Classes\Card.h
文件 14114 2018-07-19 16:35 Classes\HelloWorldScene.cpp
文件 2898 2018-07-19 14:52 Classes\HelloWorldScene.h
文件 5400 2018-07-18 09:57 Classes\MyMsgBox.cpp
文件 1792 2018-07-19 09:37 Classes\MyMsgBox.h
文件 586 2018-07-19 09:25 Classes\RecordManager.cpp
文件 258 2018-07-19 09:25 Classes\RecordManager.h
文件 729 2018-07-02 20:36 Classes\StringManager.cpp
文件 386 2018-07-02 20:16 Classes\StringManager.h
文件 3596 2018-07-02 09:19 Resources\CloseNormal.png
文件 2810 2018-07-02 09:19 Resources\CloseSelected.png
文件 778552 2018-07-02 09:19 Resources\fonts\arial.ttf
文件 25776 2018-07-02 09:19 Resources\fonts\Marker Felt.ttf
文件 37864 2018-07-02 09:19 Resources\HelloWorld.png
文件 3890 2018-06-20 16:48 Resources\music\effect\move.mp3
文件 1566 2018-07-02 16:04 Resources\pic\btn\msgbk.png
文件 2871 2018-07-17 20:26 Resources\pic\btn\msgcancel.png
文件 2492 2018-07-17 20:26 Resources\pic\btn\msgno.png
文件 2786 2018-07-17 20:26 Resources\pic\btn\msgok.png
文件 0 2018-07-02 09:19 Resources\res\.gitkeep
文件 151 2018-07-02 20:39 Resources\string\string.xm
目录 0 2018-07-02 11:33 Resources\music\effect
目录 0 2018-07-19 09:35 Resources\pic\btn
目录 0 2018-07-02 09:19 Resources\fonts
目录 0 2018-07-02 11:33 Resources\music
目录 0 2018-07-02 16:04 Resources\pic
目录 0 2018-07-02 09:19 Resources\res
............此处省略6个文件信息
- 上一篇:计算机组成原理booth算法C源码
- 下一篇:打印出有向图中的所有环C++
相关资源
- 国际象棋的qt源代码
- C++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- VC++MFC小游戏实例教程(实例)+MFC类库
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
- 嵌入式QtC++编程课件
- 颜色识别形状识别STM103嵌入式代码
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
- mfc 调用redis
- FTP客户端源码(c++)
- c++ 画图(14Qt-XPS)
- c++多边形交并差运算
评论
共有 条评论