varcocos2dApp = cc.Application.extend(
{
config : document['ccConfig'],
ctor :function(scene)
{this._super();this.startScene = scene;
cc.COCOS2D_DEBUG =this.config['COCOS2D_DEBUG'];
cc.initDebugSetting();
cc.setup(this.config['tag']);
cc.AppController.shareAppController().didFinishLaunchingWithOptions();
},
applicationDidFinishLaunching :function()
{// initialize directorvardirector = cc.Director.getInstance();varscreenSize = cc.EGLView.getInstance().getFrameSize();varresourceSize = cc.size(800,450);vardesignSize = cc.size(800,450);varsearchPaths = [];varresDirOrders = [];
searchPaths.push("res");
cc.FileUtils.getInstance().setSearchPaths(searchPaths);varplatform = cc.Application.getInstance().getTargetPlatform();if(platform == cc.TARGET_PLATFORM.MOBILE_BROWSER)
{if(screenSize.height >450)
{
resDirOrders.push("HD");
}else{
resourceSize = cc.size(400,225);
designSize = cc.size(400,225);
resDirOrders.push("Normal");
}
}else if(platform == cc.TARGET_PLATFORM.PC_BROWSER)
{
resDirOrders.push("HD");
}
cc.FileUtils.getInstance().setSearchResolutionsOrder(resDirOrders);
director.setContentScaleFactor(resourceSize.width / designSize.width);
cc.EGLView.getInstance().setDesignResolutionSize(designSize.width, designSize.height, cc.RESOLUTION_POLICY.SHOW_ALL);// turn on display FPSdirector.setDisplayStats(this.config['showFPS']);// set FPS. the default value is 1.0/60 if you don't call thisdirector.setAnimationInterval(1.0/this.config['frameRate']);//load resourcescc.LoaderScene.preload(g_ressources,function()
{
director.replaceScene(newthis.startScene());
},this);return true;
}
}
);varmyApp =newcocos2dApp(MyScene);