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
: A Vector2
representing the position on the screen where the text will be drawn.text
: A string
containing the text to be displayed.size
: A float
indicating the size of the text.flags
: A TextFlag
enumeration value that specifies text rendering options such as alignment and wrapping.color
: A Color
object that defines the color of the text.duration
: A float
specifying how long the text should remain on the screen, in seconds.transform
: A Transform
object that can be used to apply transformations to the text.// 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.ScreenText(position, message, textSize, textFlags, textColor, displayDuration, textTransform);