WIP: Add CLipRects to UI7 Layouts

- Added Scissor Support to Font Rendering
This commit is contained in:
2026-01-28 07:11:56 +01:00
parent 090656b30c
commit 21b45f5855
10 changed files with 34 additions and 14 deletions

View File

@@ -288,7 +288,7 @@ PD_API void DrawList::DrawText(const fvec2& pos, const std::string& text,
if (!pCurrentFont) {
return;
}
pCurrentFont->CmdTextEx(pPool, pos, color, pFontScale, text);
pCurrentFont->CmdTextEx(*this, pos, color, pFontScale, text);
}
PD_API void DrawList::DrawTextEx(const fvec2& p, const std::string& text,
@@ -297,7 +297,7 @@ PD_API void DrawList::DrawTextEx(const fvec2& p, const std::string& text,
if (!pCurrentFont) {
return;
}
pCurrentFont->CmdTextEx(pPool, p, color, pFontScale, text, flags, box);
pCurrentFont->CmdTextEx(*this, p, color, pFontScale, text, flags, box);
}
PD_API void DrawList::DrawLine(const fvec2& a, const fvec2& b, u32 color,

View File

@@ -28,6 +28,7 @@ SOFTWARE.
#define PD_TRUETYPE_IMPLEMENTATION
#endif
#include <pd/external/stb_truetype.hpp>
#include <pd/lithium/drawlist.hpp>
#include <pd/lithium/renderer.hpp>
#ifdef PD_LI_INCLUDE_FONTS
@@ -246,7 +247,7 @@ PD_API fvec2 Font::GetTextBounds(const std::string& text, float scale) {
return res;
}
PD_API void Font::CmdTextEx(CmdPool& cmds, const fvec2& pos, u32 color,
PD_API void Font::CmdTextEx(DrawList& dl, const fvec2& pos, u32 color,
float scale, const std::string& text,
LiTextFlags flags, const fvec2& box) {
fvec2 off;
@@ -291,7 +292,7 @@ PD_API void Font::CmdTextEx(CmdPool& cmds, const fvec2& pos, u32 color,
it = pShortText(it, scale, box - pos, tmp_dim);
}
auto wline = Strings::MakeWstring(it);
auto cmd = cmds.NewCmd();
auto cmd = dl.GetNewCmd();
auto Tex = GetCodepoint(wline[0]).Tex;
if (Tex) {
cmd->Tex = Tex->Address;
@@ -303,7 +304,7 @@ PD_API void Font::CmdTextEx(CmdPool& cmds, const fvec2& pos, u32 color,
continue;
}
if (Tex != cp.Tex) {
cmd = cmds.NewCmd();
cmd = dl.GetNewCmd();
Tex = cp.Tex;
if (Tex) {
cmd->Tex = Tex->Address;