The ScreenText
method of the DebugOverlaySystem
class is used to draw text on the screen at a specified pixel position. This method is useful for displaying debug information or other text overlays directly on the screen.
The ScreenText
method of the DebugOverlaySystem
class is used to draw text on the screen at a specified pixel position. This method is useful for displaying debug information or other text overlays directly on the screen.
To use the ScreenText
method, you need to provide the following parameters:
pixelPosition
(Vector2
): The position on the screen where the text will be drawn, specified in pixel coordinates.text
(System.String
): The text string to be displayed on the screen.size
(System.Single
): The size of the text.flags
(Sandbox.TextFlag
): Flags that determine the text rendering options, such as alignment and wrapping.color
(Color
): The color of the text.duration
(System.Single
): The duration for which the text will be displayed on the screen, in seconds.transform
(Transform
): The transform to apply to the text, allowing for rotation and scaling.// Example of using ScreenText to display a message on the screen Vector2 position = new Vector2(100, 200); string message = "Hello, Sandbox!"; float textSize = 12.0f; TextFlag textFlags = TextFlag.Center; Color textColor = Color.White; float displayDuration = 5.0f; Transform textTransform = Transform.Identity; DebugOverlaySystem debugOverlay = new DebugOverlaySystem(); debugOverlay.ScreenText(position, message, textSize, textFlags, textColor, displayDuration, textTransform);