I was looking for some plugin or option that could help me adjusting the size of any picture to the same size of my game screen. But I could not find anything.
So I made it myself. I hope this can help someone. If you have any corrections to my code please comment. Thank you
//============================================================================= // RPG Maker MZ - Button Picture //============================================================================= /*: * @target MZ * @plugindesc Adjust pictures size in full screen. * @author geskechan * * @help FullScreenPicture.js * */ (() => { const _Game_Picture_show = Game_Picture.prototype.show; Game_Picture.prototype.show = function() { _Game_Picture_show.apply(this, arguments); let bitmap = ImageManager.loadPicture(this._name); let image = bitmap._image; let adjustedScaleX = (Graphics.width / image.naturalWidth) * 100; let adjustedScaleY = (Graphics.height / image.naturalHeight) * 100; this._scaleX = adjustedScaleX; this._scaleY = adjustedScaleY; }; const _Game_Picture_move = Game_Picture.prototype.move; Game_Picture.prototype.move = function() { _Game_Picture_move.apply(this, arguments); let bitmap = ImageManager.loadPicture(this._name); let image = bitmap._image; let adjustedScaleX = (Graphics.width / image.naturalWidth) * 100; let adjustedScaleY = (Graphics.height / image.naturalHeight) * 100; this._targetScaleX = adjustedScaleX; this._targetScaleY = adjustedScaleY; }; })(); 复制代码
本贴来自国际rpgmaker官方论坛作者:geskechan处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/adjust-picture-size-to-screen-size.152247/