Skip to main content

GetDisplayResolution

This function was added in DSL 1

Description

Return the current display resolution used by DSL's renderer.

Although this shouldn't change during a normal play session, it is possible for another mod to resize the game.

tip

For this reason, it is often a good idea to get this value each frame you need it rather than once at setup.

Also keep in mind that most render functions take normalized coords, meaning you will not usually need the actual resolution.

function GetDisplayResolution() --[[ ... ]] end

Parameters

None.

Return Values

  • width: number - The width of the display resolution.
  • height: number - The height of the display resolution.

Example

local width, height = GetDisplayResolution()
print("Display resolution is " .. width .. "x" .. height)