core.engine.get_resolution
Client
Retrieves the current screen resolution in absolute pixels
Syntax
local resolution = core.engine.get_resolution()Parameters
| No parameters are accepted by this function |
|---|
Returns
| Type | Name | Description |
|---|---|---|
vector2 | resolution | Screen resolution in pixels as {width, height} |
Examples
local resolution = core.engine.get_resolution()
local size = {200, 100}
util.event.on("sandbox:draw", function()
core.engine.draw_rectangle(
{(resolution[1] - size[1])*0.5, (resolution[2] - size[2])*0.5},
{size[1], size[2]},
{1, 1, 1, 1}
)
end)