Class in reactor_core_display.js

Window

46 functions in 6 groups · hide internal

The Database: everything Core loads at boot.

Familiar territory. Window keeps the RPG Maker MZ API, so existing MZ knowledge, tutorials and plugin code apply. Reactor's additions are marked with descriptions below.

The window in the game.

@class
@extends
PIXI.Container
function Window()

Quick Reference

Setup & Creation 12

initialize() Sets up a new instance.
_createAllParts() Creates the all parts.
_createContainer() Creates the container.
_createBackSprite() Creates the back sprite.
_createFrameSprite() Creates the frame sprite.
_createClientArea() Creates the client area.
_createContentsBackSprite() Creates the contents back sprite.
_createCursorSprite() Creates the cursor sprite.
_createContentsSprite() Creates the contents sprite.
_createArrowSprites() Creates the arrow sprites.
_createPauseSignSprites() Creates the pause sign sprites.
_makeCursorAlpha() Makes the cursor alpha.

Checks (True / False) 2

isOpen() Checks whether the window is completely open (openness == 255).
isClosed() Checks whether the window is completely closed (openness == 0).

Actions 9

destroy() Destroys the window.
move() Sets the x, y, width, and height all at once.
setCursorRect() Sets the position of the command cursor.
moveCursorBy() Moves the cursor position by the given amount.
moveInnerChildrenBy() Moves the inner children by the given amount.
setTone() Changes the color of the background.
addChildToBack() Adds a child between the background and contents.
addInnerChild() Adds a child to the client area.
_setRectPartsGeometry() dm: the corners' size on screen when it differs from their m in the skin.

Events, Commands & Input 1

_onWindowskinLoad() Called when windowskin load happens.

Updating & Drawing 19

update() Updates the window for each frame.
updateTransform() Updates the transform on all children of this container for rendering.
_updateClipMask() Clip mask over the visible client rect, rebuilt only when that rect changes.
drawShape() Draws the window shape into PIXI.Graphics object.
_refreshAllParts() Redraws the all parts.
_refreshBack() Redraws the back.
_refreshFrame() Redraws the frame.
_refreshRgssFrame() RGSS frames (System.json rrRgssFrames: the skins an import kept the frame cell of, as <skin>_frame.png): the…
_refreshCursor() Redraws the cursor.
_refreshArrows() Redraws the arrows.
_refreshPauseSign() Redraws the pause sign.
_updateClientArea() Updates the client area each frame.
_updateFrame() Updates the frame each frame.
_updateContentsBack() Updates the contents back each frame.
_updateCursor() Updates the cursor each frame.
_updateContents() Updates the contents each frame.
_updateArrows() Updates the arrows each frame.
_updatePauseSign() Updates the pause sign each frame.
_updateFilterArea() Updates the filter area each frame.

Other 3

defaultMargin() System.json advanced.windowMargin (a 2003 window has none); 4 when the data is not loaded.
_clampedCursorRect() The cursor is clamped to the window's inner rect (MV behavior).
_localizeFilterArea() Restates the client area's filter rectangle in the coordinates v8 expects.

Setup & Creation

initialize

method source
Window.prototype.initialize()

Sets up a new instance. (Same as the RPG Maker MZ method of this name.)

_createAllParts

method internal source
Window.prototype._createAllParts()

Creates the all parts. (Same as the RPG Maker MZ method of this name.)

_createContainer

method internal source
Window.prototype._createContainer()

Creates the container. (Same as the RPG Maker MZ method of this name.)

_createBackSprite

method internal source
Window.prototype._createBackSprite()

Creates the back sprite. (Same as the RPG Maker MZ method of this name.)

_createFrameSprite

method internal source
Window.prototype._createFrameSprite()

Creates the frame sprite. (Same as the RPG Maker MZ method of this name.)

_createClientArea

method internal source
Window.prototype._createClientArea()

Creates the client area. (Same as the RPG Maker MZ method of this name.)

_createContentsBackSprite

method internal source
Window.prototype._createContentsBackSprite()

Creates the contents back sprite. (Same as the RPG Maker MZ method of this name.)

_createCursorSprite

method internal source
Window.prototype._createCursorSprite()

Creates the cursor sprite. (Same as the RPG Maker MZ method of this name.)

