• 大小: 4.81MB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2023-09-28
  • 语言: 其他
  • 标签: Cocos2d-x  

资源简介

Cocos2d-x项目实战-射击类游戏-迷失航线,版本是Cocos2d-x-3.2

资源截图

代码片段和文件信息

#include “AppDelegate.h“
#include “HelloWorldScene.h“

USING_NS_CC;

AppDelegate::AppDelegate() 
{

}

AppDelegate::~AppDelegate() 
{

}

bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLView::create(“My Game“);
glview->setframeSize(320 480);
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);

//屏幕大小
auto screenSize = glview->getframeSize();

    
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) //WP8平台下width和height反了
if (screenSize.width > screenSize.height) {
glview->setframeSize(screenSize.height screenSize.width);
screenSize = glview->getframeSize();
}
#endif
    
//设计分辨率大小
auto designSize = Size(320 480);
//资源大小
auto resourceSize = Size(640 960);

std::vector searchPaths;

if (screenSize.height > 960) { //640x1136
designSize = Size(320 568);
searchPaths.push_back(“hd“);
} else {
searchPaths.push_back(“hd“);
}

director->setContentScaleFactor(resourceSize.width/designSize.width); //默认为1.0f

FileUtils::getInstance()->setSearchPaths(searchPaths);

glview->setDesignResolutionSize(designSize.width designSize.height ResolutionPolicy::FIXED_WIDTH);

// create a scene. it‘s an autorelease object
auto scene = HelloWorld::createScene();

// run
director->runWithScene(scene);


return true;
}

// This function will be called when the app is inactive. When comes a phone callit‘s be invoked too
void AppDelegate::applicationDidEnterBackground() {
Director::getInstance()->stopAnimation();

// if you use SimpleAudioEngine it must be pause
SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
}

// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground() {
Director::getInstance()->startAnimation();

// if you use SimpleAudioEngine it must resume here
SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2269  2014-11-26 10:27  LostRoutes_final(3.2)\Classes\AppDelegate.cpp

     文件       1284  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\AppDelegate.h

     文件       1857  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\baselayer.cpp

     文件        776  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\baselayer.h

     文件       1230  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\Bullet.cpp

     文件        727  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\Bullet.h

     文件       2818  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\Enemy.cpp

     文件       1487  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\Enemy.h

     文件       1742  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\Fighter.cpp

     文件        748  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\Fighter.h

     文件       2751  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\GameOverScene.cpp

     文件        387  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\GameOverScene.h

     文件      14531  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\GamePlayScene.cpp

     文件       2423  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\GamePlayScene.h

     文件       4333  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\HelloWorldScene.cpp

     文件       1160  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\HelloWorldScene.h

     文件       3925  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\HelpScene.cpp

     文件        925  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\HelpScene.h

     文件       3597  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\HomeScene.cpp

     文件       1150  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\HomeScene.h

     文件       1982  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\MyUtility.cpp

     文件        314  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\MyUtility.h

     文件       3676  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\SettingScene.cpp

     文件       1049  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\SettingScene.h

     文件       1146  2014-11-26 10:28  LostRoutes_final(3.2)\Classes\SystemHeader.h

     文件    4194692  2014-11-26 10:35  LostRoutes_final(3.2)\Resources\fonts\hanyi.ttf

     文件      25776  2014-11-26 10:35  LostRoutes_final(3.2)\Resources\fonts\Marker Felt.ttf

     文件        454  2014-11-26 10:44  LostRoutes_final(3.2)\Resources\hd\map\blue_bg.tmx

     文件       3184  2014-11-26 10:44  LostRoutes_final(3.2)\Resources\hd\map\blue_tiles.png

     文件        454  2014-11-26 10:44  LostRoutes_final(3.2)\Resources\hd\map\red_bg.tmx

............此处省略33个文件信息

评论

共有 条评论