DrakenGames

Yanfly - ScreenResolution

Jan 13th, 2016
277
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Yanfly Engine Plugins - Screen Resolution
  3. // ScreenResolution.js
  4. // Version: 1.00
  5. //=============================================================================
  6.  
  7. var Imported = Imported || {};
  8. Imported.ScreenResolution = true;
  9.  
  10. var Yanfly = Yanfly || {};
  11. Yanfly.ScrRes = Yanfly.ScrRes || {};
  12.  
  13. //=============================================================================
  14.  /*:
  15.  * @plugindesc Change your game's screen resolution to your liking!
  16.  * @author Yanfly Engine Plugins
  17.  *
  18.  * @param Screen Width
  19.  * @desc Adjusts the width of the screen.                           .
  20.  * Default: 816
  21.  * @default 816
  22.  *
  23.  * @param Screen Height
  24.  * @desc Adjusts the height of the screen.                          .
  25.  * Default: 624
  26.  * @default 624
  27.  *
  28.  * @help
  29.  * Adjust the parameters to change the size of how you want your game's
  30.  * screen resolution to appear.
  31.  */
  32. //=============================================================================
  33.  
  34. Yanfly.Parameters = PluginManager.parameters('ScreenResolution');
  35.  
  36. //=============================================================================
  37. // Scene_Manager
  38. //=============================================================================
  39.  
  40. SceneManager._screenWidth  = Number(Yanfly.Parameters['Screen Width'] || 816);
  41. SceneManager._screenHeight = Number(Yanfly.Parameters['Screen Height'] || 624);
  42. SceneManager._boxWidth     = Number(Yanfly.Parameters['Screen Width'] || 816);
  43. SceneManager._boxHeight    = Number(Yanfly.Parameters['Screen Height'] || 624);
  44.  
  45. Yanfly.ScrRes.SceneManager_run = SceneManager.run;
  46. SceneManager.run = function(sceneClass) {
  47.     Yanfly.ScrRes.SceneManager_run.call(this, sceneClass);
  48.     if (Utils.isMobileDevice()) return;
  49.     if (Utils.isMobileSafari()) return;
  50.     if (Utils.isAndroidChrome()) return;
  51.         var resizeWidth = Graphics.boxWidth - window.innerWidth;
  52.         var resizeHeight = Graphics.boxHeight - window.innerHeight;
  53.         window.moveBy(-1 * resizeWidth / 2, -1 * resizeHeight / 2);
  54.         window.resizeBy(resizeWidth, resizeHeight);
  55. };
  56.  
  57. //=============================================================================
  58. // End of File
  59. //=============================================================================
RAW Paste Data