TOOL/DrawToolScreen

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m
Line 31: Line 31:
 
draw.SimpleText( "Hello world!", "DermaLarge", width / 2, height / 2, Color( 200, 200, 200 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
 
draw.SimpleText( "Hello world!", "DermaLarge", width / 2, height / 2, Color( 200, 200, 200 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
 
end
 
end
|Output=<br/><br/>[[File:drawtoolscreen.jpg]]
+
|Output=[[File:drawtoolscreen.jpg]]
 
}}
 
}}

Revision as of 15:18, 25 October 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.

BUG

PNG rendering is broken in this rendering context.

Issue Tracker: #3545

This bug will be fixed in the next update.

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