ScreenViewport

class ScreenViewport(var x: Int, var y: Int, var width: Int, var height: Int, var camera: Camera = OrthographicCamera()) : Viewport

A viewport that uses a virtual size that will always match the window size. No scaling happens along with no black bars appearing.

Author

Colton Daily

Constructors

Link copied to clipboard
fun ScreenViewport(width: Int, height: Int, camera: Camera = OrthographicCamera())
Link copied to clipboard
fun ScreenViewport(x: Int, y: Int, width: Int, height: Int, camera: Camera = OrthographicCamera())

Functions

Link copied to clipboard
fun apply(context: Context, centerCamera: Boolean = false)

Sets the OpenGL viewport based on viewport and virtual sizes by calling GL.viewport.

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

Set the viewport position and size.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open override fun update(width: Int, height: Int, context: Context, centerCamera: Boolean)

Resize the viewport based new size. If using the base Viewport this function must be overridden for it to do anything other than apply the current viewport size.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var height: Int = 0

The height of the viewport.

Link copied to clipboard
var unitsPerPixel: Float = 1.0f

The number of pixels for each world unit. Eg: a scale of 2.5f means there are 2.5f world units for every 1 screen pixel.

Link copied to clipboard

The virtual/world height.

Link copied to clipboard

The virtual/world width.

Link copied to clipboard
var width: Int = 0

The width of the viewport.

Link copied to clipboard
var x: Int = 0
Link copied to clipboard
var y: Int = 0