New Windows Selectable

I am just about finished putting my finishing touches on a windows core script.

This script will allow users to make windows that have the cursor changed from a default flashing rectangle to a circle cursor.

The script will also support changing the cursor color in game.

I made this thread to gauge people opinions on the matter and have an option of submitting ideas.

I know that working with the default rectangle can be a nuisance with custom menus. 
 

Untitled_zpsqq1h6aw4.png
Will that cursor behave like in your screenshot (stay at a fixed size, independent from the actual itemRect) or will it autosize?


What i would like to see in a Window_Selectable overhaul (and maybe i'll try doing it myself, once i get the time):


- Smooth scrolling (with animation), instead of what we have now (probably kinda hard to do).


- Touch swipe support (no idea, probably hard, too).


- Scrollbars (should be easier, but gets harder in combination with smooth scrolling).
Well it is based off of itemRect so from menu to menu it will change the circle radius.

What do you mean my smooth scrolling?
 
Currently, when a Window_Selectable has more elements, than it can display, it will show a downward arrow and jump to the next page. Smooth scrolling would replace that with an actual animation of the items sliding upwards while your press down.


This would require to rewrite the way selectable items are rendered, since you would need to draw items, that aren't fully visible. Also, you need to call refresh() much more often or replace the mechanism entirely.


Afterwards, you can add easing to the scroll animation (so it starts fast, but gets slower over time / bounces back a bit once it hits the end, etc). This should actually be easier, than it sounds, once you get to that point.
I see what you mean, that sounds challenging so I will work on that. It would be more of an update() type scenario at that point and less refresh()
I got basic scrollbars working for myself. I'll post an example, once i tidied up the code a bit.

/edit: The plugin description is obviously incorrect, since the plugin does only scrollbars to far, but it's something:

Spoiler
Code:
/*: * @plugindesc Rewrites the Window_Selectable class to allow for smooth scrolling, scrollbars and other features. * <Iavra Selectable> * @author Iavra * * @param Scrollbar Width * @desc Width of the scrollbar (without padding). A minimum value of 1 is enforced to prevent errors. Default: 4 * @default 4 * * @param Scrollbar Padding * @desc Padding between the scrollbar background and the scrolling part. Gets applied to all 4 sides. Default: 1 * @default 1 */var IAVRA = IAVRA || {};//=============================================================================// IAVRA.SELECTABLE//=============================================================================(function($) {    var _params = $plugins.filter(function(p) { return p.description.contains('<Iavra Selectable>'); })[0].parameters;    $.params = {        width: Math.max(parseInt(_params['Scrollbar Width']) || 0, 1),        padding: Math.max(parseInt(_params['Scrollbar Padding']) || 0, 0)    };        $.Sprite_Scrollbar = function() { this.initialize.apply(this, arguments); };})(IAVRA.SELECTABLE = {});//=============================================================================// IAVRA.SELECTABLE.Sprite_Scrollbar//=============================================================================(function($) {    "use strict";    ($.prototype = Object.create(PIXI.DisplayObjectContainer.prototype)).constructor = $;        $.prototype.initialize = function() {        PIXI.DisplayObjectContainer.call(this);        this._rate = 1;        this.addChild(this._spriteBackground = new Sprite());        this.addChild(this._spriteScrollbar = new Sprite());    };        $.prototype.refreshAllParts = function() {        var width = IAVRA.SELECTABLE.params.width, height = this.parent.height - this.parent.padding * 2;        var padding = IAVRA.SELECTABLE.params.padding;        var rect = new Rectangle(this.parent.width - 15, (this.parent.height - height) / 2, width + padding * 2, height);        this.refreshBackground(rect, padding);        this.refreshScrollbar(rect, padding);    };        $.prototype.refreshBackground = function(rect, padding) {        this._spriteBackground.bitmap = new Bitmap(rect.width, rect.height);        this._spriteBackground.bitmap.fillAll('#FFF');        this._spriteBackground.move(rect.x, rect.y);    };        $.prototype.refreshScrollbar = function(rect, padding) {        this._rate = Math.min(this.parent.maxPageRows() / this.parent.maxRows(), 1);        this._spriteScrollbar.bitmap = new Bitmap(rect.width - padding * 2, (rect.height - padding * 2) * this._rate);        this._spriteScrollbar.bitmap.fillAll('#000');        this._spriteScrollbar.move(rect.x + padding, rect.y + padding);    };        $.prototype.updatePlacement = function() {        var diff = this._spriteBackground.height - this._spriteScrollbar.height - IAVRA.SELECTABLE.params.padding * 2;        var max = Math.max(this.parent.maxRows() - this.parent.maxPageRows(), 1);        var current = Math.min(this.parent.topRow(), max);        this._spriteScrollbar.y = this._spriteBackground.y + current / max * diff + IAVRA.SELECTABLE.params.padding;    };})(IAVRA.SELECTABLE.Sprite_Scrollbar);//=============================================================================// Window_Selectable//=============================================================================(function($) {    "use strict";        var alias_initialize = $.prototype.initialize;    $.prototype.initialize = function(x, y, width, height) {        alias_initialize.call(this, x, y, width, height);        this.addChild(this._scrollbar = new IAVRA.SELECTABLE.Sprite_Scrollbar());        this._scrollbar.refreshAllParts();    };        var alias_updateTransform = $.prototype.updateTransform;    $.prototype.updateTransform = function() {        this._scrollbar.visible = this._scrollbar._rate < 1 && this.isOpen();        alias_updateTransform.call(this);    };        var alias_refreshAllParts = $.prototype._refreshAllParts;    $.prototype._refreshAllParts = function() {        alias_refreshAllParts.call(this);        if(this._scrollbar) { this._scrollbar.refreshAllParts(); }    };        var alias_refresh = $.prototype.refresh;    $.prototype.refresh = function() {        alias_refresh.call(this);        this._scrollbar.updatePlacement();    };    })(Window_Selectable);
I have ran though the code. Now would't you have to modify the hitTest() to determine if you have selected the scroll bar? That is of course if you wanted the user to be able to grab onto the scroll bar and move it. It works good with the mouse wheel though.
Yeah, dragging the scrollbar is not supported in that version.
Now, suppose the dragging scroll bar is supported and the page arrows got removed. That would be a pretty good upgrade. After that then the smoothing would be next. For mobile users I can see the touch swipe useful too. I am not sure exactly how you would implement that.
Would you eventually have this be able to support using an image as a cursor instead of just a circle? It'd also be cool to have this be a triangle shape as well. 

Original thread: https://forums.rpgmakerweb.com/threads/new-windows-selectable.53123/