surface libraryclient
Summary
Functions
cw.fonts:Add, replacing the engine's surface.CreateFont.Functions
Creates a font through cw.fonts:Add, replacing the engine's surface.CreateFont.
Fonts created this way can be resized with cw.fonts:GetSize. A font name that
already exists is not created again. The engine function is kept as the global
CreateFont.
Parameters
- ... Any The font name and font data
Map, as for the engine function
Runs a drawing callback with everything rotated around a point.
The callback is run in a pcall; its errors are printed rather than raised.
Parameters
- x Number X position of the rotation origin
- y Number Y position of the rotation origin
- angle Number Rotation in degrees
- callback Function Called with
x,yandanglewhile the rotation is active
surface.DrawRotatedText(text, font, x, y, angle, color)
client gamemodes/catwork/gamemode/core/cl_kernel.lua:150Draws text rotated around its top-left corner.
Parameters
- text String The text
- font String Font name
- x Number X position
- y Number Y position
- angle Number Rotation in degrees
- color Color Text color
See also
Runs a drawing callback with everything scaled around a point.
The callback is run in a pcall; its errors are printed rather than raised.
surface.DrawScaled(x, y, 2, function(x, y, scale)
draw.SimpleText('Big', 'DermaDefault', x, y)
end)
Parameters
- x Number X position of the scaling origin
- y Number Y position of the scaling origin
- scale Number Scale factor
- callback Function Called with
x,yandscalewhile the scaling is active
surface.DrawScaledText(text, font, x, y, scale, color)
client gamemodes/catwork/gamemode/core/cl_kernel.lua:126Draws text scaled around its top-left corner.
Parameters
- text String The text
- font String Font name
- x Number X position
- y Number Y position
- scale Number Scale factor
- color Color Text color
See also
Draws text, translating its phrases first.
Overrides surface.DrawText so everything drawn with it, such as draw.SimpleText, is
translated. The original is kept as surface.OldDrawText.
Parameters
- sText String Text to draw; phrases are translated unless
surface.NoTranslateis on
Returns the size of a text, translating its phrases first.
Overrides surface.GetTextSize so measured text matches the drawn translation. The original is
kept as surface.OldGetTextSize.
Parameters
- sText String Text to measure; phrases are translated unless
surface.NoTranslateis on
Returns
- Number The width
- Number The height
Turns automatic translation of drawn text and panel text on or off.
Used to keep text such as the chatbox untranslated.
Parameters
- bValue Boolean
trueto stop translating,falseto translate again