//-----------------------------------------------------------------------------
// Window_Help
//
// The window for displaying the description of the selected item.
/**
* The window for displaying the description of the selected item.
*
* @class
* @extends Window_Base
*/
function Window_Help() {
this.initialize(...arguments);
}
Window_Help.prototype = Object.create(Window_Base.prototype);
Window_Help.prototype.constructor = Window_Help;
Window_Help.prototype.initialize = function(rect) {
Window_Base.prototype.initialize.call(this, rect);
this._text = "";
};
/**
* Sets the text to show in the window
*
* @param {string} text - The text to display in the window
*/
Window_Help.prototype.setText = function(text) {
if (this._text !== text) {
this._text = text;
this.refresh();
}
};
/**
* Clears the window's text
*/
Window_Help.prototype.clear = function() {
this.setText("");
};
/**
* Sets the item to display in the window
*
* @param {Object} item - The item with description property
*/
Window_Help.prototype.setItem = function(item) {
this.setText(item ? item.description : "");
};
/**
* Refreshes the window
*/
Window_Help.prototype.refresh = function() {
const rect = this.baseTextRect();
this.contents.clear();
this.drawTextEx(this._text, rect.x, rect.y, rect.width);
};