TOOL/DrawToolScreen

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m
 
Line 4: Line 4:
 
{{Note|If this method exists on the TOOL object table, the default scrolling text will not be drawn}}
 
{{Note|If this method exists on the TOOL object table, the default scrolling text will not be drawn}}
 
{{Note|Materials rendered in this hook require $ignorez parameter to draw properly.}}
 
{{Note|Materials rendered in this hook require $ignorez parameter to draw properly.}}
 
{{Bug|Issue=3545|PNG rendering is broken in this rendering context.|Fixed=}}
 
 
|Realm=Client
 
|Realm=Client
 
|Predicted=No
 
|Predicted=No

Latest revision as of 16:56, 12 November 2019

 TOOL:DrawToolScreen( )

Contents

Description

Called after the default tool screen has been drawn from WEAPON:RenderScreen.

NOTE

If this method exists on the TOOL object table, the default scrolling text will not be drawn

NOTE

Materials rendered in this hook require $ignorez parameter to draw properly.

Arguments

number width

The width of the tool's screen in pixels.

Arguments

number height

The height of the tool's screen in pixels.

Examples

Example

White text that says "Hello world!" on a black background.

function TOOL:DrawToolScreen( width, height )
	-- Draw black background
	surface.SetDrawColor( Color( 20, 20, 20 ) )
	surface.DrawRect( 0, 0, width, height )
	
	-- Draw white text in middle
	draw.SimpleText( "Hello world!", "DermaLarge", width / 2, height / 2, Color( 200, 200, 200 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
end

Output:

drawtoolscreen.jpg
Personal tools
Navigation