Garry's Mod Wiki

Revision Difference

WEAPON:DrawWeaponSelection#553205

<function name="DrawWeaponSelection" parent="WEAPON" type="hook"> <ishook>yes</ishook>⤶ <description>This hook draws the selection icon in the weapon selection menu.</description> <realm>Client</realm> <args> <arg name="x" type="number">X coordinate of the selection panel</arg> <arg name="y" type="number">Y coordinate of the selection panel</arg> <arg name="width" type="number">Width of the selection panel</arg> <arg name="height" type="number">Height of the selection panel</arg> <arg name="alpha" type="number">Alpha value of the selection panel</arg> </args> </function> <example> <description>As defined in weapon_base</description> <code> 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 </code> </example>