- Joined
- Aug 24, 2017
- Messages
- 81
- Reaction score
- 8
- First Language
- Chinese
- Primarily Uses
- RMMV
Hello,
Now I got some question about cursor
These are the code for cursor, am I right?
So when I use
in Window_Selectable.prototype.updateCursor
I can change the color.
Then I was thinking, can I change CursorRect to a picture?(not just a box)
Can someone help me with this?
Change CursorRect to a picture, maybe in the img/pictures.
Thank you.
Now I got some question about cursor
These are the code for cursor, am I right?
Code:
Window_Selectable.prototype.updateCursor = function() {
if (this._cursorAll) {
var allRowsHeight = this.maxRows() * this.itemHeight();
this.setCursorRect(0, 0, this.contents.width, allRowsHeight);
this.setTopRow(0);
} else if (this.isCursorVisible()) {
var rect = this.itemRect(this.index());
this.setCursorRect(rect.x, rect.y, rect.width, rect.height);
} else {
this.setCursorRect(0, 0, 0, 0);
}
};
Code:
Window.prototype.setCursorRect = function(x, y, width, height) {
var cx = Math.floor(x || 0);
var cy = Math.floor(y || 0);
var cw = Math.floor(width || 0);
var ch = Math.floor(height || 0);
var rect = this._cursorRect;
if (rect.x !== cx || rect.y !== cy || rect.width !== cw || rect.height !== ch) {
this._cursorRect.x = cx;
this._cursorRect.y = cy;
this._cursorRect.width = cw;
this._cursorRect.height = ch;
this._refreshCursor();
}
};
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 = 4;
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);
}
};
Code:
this._windowCursorSprite.tint = '#FFFF00';
I can change the color.
Then I was thinking, can I change CursorRect to a picture?(not just a box)
Can someone help me with this?
Change CursorRect to a picture, maybe in the img/pictures.
Thank you.

