Add LayerOptimisation / QoL change
This commit is contained in:
@@ -50,10 +50,10 @@ PD_UI7_API void Button::Draw() {
|
||||
// Assert(io.get() && list.get(), "Did you run Container::Init correctly?");
|
||||
// io->Ren->OnScreen(screen);
|
||||
list->DrawRectFilled(FinalPos(), size, io->Theme->Get(color));
|
||||
list->Layer++;
|
||||
list->pLayer++;
|
||||
list->DrawText(FinalPos() + size * 0.5 - tdim * 0.5, label,
|
||||
io->Theme->Get(UI7Color_Text));
|
||||
list->Layer--;
|
||||
list->pLayer--;
|
||||
}
|
||||
|
||||
PD_UI7_API void Button::Update() {
|
||||
|
||||
@@ -83,11 +83,11 @@ PD_UI7_API void DragData<T>::Draw() {
|
||||
vec2 td = io->Font->GetTextBounds(p, io->FontScale);
|
||||
list->DrawRectFilled(FinalPos() + fvec2(off_x, 0), td + io->FramePadding,
|
||||
io->Theme->Get(UI7Color_Button));
|
||||
list->Layer++;
|
||||
list->pLayer++;
|
||||
list->DrawTextEx(FinalPos() + fvec2(off_x, 0), p,
|
||||
io->Theme->Get(UI7Color_Text), LiTextFlags_AlignMid,
|
||||
td + io->FramePadding);
|
||||
list->Layer--;
|
||||
list->pLayer--;
|
||||
off_x += td.x + io->ItemSpace.x + io->FramePadding.x;
|
||||
}
|
||||
list->DrawText(FinalPos() + fvec2(off_x, io->FramePadding.y * 0.5), label,
|
||||
|
||||
@@ -29,11 +29,11 @@ PD_UI7_API void Image::Draw() {
|
||||
// Assert(io.get() && list.get(), "Did you run Container::Init correctly?");
|
||||
// Assert(img.get(), "Image is nullptr!");
|
||||
// io->Ren->OnScreen(screen);
|
||||
list->Layer++;
|
||||
list->pLayer++;
|
||||
list->DrawTexture(img);
|
||||
list->DrawRectFilled(FinalPos(), newsize, 0xffffffff);
|
||||
list->DrawSolid();
|
||||
list->Layer--;
|
||||
list->pLayer--;
|
||||
}
|
||||
} // namespace UI7
|
||||
} // namespace PD
|
||||
@@ -239,7 +239,7 @@ PD_UI7_API void Menu::DrawBaseLayout() {
|
||||
if (!(Flags & UI7MenuFlags_NoResize)) {
|
||||
Container::Ref r = DynObj::New(
|
||||
[](IO::Ref io, Li::DrawList::Ref l, UI7::Container* self) {
|
||||
l->Layer = 1;
|
||||
l->pLayer = 1;
|
||||
l->PathAdd(self->FinalPos() + self->GetSize() - fvec2(0, 20));
|
||||
l->PathAdd(self->FinalPos() + self->GetSize());
|
||||
l->PathAdd(self->FinalPos() + self->GetSize() - fvec2(20, 0));
|
||||
@@ -255,7 +255,7 @@ PD_UI7_API void Menu::DrawBaseLayout() {
|
||||
/** Background */
|
||||
Container::Ref r = DynObj::New([](IO::Ref io, Li::DrawList::Ref l,
|
||||
UI7::Container* self) {
|
||||
l->Layer = 0;
|
||||
l->pLayer = 0;
|
||||
l->PathRectEx(self->FinalPos(), self->FinalPos() + self->GetSize(), 10.f,
|
||||
LiPathRectFlags_KeepTop | LiPathRectFlags_KeepBot);
|
||||
l->PathFill(io->Theme->Get(UI7Color_Background));
|
||||
@@ -272,11 +272,11 @@ PD_UI7_API void Menu::DrawBaseLayout() {
|
||||
if (!(Flags & UI7MenuFlags_NoTitlebar)) {
|
||||
Container::Ref r = DynObj::New(
|
||||
[=, this](UI7::IO::Ref io, Li::DrawList::Ref l, UI7::Container* self) {
|
||||
l->Layer = 20;
|
||||
l->pLayer = 20;
|
||||
/** Header Bar */
|
||||
l->DrawRectFilled(self->FinalPos(), self->GetSize(),
|
||||
io->Theme->Get(UI7Color_Header));
|
||||
l->Layer = 21;
|
||||
l->pLayer = 21;
|
||||
/** Inline if statement to shift the Text if collapse sym is shown */
|
||||
/** What the hell is this code btw (didn't found a better way) */
|
||||
l->DrawText(self->FinalPos() + fvec2(Flags & UI7MenuFlags_NoClose
|
||||
@@ -297,7 +297,7 @@ PD_UI7_API void Menu::DrawBaseLayout() {
|
||||
r = DynObj::New([=, this](UI7::IO::Ref io, Li::DrawList::Ref l,
|
||||
UI7::Container* self) {
|
||||
/** This sym actually requires layer 21 (i dont know why) */
|
||||
l->Layer = 21;
|
||||
l->pLayer = 21;
|
||||
/**
|
||||
* Symbol (Position Swapping set by pIsOpen ? openpos : closepos;)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user