cw.cooldown classclient
Defines the client-side cw.cooldown library, which draws a cooldown box that fills clockwise with progress.
cw.cooldown:DrawBox draws it; the polygon tables it needs are built once per box size and cached.
Summary
Methods
AddSize(width, height)client
Builds and caches the polygon table for a cooldown box size.
Draws a cooldown box that fills clockwise as progress goes from 0 to 100.
Returns the cached polygon table for a cooldown box size.
Methods
cw.cooldown:AddSize(width, height)
client gamemodes/catwork/gamemode/core/libraries/cl_cooldown.lua:32Builds and caches the polygon table for a cooldown box size.
The box is split into eight octants so it can be drawn partially filled. Sizes 64x64 and 32x32 are added when the file loads.
Parameters
- width Number Width of the cooldown box
- height Number Height of the cooldown box
Returns
- Map The new cooldown table with
verticiesandeditTablekeys
cw.cooldown:DrawBox(x, y, width, height, progress, color, textureID, bCenter)
client gamemodes/catwork/gamemode/core/libraries/cl_cooldown.lua:110Draws a cooldown box that fills clockwise as progress goes from 0 to 100.
Must be called from a 2D rendering hook. The size is cached on first use.
cw.cooldown:DrawBox(x, y, 64, 64, percentage, Color(255, 255, 255, 100), surface.GetTextureID('vgui/white'))
Parameters
- x Number Horizontal position of the box
- y Number Vertical position of the box
- width Number Width of the cooldown box
- height Number Height of the cooldown box
- progress Number Progress of the cooldown, from 0 to 100
- color Color Color of the box
- textureID Number Texture ID to draw with, from
surface.GetTextureID - bCenter Boolean optional, defaults to
nilWhetherxandyare the center of the box instead of its top left corner
cw.cooldown:GetTable(width, height, bAdd)
client gamemodes/catwork/gamemode/core/libraries/cl_cooldown.lua:15Returns the cached polygon table for a cooldown box size.
Parameters
- width Number Width of the cooldown box
- height Number Height of the cooldown box
- bAdd Boolean optional, defaults to
nilWhether to create the table withcw.cooldown:AddSizeif it does not exist
Returns
- Map The cooldown table with
verticiesandeditTablekeys, ornilif the size is not cached andbAddis not set