Update
- 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:
@@ -68,6 +68,10 @@ PD_LITHIUM_API void DrawList::Merge(DrawList::Ref list) {
|
||||
list->Clear();
|
||||
}
|
||||
|
||||
PD_LITHIUM_API void DrawList::Copy(DrawList::Ref list) {
|
||||
pPool.Copy(list->pPool);
|
||||
}
|
||||
|
||||
PD_LITHIUM_API void DrawList::Optimize() {
|
||||
#ifndef NDEBUG
|
||||
PD::TT::Scope s("Optimize");
|
||||
|
||||
@@ -49,7 +49,8 @@ PD_UI7_API void Button::HandleInput() {
|
||||
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->PathRect(FinalPos(), FinalPos() + size, io->FrameRounding);
|
||||
list->PathFill(io->Theme->Get(color));
|
||||
list->pLayer++;
|
||||
list->DrawText(FinalPos() + size * 0.5 - tdim * 0.5, label,
|
||||
io->Theme->Get(UI7Color_Text));
|
||||
|
||||
@@ -48,10 +48,11 @@ PD_UI7_API void Checkbox::HandleInput() {
|
||||
PD_UI7_API void Checkbox::Draw() {
|
||||
// Assert(list.get() && io.get(), "Did you run Container::Init correctly?");
|
||||
// io->Ren->OnScreen(screen);
|
||||
list->DrawRectFilled(FinalPos(), cbs, io->Theme->Get(color));
|
||||
list->PathRect(FinalPos(), FinalPos() + cbs, io->FrameRounding);
|
||||
list->PathFill(io->Theme->Get(color));
|
||||
if (usr_ref) {
|
||||
list->DrawRectFilled(FinalPos() + 2, cbs - 4,
|
||||
io->Theme->Get(UI7Color_Checkmark));
|
||||
list->PathRect(FinalPos() + 2, FinalPos() + cbs - 2, io->FrameRounding);
|
||||
list->PathFill(io->Theme->Get(UI7Color_Checkmark));
|
||||
}
|
||||
list->DrawText(
|
||||
FinalPos() + fvec2(cbs.x + io->ItemSpace.x, cbs.y * 0.5 - tdim.y * 0.5),
|
||||
|
||||
@@ -44,8 +44,9 @@ PD_UI7_API void ColorEdit::HandleInput() {
|
||||
PD_UI7_API void ColorEdit::Draw() {
|
||||
// Assert(io.get() && list.get(), "Did you run Container::Init correctly?");
|
||||
// io->Ren->OnScreen(screen);
|
||||
list->DrawRectFilled(FinalPos(), fvec2(20, 20), *color_ref);
|
||||
list->DrawText(FinalPos() + fvec2(io->ItemSpace.x + 20, 0), label,
|
||||
list->PathRect(FinalPos(), FinalPos() + 18, io->FrameRounding);
|
||||
list->PathFill(*color_ref);
|
||||
list->DrawText(FinalPos() + fvec2(io->ItemSpace.x + 18, 0), label,
|
||||
io->Theme->Get(UI7Color_Text));
|
||||
if (is_shown) {
|
||||
if (!layout) {
|
||||
@@ -53,13 +54,14 @@ PD_UI7_API void ColorEdit::Draw() {
|
||||
}
|
||||
layout->AddObject(Label::New("Hello World!", io));
|
||||
layout->Update();
|
||||
io->RegisterDrawList(GetID(), layout->GetDrawList());
|
||||
list->Merge(layout->GetDrawList());
|
||||
// io->RegisterDrawList(GetID(), layout->GetDrawList());
|
||||
}
|
||||
}
|
||||
|
||||
PD_UI7_API void ColorEdit::Update() {
|
||||
// Assert(io.get(), "Did you run Container::Init correctly?");
|
||||
this->SetSize(fvec2(tdim.x + io->ItemSpace.x + 20, 20));
|
||||
this->SetSize(fvec2(tdim.x + io->ItemSpace.x + 18, 18));
|
||||
}
|
||||
} // namespace UI7
|
||||
} // namespace PD
|
||||
@@ -81,8 +81,9 @@ PD_UI7_API void DragData<T>::Draw() {
|
||||
p = std::format("{}", data[i]);
|
||||
}
|
||||
vec2 td = io->Font->GetTextBounds(p, io->FontScale);
|
||||
list->DrawRectFilled(FinalPos() + fvec2(off_x, 0), td + io->FramePadding,
|
||||
io->Theme->Get(UI7Color_Button));
|
||||
list->PathRect(FinalPos() + fvec2(off_x, 0),
|
||||
FinalPos() + td + io->FramePadding, io->FrameRounding);
|
||||
list->PathFill(io->Theme->Get(UI7Color_Button));
|
||||
list->pLayer++;
|
||||
list->DrawTextEx(FinalPos() + fvec2(off_x, 0), p,
|
||||
io->Theme->Get(UI7Color_Text), LiTextFlags_AlignMid,
|
||||
|
||||
@@ -51,25 +51,25 @@ PD_UI7_API void Context::UseViewPort(const ID &id) {
|
||||
pIO->CurrentViewPort = pIO->ViewPorts[id]->GetSize();
|
||||
}
|
||||
|
||||
PD_UI7_API bool Context::BeginMenu(const ID &id, UI7MenuFlags flags,
|
||||
bool *pShow) {
|
||||
PD_UI7_API Menu::Ref Context::BeginMenu(const ID &id, UI7MenuFlags flags,
|
||||
bool *pShow) {
|
||||
if (pCurrent) {
|
||||
std::cout << "[UI7] Error: You are already in " << pCurrent->pID.GetName()
|
||||
<< " Menu" << std::endl;
|
||||
return false;
|
||||
return nullptr;
|
||||
}
|
||||
if (std::find(pCurrentMenus.begin(), pCurrentMenus.end(), (u32)id) !=
|
||||
pCurrentMenus.end()) {
|
||||
std::cout << "[UI7] Error: Menu " << id.GetName() << " already exists!"
|
||||
<< std::endl;
|
||||
return false;
|
||||
return nullptr;
|
||||
}
|
||||
pCurrent = pGetOrCreateMenu(id);
|
||||
this->pCurrent->pIsShown = pShow;
|
||||
if (pCurrent->pIsShown != nullptr) {
|
||||
if (!*pCurrent->pIsShown) {
|
||||
pCurrent = nullptr;
|
||||
return false;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
/** Probably we dont even need Input Handling in this stage */
|
||||
@@ -79,7 +79,7 @@ PD_UI7_API bool Context::BeginMenu(const ID &id, UI7MenuFlags flags,
|
||||
if (!pCurrent->pIsOpen) {
|
||||
pCurrent = nullptr;
|
||||
}
|
||||
return pCurrent != nullptr;
|
||||
return pCurrent;
|
||||
}
|
||||
|
||||
PD_UI7_API void Context::EndMenu() {
|
||||
@@ -154,8 +154,7 @@ PD_UI7_API void Context::Update() {
|
||||
}
|
||||
|
||||
PD_UI7_API void Context::AboutMenu(bool *show) {
|
||||
if (BeginMenu("About UI7", UI7MenuFlags_Scrolling, show)) {
|
||||
auto m = pCurrent;
|
||||
if (auto m = BeginMenu("About UI7", UI7MenuFlags_Scrolling, show)) {
|
||||
m->Label("Palladium UI7 " + GetVersion());
|
||||
m->Separator();
|
||||
m->Label("(c) 2023-2025 René Amthor");
|
||||
@@ -177,8 +176,7 @@ PD_UI7_API void Context::AboutMenu(bool *show) {
|
||||
}
|
||||
|
||||
PD_UI7_API void Context::MetricsMenu(bool *show) {
|
||||
if (BeginMenu("UI7 Metrics", UI7MenuFlags_Scrolling, show)) {
|
||||
auto m = pCurrent;
|
||||
if (auto m = BeginMenu("UI7 Metrics", UI7MenuFlags_Scrolling, show)) {
|
||||
m->Label("Palladium - UI7 " + GetVersion());
|
||||
m->Separator();
|
||||
m->Label(
|
||||
@@ -303,9 +301,7 @@ PD_UI7_API void Context::MetricsMenu(bool *show) {
|
||||
}
|
||||
|
||||
PD_UI7_API void UI7::Context::StyleEditor(bool *show) {
|
||||
if (this->BeginMenu("UI7 Style Editor", UI7MenuFlags_Scrolling, show)) {
|
||||
auto m = pCurrent;
|
||||
|
||||
if (auto m = BeginMenu("UI7 Style Editor", UI7MenuFlags_Scrolling, show)) {
|
||||
m->Label("Palladium - UI7 " + GetVersion() + " Style Editor");
|
||||
m->Separator();
|
||||
m->DragData("MenuPadding", (float *)&pIO->MenuPadding, 2, 0.f, 100.f);
|
||||
|
||||
Reference in New Issue
Block a user