Garry's Mod Wiki

ScrH

  number ScrH()

Description

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

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

Returns

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

Example

Prints the Height of the window.

print( ScrH() )
Output: 1080 (depends on your screen).

Example

Draws a white box on the top left corner of your screen.

hook.Add( "HUDPaint", "WhiteBox", function() surface.SetDrawColor( 255, 255, 255, 255 ) surface.DrawRect( 0, 0, ScrW() / 2, ScrH() / 2 ) end )
Output: A white box on the top left corner of your screen.