Overlay module

What the game shows over the play: the pickups that slide in, the cinematic bars, and the caption and the arrows that the inventory ring, a demo or an FMV asks for. The shipped scripts draw all of it; the signals here say what to draw.

Properties

  • trx.overlay.has_letterbox (boolean). Whether the cinematic bars take any of the screen. It stays true while they move, so a script can hold something back until they have gone. (read-only)
  • trx.overlay.letterbox (number). How deep the cinematic bars are asked to be, as a fraction of the screen height each, from 0 to 0.5. Setting it slides the bars there; 0 takes them away. Flyby cameras and cutscenes set it too, and the last request wins. trx.ui.working_area follows the bars as they move.
  • trx.overlay.signals.caption (trx.signal.Signal). Holds the caption at the bottom of the screen, such as the name of the entry under the cursor of the inventory ring, in the player's language, or nil for none. (read-only)
  • trx.overlay.signals.caption_flashing (trx.signal.Signal). Holds whether the caption flashes, as it does while a demo plays. (read-only)
  • trx.overlay.signals.arrows (trx.signal.Signal). Holds the arrows on screen, as a table that maps each trx.overlay.Arrow that shows to true. (read-only)
  • trx.overlay.signals.version_shown (trx.signal.Signal). Holds whether the game asks for its version on screen, as the title screen does. The ui.show_title_version setting decides whether it shows. (read-only)
  • trx.overlay.signals.letterbox (trx.signal.Signal). Says when the cinematic bars take the screen and when they give it back. True while they are moving, so a script can hold something back until they have gone. (read-only)

Enums

  • trx.overlay.Arrow

    An arrow the interface can show.

    • trx.overlay.Arrow.TOP_LEFT
      The top-left screen corner.
    • trx.overlay.Arrow.TOP_RIGHT
      The top-right screen corner.
    • trx.overlay.Arrow.BOTTOM_LEFT
      The bottom-left screen corner.
    • trx.overlay.Arrow.BOTTOM_RIGHT
      The bottom-right screen corner.
    • trx.overlay.Arrow.CAPTION_LEFT
      To the left of the caption.
    • trx.overlay.Arrow.CAPTION_RIGHT
      To the right of the caption.

Functions

  • trx.overlay.signals
    What the overlay tells a script, for the parts of it a script draws.

  • trx.overlay.set_caption([text], [opts])
    Sets the caption at the bottom of the screen.

    The inventory ring uses it for the selected entry. The text shows as given, so the caller styles it. The caption reduces the safe area. Passing no value removes it.

    Parameters:

    • text (string or trx.locale.Text, optional). Text to show. A trx.locale.Text follows the player's language. Omit this parameter to remove the caption.

    • opts (table, optional). How it shows.

      Keys:

      • flashing (boolean, optional). Whether the caption flashes, as it does while a demo plays. false by default.

    Example:

    trx.overlay.set_caption(trx.locale.get("general/misc/demo_mode"), {
      flashing = true,
    })
    
  • trx.overlay.show_version(shown)
    Asks for the game's version on screen, as the title screen does. The ui.show_title_version setting decides whether it shows.

    Parameters:

    • shown (boolean). Whether it is asked for.
  • trx.overlay.show_arrow(arrow, shown)
    Shows or hides an interface arrow.

    The caption arrows stand beside the caption that trx.overlay.set_caption sets.

    Parameters:

    • arrow (trx.overlay.Arrow). Which arrow to show.
    • shown (boolean). Whether it is on screen.
  • trx.overlay.show_pickup(object)
    Shows an object in the bottom-right corner of the screen, as the game shows a pickup Lara collects. It fires trx.events.on_show_pickup, which the shipped scripts answer by playing the secret music for a secret.

    It does not add the object to Lara's inventory. Use trx.inventory.Inventory:give for that.

    Parameters:

    Example:

    trx.overlay.show_pickup(trx.catalog.objects.KEY_ITEM_1)