Viewport

open class Viewport(var x: Int, var y: Int, var width: Int, var height: Int)

Rectangular region in a two-dimensional coordinate system expressed as an origin and dimensions extending from the origin.

Constructors

Link copied to clipboard
constructor(x: Int, y: Int, width: Int, height: Int)
constructor()

Constructs an empty viewport width X, Y, width and height all zero.

constructor(viewport: Viewport)

Constructs a viewport with the origin and dimensions of a specified viewport.

Properties

Link copied to clipboard
var height: Int

The viewport's height.

Link copied to clipboard

Indicates whether this viewport is empty. A viewport is empty when either its width or its height are zero (or negative).

Link copied to clipboard
var width: Int

The viewport's width.

Link copied to clipboard
var x: Int

The X component of the viewport's origin.

Link copied to clipboard
var y: Int

The Y component of the viewport's origin.

Functions

Link copied to clipboard
fun contains(point: Vec2): Boolean

Indicates whether this viewport contains a specified point. An empty viewport never contains a point.

Link copied to clipboard
fun copy(viewport: Viewport): Viewport

Sets this viewport to the origin and dimensions of a specified viewport.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun intersect(viewport: Viewport): Boolean
fun intersect(x: Int, y: Int, width: Int, height: Int): Boolean

Computes the intersection of this viewport and a specified viewport, storing the result in this viewport and returning whether the viewport intersects. Two viewport intersect when both overlap by a non-zero amount. An empty viewport never intersects another viewport.
When there is no intersection, this returns false and leaves this viewport unchanged. To test for intersection without modifying this viewport, use intersects.

Link copied to clipboard
fun intersects(viewport: Viewport): Boolean
fun intersects(x: Int, y: Int, width: Int, height: Int): Boolean

Indicates whether this viewport intersects a specified viewport. Two viewport intersect when both overlap by a non-zero amount. An empty viewport never intersects another viewport.

Link copied to clipboard
fun set(x: Int, y: Int, width: Int, height: Int): Viewport

Sets this viewport to the specified origin and dimensions.

Link copied to clipboard

Sets this viewport to an empty viewport.

Link copied to clipboard
open override fun toString(): String