Compare commits

..
2 Commits
Author SHA1 Message Date
tobid7 b4b1144c60 Implemet CutTex Rendering 2025-12-30 22:28:03 +01:00
tobid7 6e502d73d8 Add Clearcolor support 2025-12-22 12:50:40 +01:00
3 changed files with 22 additions and 1 deletions
+3 -1
View File
@@ -28,7 +28,9 @@ class C3D {
int Width() const { return pWidth; }
int Height() const { return pHeight; }
ivec2 Size() const { return ivec2(pWidth, pHeight); }
void Clear() { C3D_RenderTargetClear(pTarget, C3D_CLEAR_ALL, 0, 0); }
void Clear(ui clr = 0x0, ui depth_clr = 0x0) {
C3D_RenderTargetClear(pTarget, C3D_CLEAR_ALL, clr, depth_clr);
}
void Use() { C3D_FrameDrawOn(pTarget); }
C3D_RenderTarget* Ptr() { return pTarget; }
+8
View File
@@ -122,6 +122,14 @@ class Iron {
void DrawSolid();
void DrawTex(Texture::Ref tex) { pTex = tex; }
void DrawCutTex(fvec2 pos, fvec2 size, fvec4 cut_rect,
ui color = 0xffffffff);
void DrawCutTex(fvec2 pos, fvec2 size, fvec4 cut_rect, Texture::Ref tex,
ui color = 0xffffffff) {
DrawTex(tex);
DrawCutTex(pos, size, cut_rect, color);
DrawSolid();
}
void SetFont(Font::Ref fnt) { pCurrentFont = fnt; }
void SetFontScale(float v) { pFontScale = v; }
float GetFontScale() { return pFontScale; }
+11
View File
@@ -209,6 +209,17 @@ void Iron::Drawlist::DrawCircleFilled(const fvec2& center, float rad, ui color,
PathFill(color);
}
void Iron::Drawlist::DrawCutTex(fvec2 pos, fvec2 size, fvec4 cut_rect,
ui color) {
auto r = Iron::PrimRect(pos, size);
auto cmd = NewCommand();
auto uv = cut_rect / fvec4(pTex->Size(), pTex->Size());
uv.y = 1.f - uv.y;
uv.w = 1.f - uv.w;
Iron::CmdQuad(cmd.get(), r, uv, color);
Push(std::move(cmd));
}
void Iron::Drawlist::DrawPolyLine(const std::vector<fvec2>& points, ui clr,
ui flags, int thickness) {
if (points.size() < 2) {