OpenTTD Source  20241109-master-g5e4f8db7d6
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 (StringID msg, int center, int y, uint8_t duration, TextEffectMode mode)
 
void UpdateTextEffect (TextEffectID te_id, StringID msg)
 
void UpdateAllTextEffectVirtCoords ()
 
void RemoveTextEffect (TextEffectID te_id)
 
void InitTextEffects ()
 
void DrawTextEffects (DrawPixelInfo *dpi)
 

Variables

static std::vector< struct TextEffect_text_effects
 Text effects are stored there.
 
IntervalTimer< TimerWindowmove_all_text_effects_interval
 Slowly move text effects upwards. More...
 

Detailed Description

Handling of text effects.

Definition in file texteff.cpp.

Variable Documentation

◆ move_all_text_effects_interval

IntervalTimer<TimerWindow> move_all_text_effects_interval
Initial value:
= {std::chrono::milliseconds(30), [](uint count) {
for (TextEffect &te : _text_effects) {
if (te.string_id == INVALID_STRING_ID) continue;
if (te.mode != TE_RISING) continue;
if (te.duration < count) {
te.Reset();
continue;
}
te.MarkDirty(ZOOM_LVL_TEXT_EFFECT);
te.duration -= count;
te.top -= count * ZOOM_BASE;
te.MarkDirty(ZOOM_LVL_TEXT_EFFECT);
}
}}
@ CMDPL_NO_CONSTRUCTION
No construction actions may be executed.
Definition: command_type.h:430
PauseMode _pause_mode
The current pause mode.
Definition: gfx.cpp:50
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:57
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
Definition: strings_type.h:17
uint8_t command_pause_level
level/amount of commands that can't be executed while paused
ConstructionSettings construction
construction of things in-game
Container for all information about a text effect.
Definition: texteff.cpp:23
static std::vector< struct TextEffect > _text_effects
Text effects are stored there.
Definition: texteff.cpp:38
@ TE_RISING
Make the text effect slowly go upwards.
Definition: texteff.hpp:21
@ ZOOM_LVL_TEXT_EFFECT
All zoom levels above this will not show text effects.
Definition: zoom_type.h:39

Slowly move text effects upwards.

Definition at line 93 of file texteff.cpp.