C# Класс GarrysModLuaShared.surface

The surface library allows you to draw text and shapes on the screen. Primarily used for making HUDs & custom GUI panels.
Показать файл Открыть проект

Открытые методы

Метод Описание
DisableClipping ( LuaState luaState, bool disable ) : void

Enables or disables the clipping used by the VGUI that limits the drawing operations to a panels bounds.

DrawLine ( LuaState luaState, uint startX, uint startY, uint endX, uint endY ) : void

Draws a line from one point to another.

DrawOutlinedRect ( LuaState luaState, uint x, uint y, uint width, uint height ) : void

Draws a hollow box with a border width of 1 px.

DrawRect ( LuaState luaState, uint x, uint y, uint width, uint height ) : void

Draws a solid rectangle on the screen.

DrawText ( LuaState luaState, string text ) : void

Draw the specified text on the screen, using the previously set position, font and color.

DrawTexturedRect ( LuaState luaState, uint x, uint y, uint width, uint height ) : void

Draw a textured rectangle with the given position and dimensions on the screen, using the current active texture.

DrawTexturedRectRotated ( LuaState luaState, uint x, uint y, uint width, uint height, double rotation ) : void

Draw a textured rotated rectangle with the given position and dimensions and angle on the screen, using the current active texture.

DrawTexturedRectUV ( LuaState luaState, uint x, uint y, uint width, uint height, double startU, double startV, double endU, double endV ) : void

Draws a textured rectangle with a repeated or partial texture. U and V refer to texture coordinates. 0,0 is the bottom left corner of the texture, 1,0 is the bottom right, 1,1 is the top right and 0,1 is the top left. If you are using a .png image, you must supply "noclamp" as second parameter for Global.Material. Using a start point of(1,0) and an end point to(0,1), you can draw an image flipped horizontally, etc with other directions.

GetTextSize ( LuaState luaState, string text ) : int>.Tuple

Returns the width and height (in pixels) of the given text, but only if the font has been set with SetFont.

GetTextSize ( LuaState luaState, string text, int &width, int &height ) : void

Returns the width and height (in pixels) of the given text, but only if the font has been set with SetFont.

GetTextureID ( LuaState luaState, string nameOrPath ) : uint

Returns the texture ID of the texture with the given name/path.

GetTextureSize ( LuaState luaState, uint textureId ) : int>.Tuple

Returns the size of the texture with the associated texture ID.

GetTextureSize ( LuaState luaState, uint textureId, int &width, int &height ) : void

Returns the size of the texture with the associated texture ID.

PlaySound ( LuaState luaState, string soundFile ) : void

Play a sound file directly on the client (such as UI sounds, etc).

SetAlphaMultiplier ( LuaState luaState, double multiplier ) : void

Sets a multiplier that will influence all upcoming drawing operations.

SetDrawColor ( LuaState luaState, byte r, byte g, byte b, byte a = byte.MaxValue ) : void

Set the color of any future shapes to be drawn.

SetFont ( LuaState luaState, string fontName ) : void

Set the current font to be used for text operations later.

SetTextColor ( LuaState luaState, byte r, byte g, byte b, byte a = byte.MaxValue ) : void

Set the color of any future text to be drawn.

SetTextPos ( LuaState luaState, uint x, uint y ) : void

Set the position to draw any future text.

SetTexture ( LuaState luaState, uint textureId ) : void

Sets the texture to be used in all upcoming surface draw operations.

Описание методов

DisableClipping() публичный статический Метод

Enables or disables the clipping used by the VGUI that limits the drawing operations to a panels bounds.
public static DisableClipping ( LuaState luaState, bool disable ) : void
luaState LuaState Pointer to lua_State struct.
disable bool True to disable, false to enable the clipping.
Результат void

DrawLine() публичный статический Метод

Draws a line from one point to another.
public static DrawLine ( LuaState luaState, uint startX, uint startY, uint endX, uint endY ) : void
luaState LuaState Pointer to lua_State struct.
startX uint The start X coordinate.
startY uint The start Y coordinate.
endX uint The end X coordinate.
endY uint The end Y coordinate.
Результат void

DrawOutlinedRect() публичный статический Метод

Draws a hollow box with a border width of 1 px.
public static DrawOutlinedRect ( LuaState luaState, uint x, uint y, uint width, uint height ) : void
luaState LuaState Pointer to lua_State struct.
x uint The start X coordinate.
y uint The start Y coordinate.
width uint The width.
height uint The height.
Результат void

DrawRect() публичный статический Метод

Draws a solid rectangle on the screen.
public static DrawRect ( LuaState luaState, uint x, uint y, uint width, uint height ) : void
luaState LuaState Pointer to lua_State struct.
x uint The X co-ordinate.
y uint The Y co-ordinate.
width uint The width of the rectangle.
height uint The height of the rectangle.
Результат void

DrawText() публичный статический Метод

Draw the specified text on the screen, using the previously set position, font and color.
public static DrawText ( LuaState luaState, string text ) : void
luaState LuaState Pointer to lua_State struct.
text string The text to be rendered.
Результат void

DrawTexturedRect() публичный статический Метод

Draw a textured rectangle with the given position and dimensions on the screen, using the current active texture.
public static DrawTexturedRect ( LuaState luaState, uint x, uint y, uint width, uint height ) : void
luaState LuaState Pointer to lua_State struct.
x uint The X co-ordinate.
y uint The Y co-ordinate.
width uint The width of the rectangle.
height uint The height of the rectangle.
Результат void