_createContentsSprite

method internal source
Window.prototype._createContentsSprite()

Creates the contents sprite. (Same as the RPG Maker MZ method of this name.)

_createArrowSprites

method internal source
Window.prototype._createArrowSprites()

Creates the arrow sprites. (Same as the RPG Maker MZ method of this name.)

_createPauseSignSprites

method internal source
Window.prototype._createPauseSignSprites()

Creates the pause sign sprites. (Same as the RPG Maker MZ method of this name.)

_makeCursorAlpha

method internal source
Window.prototype._makeCursorAlpha()

Makes the cursor alpha. (Same as the RPG Maker MZ method of this name.)

Checks (True / False)

isOpen

method source
Window.prototype.isOpen()

Checks whether the window is completely open (openness == 255).

Details

Checks whether the window is completely open (openness == 255).

@returns
boolean True if the window is open.

isClosed

method source
Window.prototype.isClosed()

Checks whether the window is completely closed (openness == 0).

Details

Checks whether the window is completely closed (openness == 0).

@returns
boolean True if the window is closed.

Actions

destroy

method source
Window.prototype.destroy()

Destroys the window.

move

method source
Window.prototype.move(x, y, width, height)

Sets the x, y, width, and height all at once.

Details

Sets the x, y, width, and height all at once.

@param
x number The x coordinate of the window.
@param
y number The y coordinate of the window.
@param
width number The width of the window.
@param
height number The height of the window.

setCursorRect

method source
Window.prototype.setCursorRect(x, y, width, height)

Sets the position of the command cursor.

Details

Sets the position of the command cursor.

@param
x number The x coordinate of the cursor.
@param
y number The y coordinate of the cursor.
@param
width number The width of the cursor.
@param
height number The height of the cursor.

moveCursorBy

method source
Window.prototype.moveCursorBy(x, y)

Moves the cursor position by the given amount.

Details

Moves the cursor position by the given amount.

@param
x number The amount of horizontal movement.
@param
y number The amount of vertical movement.

moveInnerChildrenBy

method source
Window.prototype.moveInnerChildrenBy(x, y)

Moves the inner children by the given amount.

Details

Moves the inner children by the given amount.

@param
x number The amount of horizontal movement.
@param
y number The amount of vertical movement.

setTone

method source
Window.prototype.setTone(r, g, b)

Changes the color of the background.

Details

Changes the color of the background.

@param
r number The red value in the range (-255, 255).
@param
g number The green value in the range (-255, 255).
@param
b number The blue value in the range (-255, 255).

addChildToBack

method source
Window.prototype.addChildToBack(child)

Adds a child between the background and contents.

Details

Adds a child between the background and contents.

@param
child object The child to add.
@returns
object The child that was added.

addInnerChild

method source
Window.prototype.addInnerChild(child)

Adds a child to the client area.

Details

Adds a child to the client area.

@param
child object The child to add.
@returns
object The child that was added.

_setRectPartsGeometry

method internal source
Window.prototype._setRectPartsGeometry(sprite, srect, drect, m, dm = m)

dm: the corners' size on screen when it differs from their m in the skin.

Events, Commands & Input

_onWindowskinLoad

method internal source
Window.prototype._onWindowskinLoad()

Called when windowskin load happens. (Same as the RPG Maker MZ method of this name.)

Updating & Drawing

update

method source
Window.prototype.update()

Updates the window for each frame.

updateTransform

method source
Window.prototype.updateTransform()

Updates the transform on all children of this container for rendering.

_updateClipMask

method internal source
Window.prototype._updateClipMask()

Clip mask over the visible client rect, rebuilt only when that rect changes.

drawShape

method source
Window.prototype.drawShape(graphics)

Draws the window shape into PIXI.Graphics object.

Details

Draws the window shape into PIXI.Graphics object. Used by WindowLayer.

_refreshAllParts

method internal source
Window.prototype._refreshAllParts()

Redraws the all parts. (Same as the RPG Maker MZ method of this name.)

_refreshBack

method internal source
Window.prototype._refreshBack()

Redraws the back. (Same as the RPG Maker MZ method of this name.)

_refreshFrame

method internal source
Window.prototype._refreshFrame()

Redraws the frame. (Same as the RPG Maker MZ method of this name.)

