• 大小: 4.99M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-22
  • 语言: 其他
  • 标签: 其他  

资源简介

cpp-empty-test.zip

资源截图

代码片段和文件信息

#include “AppDelegate.h“

#include 
#include 

#include “HelloWorldScene.h“
#include “AppMacros.h“

USING_NS_CC;
using namespace std;

AppDelegate::AppDelegate() {

}

AppDelegate::~AppDelegate() 
{
}

void AppDelegate::initGLContextAttrs()
{
    GLContextAttrs glContextAttrs = {8 8 8 8 24 8};

    GLView::setGLContextAttrs(glContextAttrs);
}

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        glview = GLViewImpl::create(“Cpp Empty Test“);
        director->setOpenGLView(glview);
    }

    director->setOpenGLView(glview);

    // Set the design resolution
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
    // a bug in DirectX 11 level9-x on the device prevents ResolutionPolicy::NO_BORDER from working correctly
    glview->setDesignResolutionSize(designResolutionSize.width designResolutionSize.height ResolutionPolicy::SHOW_ALL);
#else
    glview->setDesignResolutionSize(designResolutionSize.width designResolutionSize.height ResolutionPolicy::NO_BORDER);
#endif

Size frameSize = glview->getframeSize();
    
    vector searchPath;

    // In this demo we select resource according to the frame‘s height.
    // If the resource size is different from design resolution size you need to set contentScaleFactor.
    // We use the ratio of resource‘s height to the height of design resolution
    // this can make sure that the resource‘s height could fit for the height of design resolution.

    // if the frame‘s height is larger than the height of medium resource size select large resource.
if (frameSize.height > mediumResource.size.height)
{
        searchPath.push_back(largeResource.directory);

        director->setContentScaleFactor(MIN(largeResource.size.height/designResolutionSize.height largeResource.size.width/designResolutionSize.width));
}
    // if the frame‘s height is larger than the height of small resource size select medium resource.
    else if (frameSize.height > smallResource.size.height)
    {
        searchPath.push_back(mediumResource.directory);
        
        director->setContentScaleFactor(MIN(mediumResource.size.height/designResolutionSize.height mediumResource.size.width/designResolutionSize.width));
    }
    // if the frame‘s height is smaller than the height of medium resource size select small resource.
else
    {
        searchPath.push_back(smallResource.directory);

        director->setContentScaleFactor(MIN(smallResource.size.height/designResolutionSize.height smallResource.size.width/designResolutionSize.width));
    }
    
    // set searching path
    FileUtils::getInstance()->setSearchPaths(searchPath);

    // 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.0 / 60);

    // create a scene. it‘s an autorelease object
 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-04-18 22:35  cpp-empty-test\
     文件        1417  2014-12-12 21:47  cpp-empty-test\.cocos-project.json
     目录           0  2015-04-19 01:42  cpp-empty-test\Classes\
     文件        3717  2014-12-12 21:47  cpp-empty-test\Classes\AppDelegate.cpp
     文件         991  2014-12-12 21:47  cpp-empty-test\Classes\AppDelegate.h
     文件        2732  2014-12-12 21:47  cpp-empty-test\Classes\AppMacros.h
     文件        3167  2015-04-19 16:04  cpp-empty-test\Classes\HelloWorldScene.cpp
     文件         775  2015-04-19 15:37  cpp-empty-test\Classes\HelloWorldScene.h
     文件        2387  2014-12-12 21:47  cpp-empty-test\CMakeLists.txt
     目录           0  2015-04-18 22:35  cpp-empty-test\proj-wp8-xaml\
     目录           0  2015-04-18 22:35  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\
     目录           0  2015-04-18 22:35  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Assets\
     文件        9042  2014-12-12 21:47  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Assets\AlignmentGrid.png
     文件        3392  2014-12-12 21:47  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Assets\ApplicationIcon.png
     目录           0  2015-04-18 22:35  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Assets\Tiles\
     文件        9930  2014-12-12 21:47  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Assets\Tiles\FlipCycleTileLarge.png
     文件        9070  2014-12-12 21:47  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Assets\Tiles\FlipCycleTileMedium.png
     文件        3674  2014-12-12 21:47  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Assets\Tiles\FlipCycleTileSmall.png
     文件        4937  2014-12-12 21:47  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Assets\Tiles\IconicTileMediumLarge.png
     文件        3724  2014-12-12 21:47  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Assets\Tiles\IconicTileSmall.png
     文件        8046  2014-12-12 21:47  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\cpp-empty-test.csproj
     文件         344  2014-12-12 21:47  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\LocalizedStrings.cs
     文件        2212  2014-12-12 21:47  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Package.appxmanifest
     目录           0  2015-04-18 22:35  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Properties\
     文件         201  2014-12-12 21:47  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Properties\AppManifest.xml
     文件        1429  2014-12-12 21:47  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Properties\AssemblyInfo.cs
     文件        1984  2014-12-12 21:47  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Properties\WMAppManifest.xml
     目录           0  2015-04-18 22:35  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Resources\
     文件        3083  2014-12-12 21:47  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Resources\AppResources.Designer.cs
     文件        5796  2014-12-12 21:47  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\Resources\AppResources.resx
     文件      119747  2014-12-12 21:47  cpp-empty-test\proj-wp8-xaml\cpp-empty-test\SplashScreenImage.jpg
............此处省略126个文件信息

评论

共有 条评论