DrawTexturedRectRotated() публичный статический Метод

Draw a textured rotated rectangle with the given position and dimensions and angle on the screen, using the current active texture.
public static DrawTexturedRectRotated ( LuaState luaState, uint x, uint y, uint width, uint height, double rotation ) : void
luaState LuaState Pointer to lua_State struct.
x uint The X co-ordinate, representing the center of the rectangle.
y uint The Y co-ordinate, representing the center of the rectangle.
width uint The width of the rectangle.
height uint The height of the rectangle.
rotation double The rotation of the rectangle, in degrees.
Результат void

DrawTexturedRectUV() публичный статический Метод

Draws a textured rectangle with a repeated or partial texture. U and V refer to texture coordinates. 0,0 is the bottom left corner of the texture, 1,0 is the bottom right, 1,1 is the top right and 0,1 is the top left. If you are using a .png image, you must supply "noclamp" as second parameter for Global.Material. Using a start point of(1,0) and an end point to(0,1), you can draw an image flipped horizontally, etc with other directions.
public static DrawTexturedRectUV ( LuaState luaState, uint x, uint y, uint width, uint height, double startU, double startV, double endU, double endV ) : void
luaState LuaState Pointer to lua_State struct.
x uint The X coordinate.
y uint The Y coordinate.
width uint The width of the rectangle.
height uint The height of the rectangle.
startU double The U texture mapping of the rect origin.
startV double The V texture mapping of the rect origin.
endU double The U texture mapping of the rect end.
endV double The V texture mapping of the rect end.
Результат void

GetTextSize() публичный статический Метод

Returns the width and height (in pixels) of the given text, but only if the font has been set with SetFont.
public static GetTextSize ( LuaState luaState, string text ) : int>.Tuple
luaState LuaState Pointer to lua_State struct.
text string The string to check the size of.
Результат int>.Tuple

GetTextSize() публичный статический Метод

Returns the width and height (in pixels) of the given text, but only if the font has been set with SetFont.
public static GetTextSize ( LuaState luaState, string text, int &width, int &height ) : void
luaState LuaState Pointer to lua_State struct.
text string The string to check the size of.
width int Width of in pixels.
height int Height of in pixels.
Результат void

GetTextureID() публичный статический Метод

Returns the texture ID of the texture with the given name/path.
public static GetTextureID ( LuaState luaState, string nameOrPath ) : uint
luaState LuaState Pointer to lua_State struct.
nameOrPath string Name or path of the texture.
Результат uint

GetTextureSize() публичный статический Метод

Returns the size of the texture with the associated texture ID.
public static GetTextureSize ( LuaState luaState, uint textureId ) : int>.Tuple
luaState LuaState Pointer to lua_State struct.
textureId uint The texture ID.
Результат int>.Tuple

GetTextureSize() публичный статический Метод

Returns the size of the texture with the associated texture ID.
public static GetTextureSize ( LuaState luaState, uint textureId, int &width, int &height ) : void
luaState LuaState Pointer to lua_State struct.
textureId uint The texture ID.
width int The width of texture.
height int The height of texture.
Результат void

PlaySound() публичный статический Метод

Play a sound file directly on the client (such as UI sounds, etc).
public static PlaySound ( LuaState luaState, string soundFile ) : void
luaState LuaState Pointer to lua_State struct.
soundFile string The path to the sound file.
Результат void

SetAlphaMultiplier() публичный статический Метод

Sets a multiplier that will influence all upcoming drawing operations.
public static SetAlphaMultiplier ( LuaState luaState, double multiplier ) : void
luaState LuaState Pointer to lua_State struct.
multiplier double The multiplier ranging from 0 to 1.
Результат void

SetDrawColor() публичный статический Метод

Set the color of any future shapes to be drawn.
public static SetDrawColor ( LuaState luaState, byte r, byte g, byte b, byte a = byte.MaxValue ) : void
luaState LuaState Pointer to lua_State struct.
r byte The red value of color.
g byte The green value of color.
b byte The blue value of color.
a byte The alpha value of color.
Результат void

SetFont() публичный статический Метод

Set the current font to be used for text operations later.
public static SetFont ( LuaState luaState, string fontName ) : void
luaState LuaState Pointer to lua_State struct.
fontName string The name of the font to use.
Результат void

SetTextColor() публичный статический Метод

Set the color of any future text to be drawn.
public static SetTextColor ( LuaState luaState, byte r, byte g, byte b, byte a = byte.MaxValue ) : void
luaState LuaState Pointer to lua_State struct.
r byte The red value of color.
g byte The green value of color.
b byte The blue value of color.
a byte The alpha value of color.
Результат void

SetTextPos() публичный статический Метод

Set the position to draw any future text.
public static SetTextPos ( LuaState luaState, uint x, uint y ) : void
luaState LuaState Pointer to lua_State struct.
x uint The X co-ordinate.
y uint The Y co-ordinate.
Результат void

SetTexture() публичный статический Метод

Sets the texture to be used in all upcoming surface draw operations.
public static SetTexture ( LuaState luaState, uint textureId ) : void
luaState LuaState Pointer to lua_State struct.
textureId uint The ID of the texture to draw with.
Результат void