• 大小: 3.99MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-12
  • 语言: 其他
  • 标签: cocos2dx  c++  三消  

资源简介

cocos2dx写的经典三消小游戏,实现了完整的消除,移动,下降填充,combo等逻辑

资源截图

代码片段和文件信息

#include “app_delegate.h“
#include “menu_scene.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);

// 竖直分辨率
static cocos2d::Size designResolutionSize = cocos2d::Size(320 480);
static cocos2d::Size smallResolutionSize = cocos2d::Size(320 480);
static cocos2d::Size mediumResolutionSize = cocos2d::Size(768 1024);
static cocos2d::Size largeResolutionSize = cocos2d::Size(1536 2048);


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: redgreenbluealphadepthstencil
    GLContextAttrs glContextAttrs = {8 8 8 8 24 8};

    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_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
        glview = GLViewImpl::createWithRect(“MyEliminateGame“ cocos2d::Rect(0 0 designResolutionSize.width designResolutionSize.height));
#else
        glview = GLViewImpl::create(“MyEliminateGame“);
#endif
        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.0f / 60);

    // Set the design resolution
    glview->setDesignResolutionSize(designResolutionSize.width designResolutionSize.height ResolutionPolicy::NO_BORDER);
    auto frameSize = glview->getframeSize();
    // if the frame‘s height is larger than the height of medium size.
    if (frameSize.height > mediumResolutionSize.height)
    {        
        director->se

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-07-18 11:13  MyEliminateGame\
     目录           0  2018-07-18 11:12  MyEliminateGame\Classes\
     文件        4765  2018-06-29 09:16  MyEliminateGame\Classes\app_delegate.cpp
     文件         981  2018-06-21 09:20  MyEliminateGame\Classes\app_delegate.h
     文件         844  2018-07-13 09:50  MyEliminateGame\Classes\element.cpp
     文件         384  2018-07-13 09:47  MyEliminateGame\Classes\element.h
     文件       27365  2018-07-18 09:36  MyEliminateGame\Classes\game_scene.cpp
     文件        2389  2018-07-17 11:29  MyEliminateGame\Classes\game_scene.h
     文件        1502  2018-07-12 13:37  MyEliminateGame\Classes\menu_scene.cpp
     文件         275  2018-06-29 09:11  MyEliminateGame\Classes\menu_scene.h
     文件        8646  2018-06-21 09:20  MyEliminateGame\CMakeLists.txt
     目录           0  2018-07-18 11:12  MyEliminateGame\proj.android\
     目录           0  2018-07-18 11:12  MyEliminateGame\proj.android-studio\
     文件         121  2018-06-21 09:20  MyEliminateGame\proj.android-studio\.gitignore
     目录           0  2018-07-18 11:12  MyEliminateGame\proj.android-studio\app\
     文件          31  2018-06-21 09:20  MyEliminateGame\proj.android-studio\app\.gitignore
     文件        1218  2018-06-21 09:20  MyEliminateGame\proj.android-studio\app\AndroidManifest.xml
     文件        3313  2018-06-21 09:20  MyEliminateGame\proj.android-studio\app\build.gradle
     目录           0  2018-07-18 11:12  MyEliminateGame\proj.android-studio\app\jni\
     文件         934  2018-06-21 09:20  MyEliminateGame\proj.android-studio\app\jni\Android.mk
     文件         338  2018-06-21 09:20  MyEliminateGame\proj.android-studio\app\jni\Application.mk
     目录           0  2018-07-18 11:12  MyEliminateGame\proj.android-studio\app\jni\hellocpp\
     文件         393  2018-06-21 09:20  MyEliminateGame\proj.android-studio\app\jni\hellocpp\main.cpp
     文件         678  2018-06-21 09:20  MyEliminateGame\proj.android-studio\app\proguard-rules.pro
     目录           0  2018-07-18 11:12  MyEliminateGame\proj.android-studio\app\res\
     目录           0  2018-07-18 11:12  MyEliminateGame\proj.android-studio\app\res\mipmap-hdpi\
     文件       22975  2018-06-21 09:20  MyEliminateGame\proj.android-studio\app\res\mipmap-hdpi\ic_launcher.png
     目录           0  2018-07-18 11:12  MyEliminateGame\proj.android-studio\app\res\mipmap-mdpi\
     文件       19756  2018-06-21 09:20  MyEliminateGame\proj.android-studio\app\res\mipmap-mdpi\ic_launcher.png
     目录           0  2018-07-18 11:12  MyEliminateGame\proj.android-studio\app\res\mipmap-xhdpi\
     文件       26514  2018-06-21 09:20  MyEliminateGame\proj.android-studio\app\res\mipmap-xhdpi\ic_launcher.png
............此处省略118个文件信息

评论

共有 条评论