Custom selection cursor

Joined
Aug 23, 2018
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMMV
Hello! I'm looking to request, if not possibly commission a (hopefully) simple script in which the the traditional box cursor can be modified to surround just the corners of the selection box, and not encompass the entire selection itself. I'd like it if each corner could have the possibility of its own unique sprite, but it's completely optional.

The problem I have when I try to do such a thing is that this happens; horrible stretching.

What I want to happen is this:


The sprite seems to work as intended in the item menu, but is stretched out badly on the larger selection cursor.


Thank you!
 

Yethwhinger

Veteran
Veteran
Joined
Jul 18, 2018
Messages
53
Reaction score
29
First Language
English
Primarily Uses
RMMV
Hello, MalevolentAura. You could make a plugin with the following code, which is the code from the same function in rpg_core.js with the value of variable m changed from 4 to 24 and with all blt's except the corners commented out. The corners are by default kept from stretching out of proportion. With this change, instead of the corners being four pixels wide, they are made to be 24 pixels wide. I think this change accomplishes your objective with the disadvantage that the corners could end up overlapping each other if you use large cursor sprites on small selections.
Code:
Window.prototype._refreshCursor = function () {
    var pad = this._padding;
    var x = this._cursorRect.x + pad - this.origin.x;
    var y = this._cursorRect.y + pad - this.origin.y;
    var w = this._cursorRect.width;
    var h = this._cursorRect.height;
    var m = 24;
    var x2 = Math.max(x, pad);
    var y2 = Math.max(y, pad);
    var ox = x - x2;
    var oy = y - y2;
    var w2 = Math.min(w, this._width - pad - x2);
    var h2 = Math.min(h, this._height - pad - y2);
    var bitmap = new Bitmap(w2, h2);

    this._windowCursorSprite.bitmap = bitmap;
    this._windowCursorSprite.setFrame(0, 0, w2, h2);
    this._windowCursorSprite.move(x2, y2);

    if (w > 0 && h > 0 && this._windowskin) {
        var skin = this._windowskin;
        var p = 96;
        var q = 48;
        /*
        bitmap.blt(skin, p + m, p + m, q - m * 2, q - m * 2, ox + m, oy + m, w - m * 2, h - m * 2);
        bitmap.blt(skin, p + m, p + 0, q - m * 2, m, ox + m, oy + 0, w - m * 2, m);
        bitmap.blt(skin, p + m, p + q - m, q - m * 2, m, ox + m, oy + h - m, w - m * 2, m);
        bitmap.blt(skin, p + 0, p + m, m, q - m * 2, ox + 0, oy + m, m, h - m * 2);
        bitmap.blt(skin, p + q - m, p + m, m, q - m * 2, ox + w - m, oy + m, m, h - m * 2);
        */
        bitmap.blt(skin, p + 0, p + 0, m, m, ox + 0, oy + 0, m, m);
        bitmap.blt(skin, p + q - m, p + 0, m, m, ox + w - m, oy + 0, m, m);
        bitmap.blt(skin, p + 0, p + q - m, m, m, ox + 0, oy + h - m, m, m);
        bitmap.blt(skin, p + q - m, p + q - m, m, m, ox + w - m, oy + h - m, m, m);
    }
};
 
Joined
Aug 23, 2018
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMMV
It works! Thank you so much! I would turn this into a plugin, but I'm not really sure how. I found that just changing var m to 24 seems to fix it, without having to comment out the rest of the code.

In any case, thank you! If someone could create a script for this, that'd be wonderful!
 

Yethwhinger

Veteran
Veteran
Joined
Jul 18, 2018
Messages
53
Reaction score
29
First Language
English
Primarily Uses
RMMV
Hello, MalevolentAura. If you have access to a text editor, such as Notepad in Windows, you can make the plugin yourself using the code in this thread. You would copy the code from the thread and paste it into a new text file. At the top, you should put some comments, such as the example header below. Save the text file with a name that will help you remember what the script does, such as KeepCursorProportions.js. Make sure the filename extension is .js instead of .txt. Put that file into your plugins directory and activate it as you would any other plugin.
Code:
// KeepCursorProportions.js
// Created on 8/25/2018
/*:
* @plugindesc This plugin is meant to maintain the proportions of the cursor sprite.
* @author Yethwhinger
* @help This plugin replaces the default stretching of the cursor with a function
* that splits the cursor sprite into four pieces that are moved to the corners of
* the selection.
*/

//----------------------------
// Changes to Window
//----------------------------
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top