Garry's Mod Wiki

WEAPON:DrawWeaponSelection

  WEAPON:DrawWeaponSelection( number x, number y, number width, number height, number alpha )

Description

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

Arguments

1 number x
X coordinate of the selection panel
2 number y
Y coordinate of the selection panel
3 number width
Width of the selection panel
4 number height
Height of the selection panel
5 number alpha
Alpha value of the selection panel

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