Module BaseTextSubtitleDisplay
Provides the BaseTextSubtitleDisplay class, a base class for subtitle displays using text HUDs.
Class BaseTextSubtitleDisplay
subtitles.BaseTextSubtitleDisplay:remove_entry (entry) | Removes a subtitle entry. |
subtitles.BaseTextSubtitleDisplay:get_free_slot () | Returns the next available slot. |
subtitles.BaseTextSubtitleDisplay:get_huds (entry) | Generates the HUDs to display a subtitle entry. |
subtitles.BaseTextSubtitleDisplay:get_hud_defaults (entry) | Returns the default properties for a HUD for the specified entry. |
Class BaseTextSubtitleDisplay.Entry
subtitles.BaseTextSubtitleDisplay.Entry:new (display, sound, slot) | Constructor. |
subtitles.BaseTextSubtitleDisplay.Entry:show () | Shows or updates the subtitle. |
subtitles.BaseTextSubtitleDisplay.Entry:hide () | Hides the subtitle. |
subtitles.BaseTextSubtitleDisplay.Entry:get_offset () | Gets the entry's offset based on its slot. |
subtitles.BaseTextSubtitleDisplay.Entry:get_distance_shade () | Returns a shade representing the distance of the sound from the player. |
subtitles.BaseTextSubtitleDisplay.Entry:get_pan () | Calculates which direction the sound is in from the player's perspective, and how far. |
subtitles.BaseTextSubtitleDisplay.Entry:ref () | Increases the entry's reference count. |
subtitles.BaseTextSubtitleDisplay.Entry:unref () | Decreases the entry's reference count, possibly removing it. |
Class BaseTextSubtitleDisplay
A base class for subtitle displays using text HUDs.
- subtitles.BaseTextSubtitleDisplay:remove_entry (entry)
-
Removes a subtitle entry.
Parameters:
- entry The `Entry` object to remove.
- subtitles.BaseTextSubtitleDisplay:get_free_slot ()
-
Returns the next available slot.
Returns:
-
The slot index, starting from 1.
- subtitles.BaseTextSubtitleDisplay:get_huds (entry)
-
Generates the HUDs to display a subtitle entry.
Parameters:
- entry The `Entry` object.
Returns:
-
A table of {hud_key1 = hud_def1, hud_key2 = hud_def2}.
HUD keys can be strings or integers.
- subtitles.BaseTextSubtitleDisplay:get_hud_defaults (entry)
-
Returns the default properties for a HUD for the specified entry.
Parameters:
- entry An `Entry` object.
Returns:
-
A partial HUD definition.
Class BaseTextSubtitleDisplay.Entry
Represents a single subtitle.
- subtitles.BaseTextSubtitleDisplay.Entry:new (display, sound, slot)
-
Constructor.
Parameters:
- display The `SubtitleDisplay` object.
- sound The `Sound` object.
- slot The integer subtitle slot.
- subtitles.BaseTextSubtitleDisplay.Entry:show ()
- Shows or updates the subtitle.
- subtitles.BaseTextSubtitleDisplay.Entry:hide ()
- Hides the subtitle.
- subtitles.BaseTextSubtitleDisplay.Entry:get_offset ()
-
Gets the entry's offset based on its slot.
Returns:
-
A table of {x: integer, y: integer}.
- subtitles.BaseTextSubtitleDisplay.Entry:get_distance_shade ()
-
Returns a shade representing the distance of the sound from the player.
Returns:
-
A number from 0.0 to 1.0.
- subtitles.BaseTextSubtitleDisplay.Entry:get_pan ()
-
Calculates which direction the sound is in from the player's perspective, and how far.
Returns:
-
A number from -1.0 (far left) to 1.0 (far right).
- subtitles.BaseTextSubtitleDisplay.Entry:ref ()
- Increases the entry's reference count.
- subtitles.BaseTextSubtitleDisplay.Entry:unref ()
- Decreases the entry's reference count, possibly removing it.