Bounded transient floating-number presentation owned by a game/view. @ownership Owns styles and all live popups; never owns gameplay, fonts or graphics. @thread Owner/render thread only. No callbacks, locks, wall clock or global RNG. @lifetime clear on scene teardown/reload. No persistent format or cross-frame object links. Equal requests and accumulated time give equal samples within 1e-4 pixel floating tolerance. 更多...
#include <DamageNumbers.h>
类 | |
| struct | Impl |
Public 成员函数 | |
| DamageNumbers () | |
| Construct a pool with four built-in styles and 256 reusable slots. | |
| ~DamageNumbers () | |
| DamageNumbers (const DamageNumbers &)=delete | |
| DamageNumbers & | operator= (const DamageNumbers &)=delete |
| Result< void > | setStyle (DamageNumberKind kind, const DamageNumberStyle &style) |
| Validate and replace one future-spawn style; existing entries keep their own copy. | |
| Result< DamageNumberStyle > | style (DamageNumberKind kind) const |
| Return an owning preset copy; invalid enum values fail. | |
| Result< DamageNumberAdmission > | spawn (const DamageNumberRequest &request) |
| Validate and admit one popup. Failure leaves pool and sequence unchanged. | |
| Result< void > | update (double seconds) |
| Advance injected seconds; nonfinite/negative dt fails without mutation. | |
| void | clear () |
| Remove every transient entry; deterministic spawn sequence restarts. | |
| std::size_t | count () const |
| Return live popup count. | |
| std::vector< DamageNumberSample > | snapshot () const |
| Build an independent owning frame snapshot for observation. @cost Linear allocations/copies in live entries, unlike direct render; use only when an owning snapshot is needed. | |
| void | render (Graphics &graphics, Font &font) const |
| Draw live samples centered on x through backend-neutral text quads, with outline/shadow. | |
静态 Public 成员函数 | |
| static constexpr std::size_t | capacity () |
| Fixed maximum live popup budget; overflow replaces the oldest. | |
详细描述
Bounded transient floating-number presentation owned by a game/view. @ownership Owns styles and all live popups; never owns gameplay, fonts or graphics. @thread Owner/render thread only. No callbacks, locks, wall clock or global RNG. @lifetime clear on scene teardown/reload. No persistent format or cross-frame object links. Equal requests and accumulated time give equal samples within 1e-4 pixel floating tolerance.
在文件 DamageNumbers.h 第 62 行定义.
构造及析构函数说明
◆ DamageNumbers() [1/2]
| eve::graphics::DamageNumbers::DamageNumbers | ( | ) |
Construct a pool with four built-in styles and 256 reusable slots.
在文件 DamageNumbers.cpp 第 38 行定义.
引用了 capacity().
◆ ~DamageNumbers()
|
default |
◆ DamageNumbers() [2/2]
|
delete |
成员函数说明
◆ capacity()
|
inlinestaticconstexpr |
Fixed maximum live popup budget; overflow replaces the oldest.
在文件 DamageNumbers.h 第 87 行定义.
被这些函数引用 DamageNumbers() , 以及 spawn().
◆ clear()
| void eve::graphics::DamageNumbers::clear | ( | ) |
Remove every transient entry; deterministic spawn sequence restarts.
在文件 DamageNumbers.cpp 第 119 行定义.
◆ count()
| std::size_t eve::graphics::DamageNumbers::count | ( | ) | const |
Return live popup count.
在文件 DamageNumbers.cpp 第 123 行定义.
被这些函数引用 eve::graphics::exposeFontAndDamageNumberBindings() , 以及 snapshot().
◆ operator=()
|
delete |
◆ render()
Draw live samples centered on x through backend-neutral text quads, with outline/shadow.
- 参数
-
graphics Borrowed active frame renderer; must match font's creating renderer. font Borrowed preloaded atlas containing digits and +-.!KMIS; alive through this call only. @thread Call in the owning render phase; references are not retained, no callbacks. @cost Up to six text passes per live popup; no disk loads, atlas creation or owning snapshot allocation.
在文件 DamageNumbersRender.cpp 第 7 行定义.
引用了 eve::graphics::Font::getWidth(), graphics, p, eve::graphics::DamageNumbers::Impl::sample() , 以及 x.
◆ setStyle()
| Result< void > eve::graphics::DamageNumbers::setStyle | ( | DamageNumberKind | kind, |
| const DamageNumberStyle & | style | ||
| ) |
Validate and replace one future-spawn style; existing entries keep their own copy.
在文件 DamageNumbers.cpp 第 62 行定义.
引用了 kind, style() , 以及 eve::Result< T >::success().
◆ snapshot()
| std::vector< DamageNumberSample > eve::graphics::DamageNumbers::snapshot | ( | ) | const |
Build an independent owning frame snapshot for observation. @cost Linear allocations/copies in live entries, unlike direct render; use only when an owning snapshot is needed.
在文件 DamageNumbers.cpp 第 141 行定义.
引用了 count(), p , 以及 eve::graphics::DamageNumbers::Impl::sample().
◆ spawn()
| Result< DamageNumberAdmission > eve::graphics::DamageNumbers::spawn | ( | const DamageNumberRequest & | request | ) |
Validate and admit one popup. Failure leaves pool and sequence unchanged.
- 返回
- Spawned, Merged (same nonempty group/kind within window and radius), or ReplacedOldest. Merging never extends lifetime, so a continuous damage stream cannot keep an entry forever.
在文件 DamageNumbers.cpp 第 79 行定义.
引用了 capacity(), dx, dy, eve::Result< T >::failure(), label, eve::graphics::Merged, eve::graphics::Miss, p, eve::graphics::ReplacedOldest, request, eve::graphics::Spawned, status, style(), eve::Result< T >::success() , 以及 text.
◆ style()
| Result< DamageNumberStyle > eve::graphics::DamageNumbers::style | ( | DamageNumberKind | kind | ) | const |
Return an owning preset copy; invalid enum values fail.
在文件 DamageNumbers.cpp 第 75 行定义.
引用了 eve::Result< T >::failure(), kind, status , 以及 eve::Result< T >::success().
被这些函数引用 setStyle() , 以及 spawn().
◆ update()
| Result< void > eve::graphics::DamageNumbers::update | ( | double | seconds | ) |
Advance injected seconds; nonfinite/negative dt fails without mutation.
在文件 DamageNumbers.cpp 第 113 行定义.
引用了 p , 以及 eve::Result< T >::success().
该类的文档由以下文件生成:
- src/modules/graphics/DamageNumbers.h
- src/modules/graphics/DamageNumbers.cpp
- src/modules/graphics/DamageNumbersRender.cpp