- Added DestroyTex to 3ds backend
- Added Size() -> ivec2 to PD::Image
- Added CmdPool Copy as well as DrawList Copy (Static rendering)
- Added == ooperator for Rect
- Added UI7 Frame Rounding
- Fix UI7 Image usage withour size or uv
- Added New way to use BeginMenu
This commit is contained in:
2026-01-18 19:25:50 +01:00
parent 0ef6d34435
commit 2b7d25cf06
16 changed files with 59 additions and 32 deletions

View File

@@ -61,6 +61,8 @@ class GfxDriver {
return nullptr;
}
virtual void DestroyTex(PD::Li::Texture::Ref tex) {}
Li::Texture::Ref GetSolidTex() { return pSolid; }
const std::string pName = "NullGfx";
@@ -108,6 +110,8 @@ class Gfx {
return pGfx->LoadTex(pixels, w, h, type, filter);
}
static void DestroyTex(Li::Texture::Ref tex) { pGfx->DestroyTex(tex); }
static Li::Texture::Ref GetSolidTex() { return pGfx->GetSolidTex(); }
static GfxDriver::Ref pGfx;

View File

@@ -57,6 +57,7 @@ class PD_IMAGE_API Image {
int Width() const { return pWidth; }
int Height() const { return pHeight; }
ivec2 Size() const { return ivec2(pWidth, pHeight); }
Format Fmt() const { return pFmt; }
void FlipVertical();

View File

@@ -120,6 +120,11 @@ class CmdPool {
size_t Cap() const { return pPool.size(); }
void Merge(CmdPool& p) {
Copy(p);
p.Reset();
}
void Copy(CmdPool& p) {
if (pPoolIdx + p.Size() > pPool.size()) {
Resize(pPoolIdx + p.Size());
}
@@ -128,7 +133,6 @@ class CmdPool {
*pPool[idx] = *p.GetCmd(i);
pPool[idx]->Index = idx;
}
p.Reset();
}
private:

View File

@@ -131,6 +131,8 @@ class Rect {
return *this;
}
bool operator==(Rect& r) { return Top == r.Top && Bot == r.Bot; }
void SwapVec2XY() {
Top.SwapXY();
Top.SwapZW();

View File

@@ -39,13 +39,14 @@ class PD_UI7_API Image : public Container {
*/
Image(Li::Texture::Ref img, fvec2 size = 0.f, Li::Rect uv = fvec4(0.f)) {
this->img = img;
this->newsize = size;
this->cuv = uv;
if (size.x != 0 || size.y != 0) {
this->SetSize(size);
} else {
this->SetSize(fvec2(img->GetSize().x, img->GetSize().y));
if (size == fvec2(0.f)) {
size = img->GetSize();
}
if (uv == Li::Rect(fvec4(0.f))) {
uv = img->GetUV();
}
this->cuv = uv;
this->newsize = size;
}
~Image() = default;

View File

@@ -57,7 +57,7 @@ class ID {
~ID() = default;
/** Get The ID Initial Name */
constexpr const std::string_view& GetNameView() const { return pName; }
// constexpr const std::string_view& GetNameView() const { return pName; }
const std::string GetName() const { return std::string(pName); }
/** Getter for the raw 32bit int id */

View File

@@ -73,6 +73,7 @@ class PD_UI7_API IO {
UI7::Theme::Ref Theme;
fvec2 MenuPadding = 5.f;
fvec2 FramePadding = 5.f;
float FrameRounding = 0.f;
fvec2 ItemSpace = vec2(5.f, 2.f);
fvec2 MinSliderDragSize = 10.f; // Min height (Vt) and Min Width (Hz)
bool ShowMenuBorder = true;

View File

@@ -59,7 +59,8 @@ class PD_UI7_API Context {
void AddViewPort(const ID& id, const ivec4& vp);
void UseViewPort(const ID& id);
void Update();
bool BeginMenu(const ID& id, UI7MenuFlags flags = 0, bool* pShow = nullptr);
Menu::Ref BeginMenu(const ID& id, UI7MenuFlags flags = 0,
bool* pShow = nullptr);
Menu::Ref CurrentMenu() { return pCurrent; }
void EndMenu();
void AboutMenu(bool* show = nullptr);