_refreshRgssFrame

method internal source
Window.prototype._refreshRgssFrame()

RGSS frames (System.json rrRgssFrames: the skins an import kept the frame cell of, as <skin>_frame.png): the 16 px corners as they are and the edges repeated along the sides every 32 px, where MZ's frame stretches them (a skin with ornaments along its edges smears into streaks).

Details

RGSS frames (System.json rrRgssFrames: the skins an import kept the frame cell of, as <skin>_frame.png): the 16 px corners as they are and the edges repeated along the sides every 32 px, where MZ's frame stretches them (a skin with ornaments along its edges smears into streaks). True when it drew one.

_refreshCursor

method internal source
Window.prototype._refreshCursor()

Redraws the cursor. (Same as the RPG Maker MZ method of this name.)

_refreshArrows

method internal source
Window.prototype._refreshArrows()

Redraws the arrows. (Same as the RPG Maker MZ method of this name.)

_refreshPauseSign

method internal source
Window.prototype._refreshPauseSign()

Redraws the pause sign. (Same as the RPG Maker MZ method of this name.)

_updateClientArea

method internal source
Window.prototype._updateClientArea()

Updates the client area each frame. (Same as the RPG Maker MZ method of this name.)

_updateFrame

method internal source
Window.prototype._updateFrame()

Updates the frame each frame. (Same as the RPG Maker MZ method of this name.)

_updateContentsBack

method internal source
Window.prototype._updateContentsBack()

Updates the contents back each frame. (Same as the RPG Maker MZ method of this name.)

_updateCursor

method internal source
Window.prototype._updateCursor()

Updates the cursor each frame. (Same as the RPG Maker MZ method of this name.)

_updateContents

method internal source
Window.prototype._updateContents()

Updates the contents each frame. (Same as the RPG Maker MZ method of this name.)

_updateArrows

method internal source
Window.prototype._updateArrows()

Updates the arrows each frame. (Same as the RPG Maker MZ method of this name.)

_updatePauseSign

method internal source
Window.prototype._updatePauseSign()

Updates the pause sign each frame. (Same as the RPG Maker MZ method of this name.)

_updateFilterArea

method internal source
Window.prototype._updateFilterArea()

Updates the filter area each frame. (Same as the RPG Maker MZ method of this name.)

Other

defaultMargin

static source
Window.defaultMargin()

System.json advanced.windowMargin (a 2003 window has none); 4 when the data is not loaded.

_clampedCursorRect

method internal source
Window.prototype._clampedCursorRect()

The cursor is clamped to the window's inner rect (MV behavior).

Details

The cursor is clamped to the window's inner rect (MV behavior). Plugins set cursor rects that extend past the window — e.g. VE_BattleCommandWindow offsets the selected item's rect for its slide effect — and rely on the window clipping the highlight instead of letting it bleed outside.

_localizeFilterArea

method internal source
Window.prototype._localizeFilterArea()

Restates the client area's filter rectangle in the coordinates v8 expects.

Details

Restates the client area's filter rectangle in the coordinates v8 expects.

v8's FilterSystem._calculateFilterArea does

bounds.addRect(filterEffect.filterArea);
bounds.applyMatrix(container.worldTransform);

so it reads filterArea as container-LOCAL and applies the world transform itself. Handed the world-space rect that v5/v6/v7 wanted, it transforms it a second time and the captured region lands roughly twice as far down the screen as the window — off the edge entirely for a window past the middle. The filter then resolves to nothing, and everything inside the client area silently disappears: the panel and its border still draw (they are not in the client area), so a window renders as an empty box.

Correcting it here rather than in _updateFilterArea above is the point. A window's filter rect is computed by whichever _updateFilterArea is installed last, and plugins that reimplement scrolling or window drawing routinely install their own — VisuMZ's CoreEngine among them. Those all write the world-space rect the engine documented, cannot know about v8, and cannot be edited. Removing the client area's world origin and scale afterwards fixes every one of them, including our own, with no version branch above.

Position staleness cancels because both methods read the same transform. A plugin can instead scale dimensions from this.scale, so on the first frame its size can be divided by a still-identity world transform; the next frame is correct. Guessing which convention wrote a rectangle is less reliable.