Garry's Mod Wiki

ScrW

  number ScrW()

Description

Gets the width of the game's window (in pixels).

ScrW() returns the width from the current viewport, this can be changed via render.SetViewPort, inside Render Targets and cam.Start contexts.

Returns

1 number
The width of the game's window in pixels

Example

Prints the width of the screen

print( ScrW() )
Output: 1920 (depends on your resolution)