C# Class GarrysModLuaShared.surface

The surface library allows you to draw text and shapes on the screen. Primarily used for making HUDs & custom GUI panels.
Afficher le fichier Open project: OmegaExtern/gmod-csharp-binary-module

Méthodes publiques

Méthode Description
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.

Method Details

DisableClipping() public static méthode

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.
Résultat void

DrawLine() public static méthode

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.
Résultat void

DrawOutlinedRect() public static méthode

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.
Résultat void

DrawRect() public static méthode

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.
Résultat void

DrawText() public static méthode

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.
Résultat void

DrawTexturedRect() public static méthode

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.
Résultat void

DrawTexturedRectRotated() public static méthode

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.
Résultat void

DrawTexturedRectUV() public static méthode

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.
Résultat void

GetTextSize() public static méthode

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.
Résultat int>.Tuple

GetTextSize() public static méthode

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.
Résultat void

GetTextureID() public static méthode

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.
Résultat uint

GetTextureSize() public static méthode

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.
Résultat int>.Tuple

GetTextureSize() public static méthode

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.
Résultat void

PlaySound() public static méthode

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.
Résultat void

SetAlphaMultiplier() public static méthode

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.
Résultat void

SetDrawColor() public static méthode

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.
Résultat void

SetFont() public static méthode

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.
Résultat void

SetTextColor() public static méthode

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.
Résultat void

SetTextPos() public static méthode

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.
Résultat void

SetTexture() public static méthode

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.
Résultat void