资源简介

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.xml

     目录          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个文件信息

评论

共有 条评论