reset layers and give menus a base layer to gather perfect ordered rendering

This commit is contained in:
2026-09-06 15:10:37 +02:00
parent 1ae4d0cd46
commit 7e0f3a6bf6
3 changed files with 9 additions and 0 deletions
+3
View File
@@ -62,6 +62,7 @@ PD_API void ColorEdit::Draw() {
l->PathRect(thiz->GetPos(), thiz->GetPos() + thiz->GetSize(), l->PathRect(thiz->GetPos(), thiz->GetPos() + thiz->GetSize(),
io->FrameRounding); io->FrameRounding);
l->PathFill(io->Theme.Get(UI7Color_FrameBackground)); l->PathFill(io->Theme.Get(UI7Color_FrameBackground));
l->SetLayer(0);
}); });
layout->AddObjectEx(r, UI7LytAdd_Front | UI7LytAdd_NoCursorUpdate | layout->AddObjectEx(r, UI7LytAdd_Front | UI7LytAdd_NoCursorUpdate |
UI7LytAdd_NoScrollHandle); UI7LytAdd_NoScrollHandle);
@@ -87,7 +88,9 @@ PD_API void ColorEdit::Draw() {
layout->Slider<u8>("B", ((u8*)color_ref) + 2); layout->Slider<u8>("B", ((u8*)color_ref) + 2);
layout->Slider<u8>("A", ((u8*)color_ref) + 3); layout->Slider<u8>("A", ((u8*)color_ref) + 3);
layout->Update(); layout->Update();
list->SetLayer(50);
list->Merge(layout->GetDrawList()); list->Merge(layout->GetDrawList());
list->SetLayer(0);
// io->RegisterDrawList(GetID(), layout->GetDrawList()); // io->RegisterDrawList(GetID(), layout->GetDrawList());
} }
} }
+3
View File
@@ -224,6 +224,7 @@ PD_API void Menu::DrawBaseLayout() {
l->PathAdd(self->FinalPos() + self->GetSize()); l->PathAdd(self->FinalPos() + self->GetSize());
l->PathAdd(self->FinalPos() + self->GetSize() - fvec2(20, 0)); l->PathAdd(self->FinalPos() + self->GetSize() - fvec2(20, 0));
l->PathFill(io->Theme.Get(UI7Color_Button)); l->PathFill(io->Theme.Get(UI7Color_Button));
l->SetLayer(0);
}); });
r->SetSize( r->SetSize(
fvec2(pLayout.GetSize().x, pLayout.GetSize().y - TitleBarHeight)); fvec2(pLayout.GetSize().x, pLayout.GetSize().y - TitleBarHeight));
@@ -268,6 +269,7 @@ PD_API void Menu::DrawBaseLayout() {
(io->FramePadding.x * 2)), (io->FramePadding.x * 2)),
2), 2),
pID.GetName().c_str(), io->Theme.Get(UI7Color_Text)); pID.GetName().c_str(), io->Theme.Get(UI7Color_Text));
l->SetLayer(0);
}); });
r->SetSize(fvec2(pLayout.GetSize().x, TitleBarHeight)); r->SetSize(fvec2(pLayout.GetSize().x, TitleBarHeight));
r->SetPos(0); r->SetPos(0);
@@ -290,6 +292,7 @@ PD_API void Menu::DrawBaseLayout() {
self->FinalPos() + self->FinalPos() +
fvec2(pIsOpen ? self->GetSize().x * 0.5 : 0, self->GetSize().y), fvec2(pIsOpen ? self->GetSize().x * 0.5 : 0, self->GetSize().y),
io->Theme.Get(UI7Color_FrameBackground)); io->Theme.Get(UI7Color_FrameBackground));
l->SetLayer(0);
}); });
r->SetSize(TitleBarHeight - pIO.FramePadding.y * 2); r->SetSize(TitleBarHeight - pIO.FramePadding.y * 2);
r->SetPos(pIO.FramePadding); r->SetPos(pIO.FramePadding);
+3
View File
@@ -143,8 +143,11 @@ PD_API void Context::Update() {
pMenus[it]->Update(); /** Render */ pMenus[it]->Update(); /** Render */
this->pIO.InputHandler.CurrentMenu = 0; this->pIO.InputHandler.CurrentMenu = 0;
} }
int base_layer = 0;
for (int i = (int)FinalList.size() - 1; i >= 0; i--) { for (int i = (int)FinalList.size() - 1; i >= 0; i--) {
pIO.FDL.SetLayer(base_layer);
pIO.FDL.Merge(pMenus[FinalList[i]]->pLayout.GetDrawList()); pIO.FDL.Merge(pMenus[FinalList[i]]->pLayout.GetDrawList());
base_layer += 100;
} }
pCurrentMenus.clear(); pCurrentMenus.clear();
pIO.Update(); pIO.Update();