2015-04-16 18:07:35 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2010-2012 cocos2d-x.org
|
|
|
|
Copyright (c) 2008-2010 Ricardo Quesada
|
|
|
|
Copyright (c) 2011 Zynga Inc.
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A brief explanation for "project.json":
|
|
|
|
* Here is the content of project.json file, this is the global configuration for your game, you can modify it to customize some behavior.
|
|
|
|
* The detail of each field is under it.
|
|
|
|
{
|
|
|
|
"debugMode" : 1,
|
|
|
|
// "debugMode" possible values :
|
|
|
|
// 0 - No message will be printed.
|
|
|
|
// 1 - cc.error, cc.assert, cc.warn, cc.log will print in console.
|
|
|
|
// 2 - cc.error, cc.assert, cc.warn will print in console.
|
|
|
|
// 3 - cc.error, cc.assert will print in console.
|
|
|
|
// 4 - cc.error, cc.assert, cc.warn, cc.log will print on canvas, available only on web.
|
|
|
|
// 5 - cc.error, cc.assert, cc.warn will print on canvas, available only on web.
|
|
|
|
// 6 - cc.error, cc.assert will print on canvas, available only on web.
|
|
|
|
|
|
|
|
"showFPS" : true,
|
|
|
|
// Left bottom corner fps information will show when "showFPS" equals true, otherwise it will be hide.
|
|
|
|
|
|
|
|
"frameRate" : 60,
|
|
|
|
// "frameRate" set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.
|
2015-11-24 16:31:14 +08:00
|
|
|
|
|
|
|
"noCache" : false,
|
|
|
|
// "noCache" set whether your resources will be loaded with a timestamp suffix in the url.
|
|
|
|
// In this way, your resources will be force updated even if the browser holds a cache of it.
|
|
|
|
// It's very useful for mobile browser debuging.
|
2015-04-16 18:07:35 +08:00
|
|
|
|
|
|
|
"id" : "gameCanvas",
|
|
|
|
// "gameCanvas" sets the id of your canvas element on the web page, it's useful only on web.
|
|
|
|
|
|
|
|
"renderMode" : 0,
|
|
|
|
// "renderMode" sets the renderer type, only useful on web :
|
|
|
|
// 0 - Automatically chosen by engine
|
|
|
|
// 1 - Forced to use canvas renderer
|
|
|
|
// 2 - Forced to use WebGL renderer, but this will be ignored on mobile browsers
|
|
|
|
|
|
|
|
"engineDir" : "../../frameworks/cocos2d-html5/",
|
|
|
|
// In debug mode, if you use the whole engine to develop your game, you should specify its relative path with "engineDir",
|
|
|
|
// but if you are using a single engine file, you can ignore it.
|
|
|
|
|
|
|
|
"modules" : ["cocos2d", "extensions", "external"],
|
|
|
|
// "modules" defines which modules you will need in your game, it's useful only on web,
|
|
|
|
// using this can greatly reduce your game's resource size, and the cocos console tool can package your game with only the modules you set.
|
|
|
|
// For details about modules definitions, you can refer to "../../frameworks/cocos2d-html5/modulesConfig.json".
|
|
|
|
|
|
|
|
"plugin": {
|
|
|
|
"facebook": {
|
|
|
|
"appId" : "1426774790893461",
|
|
|
|
"xfbml" : true,
|
|
|
|
"version" : "v2.0"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// "plugin" is used by plugin-x for its settings, if you don't use it, you can ignore it.
|
|
|
|
|
|
|
|
"jsList" : [
|
|
|
|
]
|
|
|
|
// "jsList" sets the list of js files in your game.
|
|
|
|
}
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
if(cc.sys){
|
|
|
|
var scene3SearchPaths = cc.sys.localStorage.getItem("Scene3SearchPaths");
|
|
|
|
if (scene3SearchPaths)
|
|
|
|
jsb.fileUtils.setSearchPaths(JSON.parse(scene3SearchPaths));
|
|
|
|
}
|
|
|
|
|
|
|
|
cc.game.onStart = function(){
|
|
|
|
cc.view.enableRetina(false);
|
|
|
|
if (cc.sys.isNative) {
|
|
|
|
var resolutionPolicy = (cc.sys.os == cc.sys.OS_WP8 || cc.sys.os == cc.sys.OS_WINRT) ? cc.ResolutionPolicy.SHOW_ALL : cc.ResolutionPolicy.FIXED_HEIGHT;
|
|
|
|
cc.view.setDesignResolutionSize(800, 450, resolutionPolicy);
|
|
|
|
cc.view.resizeWithBrowserSize(true);
|
|
|
|
var searchPaths = jsb.fileUtils.getSearchPaths();
|
|
|
|
searchPaths.push('script');
|
|
|
|
searchPaths.push('src');
|
|
|
|
var paths = [
|
2015-06-12 18:21:07 +08:00
|
|
|
'res/resjs',
|
2015-04-16 18:07:35 +08:00
|
|
|
'res',
|
|
|
|
'res/scenetest',
|
|
|
|
'res/scenetest/ArmatureComponentTest',
|
|
|
|
'res/scenetest/AttributeComponentTest',
|
|
|
|
'res/scenetest/BackgroundComponentTest',
|
|
|
|
'res/scenetest/EffectComponentTest',
|
|
|
|
'res/scenetest/LoadSceneEdtiorFileTest',
|
|
|
|
'res/scenetest/ParticleComponentTest',
|
|
|
|
'res/scenetest/SpriteComponentTest',
|
|
|
|
'res/scenetest/TmxMapComponentTest',
|
|
|
|
'res/scenetest/UIComponentTest',
|
|
|
|
'res/scenetest/TriggerTest'
|
|
|
|
];
|
|
|
|
for (var i = 0; i < paths.length; i++) {
|
|
|
|
searchPaths.push(paths[i]);
|
|
|
|
}
|
|
|
|
jsb.fileUtils.setSearchPaths(searchPaths);
|
|
|
|
}
|
2015-05-05 10:50:19 +08:00
|
|
|
else
|
|
|
|
{
|
2015-12-03 16:55:15 +08:00
|
|
|
cc.view.setDesignResolutionSize(800, 450, cc.ResolutionPolicy.SHOW_ALL);
|
|
|
|
cc.view.resizeWithBrowserSize(true);
|
2015-08-10 15:10:54 +08:00
|
|
|
// js-test use cpptest resource in debug mode , and in the release mode, console will copy the resource into the res dir
|
|
|
|
// so the respath will modify to res,
|
|
|
|
if (cc.game.config[cc.game.CONFIG_KEY.engineDir] !== "frameworks/cocos2d-html5") {
|
|
|
|
cc.loader.resPath = '../cpp-tests/Resources';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
cc.loader.resPath = 'res';
|
|
|
|
document.getElementById("cocosbanner").src = "res/Images/cocos2dbanner.png";
|
|
|
|
}
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
|
2015-04-16 18:07:35 +08:00
|
|
|
cc.LoaderScene.preload(g_resources, function () {
|
|
|
|
if(window.sideIndexBar && typeof sideIndexBar.start === 'function'){
|
|
|
|
sideIndexBar.start();
|
|
|
|
}else{
|
|
|
|
var scene = new cc.Scene();
|
|
|
|
scene.addChild(new TestController());
|
|
|
|
cc.director.runScene(scene);
|
|
|
|
}
|
|
|
|
}, this);
|
|
|
|
};
|
|
|
|
cc.game.run();
|