Garry's Mod Wiki

GM:OnScreenSizeChanged

  GM:OnScreenSizeChanged( number oldWidth, number oldHeight, number newWidth, number newHeight )

Description

Called when the player's screen resolution of the game changes. This also called when changing MSAA settings.

ScrW and ScrH will return the new values when this hook is called.

Arguments

1 number oldWidth
The previous width of the game's window.
2 number oldHeight
The previous height of the game's window.
3 number newWidth
The new/current width of the game's window.
4 number newHeight
The new/current height of the game's window.

Example

When a player change his Screen Size it's print the old Size and the new size.

hook.Add( "OnScreenSizeChanged", "PrintOld", function( oldWidth, oldHeight ) print( oldWidth, oldHeight ) -- Prints old width and height print( ScrW(), ScrH() ) -- Prints new width and height end )