surface.SetTexture

From GMod Wiki

Revision as of 03:05, 15 October 2009 by Crazy Quebecer (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax surface.SetTexture( [Integer Texture ID] )
Where is this used?
Description:
Sets the texture for all rects drawn in its function until you set the texture again.
Returns: nil
Part of Library: surface
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Surface.SetTexture]Surface.SetTexture [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionDraws the brick texture to the center of the screen.
Used onNewerClient.png
Code
local tex = surface.GetTextureID("Brick/brickfloor001a") // Gets the texture id for the brick texture
local function drawBrickTexture()
	surface.SetTexture(tex)
	surface.SetDrawColor(255,255,255,255) // Makes sure the image draws with all colors
	surface.DrawTexturedRect(ScrW()*0.5-32,ScrH()*0.5-32,64,64)
end
hook.Add("HUDPaint","DrawTheBricks",drawBrickTexture)
OutputN/A


Additional Note

See Also

Surface.GetTextureID

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox