Engine
engine.get_resolution
Client
Retrieves the current screen resolution in absolute pixels
Syntax
local resolution = engine.get_resolution()Parameters
| Type | Name | Description |
|---|
Returns
| Type | Name | Description |
|---|---|---|
vector2 | resolution | Screen resolution in pixels as {width, height} |
Examples
local resolution = engine.get_resolution()
local size = {200, 100}
network:fetch("vital.sandbox:draw", true):on(function()
engine.draw_rectangle(
{(resolution[1] - size[1])*0.5, (resolution[2] - size[2])*0.5},
{size[1], size[2]},
{1, 1, 1, 1}
)
end)