Files
palladium/source/ultra/elems/text.cpp
T

23 lines
684 B
C++
Raw Normal View History

2026-04-03 12:43:49 +02:00
#include <pd/ultra/container.hpp>
2026-03-26 21:02:10 +01:00
#include <pd/ultra/elems/text.hpp>
namespace PD {
namespace Ultra {
PD_API void Text::Draw(PD::Li::Drawlist& l) {
2026-04-03 12:43:49 +02:00
if (!pFont) return;
l.SetFont(pFont);
2026-04-03 15:17:43 +02:00
l.SetFontscale(pParent->GetCanvas().VTranslateFontscale(pFontScale));
2026-04-02 23:29:53 +02:00
l.DrawText(pRenderspace.TopLeft(), pText.c_str(), pColor);
2026-03-26 21:02:10 +01:00
}
2026-04-03 12:43:49 +02:00
PD_API void Text::Update() {
if (!pFont) return;
if (!pParent) ElementBase::Update();
pRenderspace = pParent->GetCanvas().VTranslateObject(
pParent->GetTopLeft() + pPos,
2026-04-03 15:17:43 +02:00
pFont->GetTextBounds(
pText.c_str(), pParent->GetCanvas().VTranslateFontscale(pFontScale)),
2026-04-03 12:43:49 +02:00
pAlignment, true);
}
2026-03-26 21:02:10 +01:00
} // namespace Ultra
} // namespace PD