Add a logo in the in-game menu?

● ARCHIVED · READ-ONLY
Started by doodlebound 8 posts View original ↗
  1. oTZPZnd.png
    I'm using Galv's bust menu plugin and I like the format, but I think there's a lot of empty space at the top. I want to put the logo for the game in that space, like this:
    B3BniqR.png
    (ignore the strange scaling of the logo in this edit, MS paint is the worst at resizing images)

    Does anyone have a script or plugin that could achieve this? I'm using RMMV, btw.
  2. Feel free to try the plugin below. It requires your game logo to be stored in the img/system folder with the name "GameLogo.png."
    Code:
    // LogoOnMenu.js
    // Created on 10/1/2018
    // Last modified on 10/2/2018 by Yethwhinger
    
    var objYeth = objYeth || {};
    
    /*:
    * @plugindesc This plugin is meant to allow the placement
    * of a game logo on the main in-game menu.
    * @author Yethwhinger
    *
    * @param logoHeight
    * @desc Desired height of the logo on the menu in pixels
    * Default = 192
    * @default 192
    *
    * @param logoY
    * @desc Desired vertical placement of the logo on the menu in lines
    * Default = 0
    * @default 0
    *
    * @help This plugin places a game logo on the main in-game
    * menu. The plugin is designed to work with the GALV_BustMenu
    * plugin. The logo should be in the img/system folder and should
    * be called "GameLogo.png."
    */
    
    objYeth.logoOnMenuParam = PluginManager.parameters('LogoOnMenu');
    objYeth.menuLogoHeight = Number(objYeth.logoOnMenuParam['logoHeight']);
    objYeth.menuLogoY = Number(objYeth.logoOnMenuParam['logoY']);
    
    //------------------------------
    // Changes to Window_MenuStatus
    //------------------------------
    
    Window_MenuStatus.prototype.initialize = function (x, y) {
        var width = this.windowWidth();
        var height = this.windowHeight();
        Window_Selectable.prototype.initialize.call(this, x, y, width, height);
        this._formationMode = false;
        this._pendingIndex = -1;
        this.setupLogo();
        this.refresh();
    };
    
    Window_MenuStatus.prototype.setupLogo = function () {
        var scaleX, scaleY, minScale;
        var maxWidth = this.contentsWidth();
        var maxHeight = objYeth.menuLogoHeight;
        this._cursorY = 0;
        this._logoParams = {};
        this._logoParams.dy = objYeth.menuLogoY * this.lineHeight();
        this._logoBitmap = ImageManager.loadSystem('GameLogo');
        if (this._logoBitmap) {
            this._logoParams.sw = this._logoBitmap.width;
            this._logoParams.sh = this._logoBitmap.height;
            scaleX = maxWidth / this._logoParams.sw;
            scaleY = maxHeight / this._logoParams.sh;
            minScale = Math.min(scaleX, scaleY);
            this._logoParams.dw = Math.floor(this._logoParams.sw * minScale);
            this._logoParams.dh = Math.floor(this._logoParams.sh * minScale);
            this._logoParams.dx = Math.floor((maxWidth - this._logoParams.dw) / 2);
            this._cursorY = objYeth.menuLogoHeight + this._logoParams.dy + this.standardPadding();
        }
    };
    
    Window_MenuStatus.prototype.refresh = function () {
        if (this.contents) {
            this.contents.clear();
            this.drawAllItems();
            this.drawLogo();
        }
    };
    
    Window_MenuStatus.prototype.drawLogo = function () {
        var logo = this._logoBitmap;
        var sw, sh, dx, dy, dw, dh;
        if (logo) {
            sw = this._logoParams.sw;
            sh = this._logoParams.sh;
            dx = this._logoParams.dx;
            dy = this._logoParams.dy;
            dw = this._logoParams.dw;
            dh = this._logoParams.dh;
            this.contents.blt(logo, 0, 0, sw, sh, dx, dy, dw, dh);
        }
    };
    
    Window_MenuStatus.prototype.actorHeight = function () {
        return this.itemHeight() - objYeth.menuLogoHeight - objYeth.menuLogoY * this.lineHeight() - this.standardPadding();
    };
    
    Window_MenuStatus.prototype.actorRect = function (index) {
        var rect = new Rectangle();
        var maxCols = this.maxCols();
        var rowHeight = this.itemHeight();
        rect.width = this.itemWidth();
        rect.height = this.actorHeight();
        rect.x = index % maxCols * (rect.width + this.spacing()) - this._scrollX;
        rect.y = this._cursorY + Math.floor(index / maxCols) * rowHeight - this._scrollY;
        return rect;
    };
    
    Window_MenuStatus.prototype.updateCursor = function () {
        if (this._cursorAll) {
            var allRowsHeight = (this.maxRows() - 1) * this.itemHeight() + this.actorHeight();
            this.setCursorRect(0, this._cursorY, this.contents.width, allRowsHeight);
            this.setTopRow(0);
        } else if (this.isCursorVisible()) {
            var rect = this.actorRect(this.index());
            this.setCursorRect(rect.x, rect.y, rect.width, rect.height);
        } else {
            this.setCursorRect(0, 0, 0, 0);
        }
    };
    
    Window_MenuStatus.prototype.drawItemBackground = function (index) {
        if (index === this._pendingIndex) {
            var rect = this.actorRect(index);
            var color = this.pendingColor();
            this.changePaintOpacity(false);
            this.contents.fillRect(rect.x, rect.y, rect.width, rect.height, color);
            this.changePaintOpacity(true);
        }
    };
    
    Window_MenuStatus.prototype.clearItem = function (index) {
        var rect = this.actorRect(index);
        this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
    };
    
    //------------------------------
    // Changes to Scene_Boot
    //------------------------------
    
    objYeth.Scene_Boot_loadSystemImagesLogo = Scene_Boot.loadSystemImages || Scene_Boot.prototype.loadSystemImages;
    Scene_Boot.loadSystemImages = function () {
        objYeth.Scene_Boot_loadSystemImagesLogo.call(this);
        ImageManager.reserveSystem('GameLogo');
    };
    
    Scene_Boot.prototype.loadSystemImages = function () {
        objYeth.Scene_Boot_loadSystemImagesLogo.call(this);
        ImageManager.loadSystem('GameLogo');
    };
  3. It doesn't show up in the menu. I have the logo height set to 100 px (the original png is 50 px) and the Y value set to 0.
  4. I'm sorry it isn't working for you. Maybe we can still get it to work somehow. I am able to get the following result on my system with GALV_BustMenu and LogoOnMenu as the only plugins in an MV version 1.6.1 project.
    During development of the plugin, I experienced an issue with the logo not loading immediately: the logo would appear if I closed the menu and then reopened it. I added the changes to Scene_Boot to the plugin in an attempt to correct this issue, and it worked on my system. Would you mind closing your menu and reopening to see whether the problem is an image loading problem or something else? Also, what version of MV are you running, and are you using any other plugins?
    LogoOnMenu.png
  5. HbbN6qr.png
    Still isn't working.
    NoMP, No Level&EXP, OnlyItemsKeyItems and NoFlash were plugins that users around the forum made for me to get rid of MP, Level/EXP meters, Weapons and Armors, and the flash when poison damage hits respectively.
  6. Would you mind renaming the plugin file to "LogoOnMenu" and then reloading it in your project? The plugin references this name in its code and needs to do so in order to get the values of the plugin parameters.
  7. It works beautifully! Thank you so much!
  8. I am glad it's working for you.