OpenTTD Source: src/texteff.cpp File Reference

OpenTTD Source 15.0-RC2

Data Structures | Functions | Variables
texteff.cpp File Reference

Handling of text effects. More...

`#include "stdafx.h"`
`#include "texteff.hpp"`
`#include "transparency.h"`
`#include "strings_func.h"`
`#include "viewport_func.h"`
`#include "settings_type.h"`
`#include "command_type.h"`
`#include "timer/timer.h"`
`#include "timer/timer_window.h"`
`#include "safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | TextEffect
| Container for all information about a text effect. More...

## Functions
TextEffectID | AddTextEffect (EncodedString &&msg, int center, int y, uint8_t duration, TextEffectMode mode)
void | UpdateTextEffect (TextEffectID te_id, EncodedString &&msg)
void | UpdateAllTextEffectVirtCoords ()
void | RemoveTextEffect (TextEffectID te_id)
void | InitTextEffects ()
void | DrawTextEffects (DrawPixelInfo *dpi)

## Variables
static std::vector< TextEffect > | _text_effects
| Text effects are stored there.
const IntervalTimer< TimerWindow > | move_all_text_effects_interval
| Slowly move text effects upwards.

## Detailed Description

Handling of text effects.

Definition in file texteff.cpp.

## Function Documentation

## ◆ AddTextEffect()

TextEffectID AddTextEffect | ( | EncodedString && | msg,
|  | int | center,
|  | int | y,
|  | uint8_t | duration,
|  | TextEffectMode | mode
| ) |  |

Definition at line 42 of file texteff.cpp.

## ◆ DrawTextEffects()

void DrawTextEffects | ( | DrawPixelInfo * | dpi | ) |

Definition at line 117 of file texteff.cpp.

## ◆ InitTextEffects()

void InitTextEffects | ( |  | ) |

Definition at line 111 of file texteff.cpp.

## ◆ RemoveTextEffect()

void RemoveTextEffect | ( | TextEffectID | te_id | ) |

Definition at line 86 of file texteff.cpp.

## ◆ UpdateAllTextEffectVirtCoords()

void UpdateAllTextEffectVirtCoords | ( |  | ) |

Definition at line 77 of file texteff.cpp.

## ◆ UpdateTextEffect()

void UpdateTextEffect | ( | TextEffectID | te_id,
|  | EncodedString && | msg
| ) |  |

Definition at line 67 of file texteff.cpp.

## Variable Documentation

## ◆ _text_effects

std::vector<TextEffect> _text_effects
| static

Text effects are stored there.

Definition at line 39 of file texteff.cpp.

## ◆ move_all_text_effects_interval

const IntervalTimer<TimerWindow> move_all_text_effects_interval

Initial value:
= {std::chrono::milliseconds(30), [](uint count) {
if (_pause_mode.Any() && _game_mode != GM_EDITOR && _settings_game.construction.command_pause_level <= CommandPauseLevel::NoConstruction) return;
for (TextEffect &te : _text_effects) {
if (!te.IsValid()) continue;
if (te.mode != TE_RISING) continue;
if (te.duration < count) {
te.Reset();
continue;
}
te.MarkDirty(ZoomLevel::TextEffect);
te.duration -= count;
te.top -= count * ZOOM_BASE;
te.MarkDirty(ZoomLevel::TextEffect);
}
}}
BaseBitSet::Any
constexpr bool Any(const Timpl &other) const
Test if any of the given values are set.
Definition base_bitset_type.hpp:170
CommandPauseLevel::NoConstruction
@ NoConstruction
No construction actions may be executed.
_pause_mode
PauseModes _pause_mode
The current pause mode.
Definition gfx.cpp:50
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition settings.cpp:61
ConstructionSettings::command_pause_level
CommandPauseLevel command_pause_level
level/amount of commands that can't be executed while paused
Definition settings_type.h:425
GameSettings::construction
ConstructionSettings construction
construction of things in-game
Definition settings_type.h:635
TextEffect
Container for all information about a text effect.
Definition texteff.cpp:23
_text_effects
static std::vector< TextEffect > _text_effects
Text effects are stored there.
Definition texteff.cpp:39
TE_RISING
@ TE_RISING
Make the text effect slowly go upwards.
Definition texteff.hpp:22
ZoomLevel::TextEffect
@ TextEffect
All zoom levels above this will not show text effects.

Slowly move text effects upwards.

Definition at line 92 of file texteff.cpp.