Viewport#

version 2.55.9 - Basic, read-only access

version 3.0 - Full access via Viewport->Mode

Defines the visible portion of the current Region - aka, what the player currently sees.

For an example usage, see: ZQuestClassic/ZQuestClassic

Variables#

ViewportMode

Mode

sprite

Target

int

X

int

Y

const int

Width

const int

Height

Functions#

bool

Contains(sprite s)

bool

Contains(int x, int y)

Enumerations#

enum ViewportMode: πŸ”— Source

ViewportMode VIEW_MODE_CENTER_AND_BOUND = 0L

Position the viewport such that the Viewport::Target is in the middle of it (but bounded by the edges of the current region).

ViewportMode VIEW_MODE_CENTER = 1L

Position the viewport such that the Viewport::Target is in the middle of it, always. Screens outside the current region are rendered as black.

ViewportMode VIEW_MODE_SCRIPT = 2L

Disable the engine’s updating of the viewport on every frame, and instead defer to values set by scripts.


Variable descriptions#

ViewportMode Mode πŸ”— Source

Defaults to VIEW_MODE_CENTER_AND_BOUND, and is reset at the beginning of scrolling.


sprite Target πŸ”— Source

The sprite that the viewport is centered around. If this sprite no longer exists, this will be reset to the Hero sprite.

Defaults to Hero, and is reset at the beginning of scrolling.


int X πŸ”— Source

Unless Mode is VIEW_MODE_SCRIPT, this is updated every frame by the engine.


int Y πŸ”— Source

Unless Mode is VIEW_MODE_SCRIPT, this is updated every frame by the engine.


const int Width πŸ”— Source


const int Height πŸ”— Source


Function descriptions#

bool Contains(sprite s) πŸ”— Source

version 3.0

Returns true if the given sprite is visible within the viewport.

Note: this function ignores the fact that the bottom 8 pixels are never visible.


bool Contains(int x, int y) πŸ”— Source

Returns true if the given point is visible within the viewport.

Note: this function ignores the fact that the bottom 8 pixels are never visible.