Screen
Screen provides the current width and height of the game image. In a Reflex module’s server.lua, the global Screen object is nil.
What the values describe
Section titled “What the values describe”This is the client render area’s size in pixels at read time. Properties update when resolution or window size changes and change nothing by themselves.
The values are useful for ImGui and screen-space calculations. UXML/UI may additionally apply HUD scale and its own layout, so the pixel center of Screen is not always the coordinate center inside a specific UI container.
Properties
Section titled “Properties”| Property | Type | Access | Description |
|---|---|---|---|
Width |
number |
get |
Screen width in pixels. |
Height |
number |
get |
Screen height in pixels. |
Both properties are getter-only.
Aspect ratio
Section titled “Aspect ratio”local aspect = Screen.Width / Screen.HeightAt 1920 × 1080, the result is approximately 1.7778.
Screen center
Section titled “Screen center”local center = Vector2.new(Screen.Width / 2, Screen.Height / 2)Rect example
Section titled “Rect example”The following 320 × 180 rectangle is centered on screen:
local width = 320local height = 180
local area = Rect.new( (Screen.Width - width) / 2, (Screen.Height - height) / 2, width, height)See Rect for rectangular regions.