Merge pull request #14283 from pandamicro/v3

Improve js templates with noCache and cc.view.setRealPixelResolution docs
This commit is contained in:
pandamicro 2015-11-01 18:49:47 +08:00
commit be02cbdf2c
6 changed files with 22 additions and 5 deletions

View File

@ -22,6 +22,10 @@
"frameRate" : 60, "frameRate" : 60,
// "frameRate" set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment. // "frameRate" set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.
"noCache" : false,
// Set "noCache" to true can make the loader ignoring the html page cache while loading your resources,
// especially useful in Android web browsers.
"id" : "gameCanvas", "id" : "gameCanvas",
// "gameCanvas" sets the id of your canvas element on the web page, it's useful only on web. // "gameCanvas" sets the id of your canvas element on the web page, it's useful only on web.
@ -51,12 +55,15 @@ cc.game.onStart = function(){
if(!cc.sys.isNative && document.getElementById("cocosLoading")) //If referenced loading.js, please remove it if(!cc.sys.isNative && document.getElementById("cocosLoading")) //If referenced loading.js, please remove it
document.body.removeChild(document.getElementById("cocosLoading")); document.body.removeChild(document.getElementById("cocosLoading"));
// Pass true to enable retina display, disabled by default to improve performance // Pass true to enable retina display, on Android disabled by default to improve performance
cc.view.enableRetina(false); cc.view.enableRetina(cc.sys.os === cc.sys.OS_IOS ? true : false);
// Adjust viewport meta // Adjust viewport meta
cc.view.adjustViewPort(true); cc.view.adjustViewPort(true);
// Setup the resolution policy and design resolution size // Setup the resolution policy and design resolution size
cc.view.setDesignResolutionSize(800, 450, cc.ResolutionPolicy.SHOW_ALL); cc.view.setDesignResolutionSize(800, 450, cc.ResolutionPolicy.SHOW_ALL);
// Instead of set design resolution, you can also set the real pixel resolution size
// Uncomment the following line and delete the previous line.
// cc.view.setRealPixelResolution(960, 640, cc.ResolutionPolicy.SHOW_ALL);
// The game will be resized when browser size change // The game will be resized when browser size change
cc.view.resizeWithBrowserSize(true); cc.view.resizeWithBrowserSize(true);
//load resources //load resources

View File

@ -4,6 +4,7 @@
"debugMode" : 1, "debugMode" : 1,
"showFPS" : true, "showFPS" : true,
"frameRate" : 60, "frameRate" : 60,
"noCache" : false,
"id" : "gameCanvas", "id" : "gameCanvas",
"renderMode" : 0, "renderMode" : 0,
"engineDir":"frameworks/cocos2d-html5", "engineDir":"frameworks/cocos2d-html5",

View File

@ -22,6 +22,10 @@
"frameRate" : 60, "frameRate" : 60,
// "frameRate" set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment. // "frameRate" set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.
"noCache" : false,
// Set "noCache" to true can make the loader ignoring the html page cache while loading your resources,
// especially useful in Android web browsers.
"id" : "gameCanvas", "id" : "gameCanvas",
// "gameCanvas" sets the id of your canvas element on the web page, it's useful only on web. // "gameCanvas" sets the id of your canvas element on the web page, it's useful only on web.
@ -51,12 +55,15 @@ cc.game.onStart = function(){
if(!cc.sys.isNative && document.getElementById("cocosLoading")) //If referenced loading.js, please remove it if(!cc.sys.isNative && document.getElementById("cocosLoading")) //If referenced loading.js, please remove it
document.body.removeChild(document.getElementById("cocosLoading")); document.body.removeChild(document.getElementById("cocosLoading"));
// Pass true to enable retina display, disabled by default to improve performance // Pass true to enable retina display, on Android disabled by default to improve performance
cc.view.enableRetina(false); cc.view.enableRetina(cc.sys.os === cc.sys.OS_IOS ? true : false);
// Adjust viewport meta // Adjust viewport meta
cc.view.adjustViewPort(true); cc.view.adjustViewPort(true);
// Setup the resolution policy and design resolution size // Setup the resolution policy and design resolution size
cc.view.setDesignResolutionSize(960, 640, cc.ResolutionPolicy.SHOW_ALL); cc.view.setDesignResolutionSize(960, 640, cc.ResolutionPolicy.SHOW_ALL);
// Instead of set design resolution, you can also set the real pixel resolution size
// Uncomment the following line and delete the previous line.
// cc.view.setRealPixelResolution(960, 640, cc.ResolutionPolicy.SHOW_ALL);
// The game will be resized when browser size change // The game will be resized when browser size change
cc.view.resizeWithBrowserSize(true); cc.view.resizeWithBrowserSize(true);
//load resources //load resources

View File

@ -4,6 +4,7 @@
"debugMode" : 1, "debugMode" : 1,
"showFPS" : true, "showFPS" : true,
"frameRate" : 60, "frameRate" : 60,
"noCache" : false,
"id" : "gameCanvas", "id" : "gameCanvas",
"renderMode" : 0, "renderMode" : 0,
"engineDir":"frameworks/cocos2d-html5", "engineDir":"frameworks/cocos2d-html5",

View File

@ -2,6 +2,7 @@
"debugMode" : 1, "debugMode" : 1,
"showFPS" : true, "showFPS" : true,
"frameRate" : 60, "frameRate" : 60,
"noCache" : false,
"id" : "gameCanvas", "id" : "gameCanvas",
"renderMode" : 0, "renderMode" : 0,
"engineDir" : "../../web/", "engineDir" : "../../web/",

2
web

@ -1 +1 @@
Subproject commit c0242a98fb49681b053438a55f8eb15e56682b5d Subproject commit 8737f56bda7e73233ecca06369134bc83c4fa008