WEAPON:DrawWeaponSelection

From Garry's Mod
Jump to: navigation, search
 WEAPON:DrawWeaponSelection( )

Contents

Description

This hook draws the selection icon in the weapon selection menu.

Arguments

number x

X coordinate of the selection panel

Arguments

number y

Y coordinate of the selection panel

Arguments

number width

Width of the selection panel

Arguments

number height

Height of the selection panel

Arguments

number alpha

Alpha value of the selection panel

Examples

Example

As defined in weapon_base

function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha )
	
	-- Set us up the texture
	surface.SetDrawColor( 255, 255, 255, alpha )
	surface.SetTexture( self.WepSelectIcon )
	
	-- Lets get a sin wave to make it bounce
	local fsin = 0
	
	if ( self.BounceWeaponIcon == true ) then
		fsin = math.sin( CurTime() * 10 ) * 5
	end
	
	-- Borders
	y = y + 10
	x = x + 10
	wide = wide - 20
	
	-- Draw that mother
	surface.DrawTexturedRect( x + (fsin), y - (fsin),  wide-fsin*2 , ( wide / 2 ) + (fsin) )
	
	-- Draw weapon info box
	self:PrintWeaponInfo( x + wide + 20, y + tall * 0.95, alpha )
	
end


Personal tools
Navigation