Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions plugins/Community_Basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
* @plugindesc Basic plugin for manipulating important parameters..
* @author RM CoreScript team
*
* @help
* Basic plugin for manipulating important parameters..
* There is no plugin command.
*
* @param cacheLimit
* @desc The upper limit of images' cached size (MPixel)
* @default 20
Expand All @@ -14,6 +18,16 @@
* @desc The resolution of screen height
* @default 624
*
* @param windowScaleFactor
* @desc Scale window to (screen size * value).
* @default 1
*
* @param changeWindowWidthTo
* @desc If set, change window width to this value
*
* @param changeWindowHeightTo
* @desc If set, change window height to this value
*
* @param renderingMode
* @desc The rendering mode (canvas/webgl/auto)
* @default auto
Expand All @@ -27,6 +41,10 @@
* @plugindesc 基本的なパラメーターを設定するプラグインです。
* @author RM CoreScript team
*
* @help
* 基本的なパラメーターを設定するプラグインです。
* このプラグインにはプラグインコマンドはありません。
*
* @param cacheLimit
* @desc 画像のメモリへのキャッシュの上限値 (MPix)
* @default 20
Expand All @@ -39,6 +57,16 @@
* @desc 画面サイズの高さ
* @default 624
*
* @param windowScaleFactor
* @desc ウインドウを、画面サイズの指定された値分拡大・縮小します
* @default 1
*
* @param changeWindowWidthTo
* @desc 値が設定された場合、ウインドウの幅を指定した値に変更
*
* @param changeWindowHeightTo
* @desc 値が設定された場合、ウインドウの高さを指定した値に変更
*
* @param renderingMode
* @desc レンダリングモード (canvas/webgl/auto)
* @default auto
Expand All @@ -55,10 +83,33 @@

var parameters = PluginManager.parameters('Community_Basic');
var cacheLimit = toNumber(parameters['cacheLimit'], 20);
var scaleFactor = toNumber(parameters['windowScaleFactor'], 1);
var screenWidth = toNumber(parameters['screenWidth'], 816);
var screenHeight = toNumber(parameters['screenHeight'], 624);
var renderingMode = parameters['renderingMode'].toLowerCase();
var alwaysDash = parameters['alwaysDash'].toLowerCase() === 'on';
var windowWidthTo = toNumber(parameters['changeWindowWidthTo'], 0);
var windowHeightTo = toNumber(parameters['changeWindowHeightTo'], 0);

var windowWidth;
var windowHeight;

if(windowWidthTo){
windowWidth = windowWidthTo;
}else if(scaleFactor !== 1){
windowWidth = screenWidth * scaleFactor;
}else if(screenWidth !== SceneManager._screenWidth){
windowWidth = screenWidth;
}

if(windowHeightTo){
windowHeight = windowHeightTo;
}else if(scaleFactor !== 1){
windowHeight = screenHeight * scaleFactor;
}else if(screenHeight !== SceneManager._screenHeight){
windowHeight = screenHeight;
}


ImageCache.limit = cacheLimit * 1000 * 1000;
SceneManager._screenWidth = screenWidth;
Expand Down Expand Up @@ -87,4 +138,17 @@
this.alwaysDash = alwaysDash;
}
};


var _SceneManager_initNwjs = SceneManager.initNwjs;
SceneManager.initNwjs = function() {
_SceneManager_initNwjs.apply(this, arguments);

if (Utils.isNwjs() && windowWidth && windowHeight) {
var dw = windowWidth - window.innerWidth;
var dh = windowHeight - window.innerHeight;
window.moveBy(-dw / 2, -dh / 2);
window.resizeBy(dw, dh);
}
};
})();