Class DisplayString

A string appearing on the screen.

Can be used for subtitles and "2001, somewhere in Egypt"-style messages.

Uses screen-space coordinates, with x values specifying the number of pixels from the left of the window, and y values specifying the number of pixels from the top of the window.

Since different players will have different resolutions, you should work in terms of percentages where possible, and use ScreenToPercent and PercentToScreen when you need to use screen-space coordinates.

Members

col (Color) RBG color
key (string) String key to use.

Functions

DisplayString.new(str, x, y, color, flags, translated) Create a DisplayString.
DisplayString:SetPos(x, y) Set the position of the string.
DisplayString:GetPos() Get the position of the string.


Members

col
(Color) RBG color
key
(string) String key to use. If translated is true when DisplayString.new is called, this will be the string key for the translation that will be displayed. If false or omitted, this will be the string that's displayed.

Functions

DisplayString.new(str, x, y, color, flags, translated)
Create a DisplayString. For use in ShowString and HideString.

Parameters:

  • str string string to print or key of translated string
  • x int x-coordinate of top-left of string (or the center if DisplayStringOption.CENTER is given)
  • y int y-coordinate of top-left of string (or the center if DisplayStringOption.CENTER is given)
  • color Color the color of the text
  • flags table a table of display options. Can be empty or omitted. The possible values and their effects are...

    DisplayStringOption.CENTER -- see x and y parameters
    DisplayStringOption.SHADOW -- will give the text a small shadow
    

    Default: empty

  • translated bool if false or omitted, the str argument will be printed. If true, the str argument will be the key of a translated string specified in strings.lua. Default: false.

Returns:

    A new DisplayString object.
DisplayString:SetPos(x, y)
Set the position of the string. Screen-space coordinates are expected.

Parameters:

  • x int x-coordinate of the string
  • y int y-coordinate of the string
DisplayString:GetPos()
Get the position of the string. Screen-space coordinates are returned.

Returns:

  1. int x x-coordinate of the string
  2. int y y-coordinate of the string
generated by LDoc 1.4.6 Last updated 2022-01-15 12:32:01