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

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:32

Builds 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 verticies and editTable keys

cw.cooldown:DrawBox(x, y, width, height, progress, color, textureID, bCenter)

client gamemodes/catwork/gamemode/core/libraries/cl_cooldown.lua:110

Draws 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 nil Whether x and y are 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:15

Returns 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 nil Whether to create the table with cw.cooldown:AddSize if it does not exist

Returns

  • Map The cooldown table with verticies and editTable keys, or nil if the size is not cached and bAdd is not set

Defined in