载入中...
搜索中...
未找到
DamageNumbersRender.cpp
浏览该文件的文档.
1// eve-hot-path
3#include "graphics/Font.h"
4#include "graphics/Graphics.h"
5
6namespace eve::graphics {
7void DamageNumbers::render(Graphics& graphics, Font& font) const {
8 for (const auto& popup : impl_->items) {
9 const auto p = Impl::sample(popup);
10 if (p.alpha <= 0.f) continue;
11 const float x = p.x - font.getWidth(p.text) * p.scale * 0.5f;
12 const Color dark(0.025f, 0.02f, 0.04f, p.alpha * 0.9f);
13 graphics.drawText(&font, p.text, x + 2.f, p.y + 3.f, dark, p.scale);
14 if (p.outline > 0.f) {
15 graphics.drawText(&font, p.text, x - p.outline, p.y, dark, p.scale);
16 graphics.drawText(&font, p.text, x + p.outline, p.y, dark, p.scale);
17 graphics.drawText(&font, p.text, x, p.y - p.outline, dark, p.scale);
18 graphics.drawText(&font, p.text, x, p.y + p.outline, dark, p.scale);
19 }
20 graphics.drawText(&font, p.text, x, p.y, Color(p.r, p.g, p.b, p.alpha), p.scale);
21 }
22}
23} // namespace eve::graphics
double x
glm::vec4 p[6]
Graphics * graphics
void render(Graphics &graphics, Font &font) const
Draw live samples centered on x through backend-neutral text quads, with outline/shadow.
GPU-side font: wraps a decoded font::FontData and rasterizes a fixed set of codepoints into a single ...
Definition Font.h:35
float getWidth(const std::string &text) const
Pixel width of text (UTF-8), including kerning; delegates to FontData.
Definition Font.cpp:176
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
eve::Color Color
RGBA color used by every graphics draw call. Lives inside eve::graphics so including a graphics heade...
Definition Color.h:13
static DamageNumberSample sample(const Popup &popup)