Make UI7::IO::CurrentViewPort a Reference (finally)
This commit is contained in:
@@ -29,7 +29,8 @@ PD_API void Label::Draw() {
|
||||
// Assert(io.get() && list.get(), "Did you run Container::Init correctly?");
|
||||
// io->Ren->OnScreen(screen);
|
||||
list->DrawTextEx(FinalPos(), label, io->Theme->Get(UI7Color_Text),
|
||||
LiTextFlags_NoOOS, PD::fvec2(0, io->CurrentViewPort.w));
|
||||
LiTextFlags_NoOOS,
|
||||
PD::fvec2(0, io->CurrentViewPort->pSize.w));
|
||||
}
|
||||
|
||||
PD_API void Label::Update() {
|
||||
@@ -39,11 +40,11 @@ PD_API void Label::Update() {
|
||||
* Needs a max size (to support sligning dynaically by the window size)
|
||||
*/
|
||||
if (io->WrapLabels) {
|
||||
this->label =
|
||||
io->Font->pWrapText(this->label, io->FontScale,
|
||||
PD::fvec2(io->CurrentViewPort.z - FinalPos().x * 4,
|
||||
io->CurrentViewPort.w),
|
||||
this->tdim);
|
||||
this->label = io->Font->pWrapText(
|
||||
this->label, io->FontScale,
|
||||
PD::fvec2(io->CurrentViewPort->pSize.z - FinalPos().x * 4,
|
||||
io->CurrentViewPort->pSize.w),
|
||||
this->tdim);
|
||||
SetSize(tdim);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,9 +239,10 @@ PD_API void Menu::HandleTitlebarActions() {
|
||||
// Keep Window In Viewport
|
||||
// Maybe i need to add some operators to vec
|
||||
pLayout->Pos.x = std::clamp<float>(pLayout->Pos.x, -pLayout->Size.x + 10,
|
||||
pIO->CurrentViewPort.z - 10);
|
||||
pLayout->Pos.y = std::clamp<float>(pLayout->Pos.y, pIO->CurrentViewPort.y,
|
||||
pIO->CurrentViewPort.w - 10);
|
||||
pIO->CurrentViewPort->pSize.z - 10);
|
||||
pLayout->Pos.y =
|
||||
std::clamp<float>(pLayout->Pos.y, pIO->CurrentViewPort->pSize.y,
|
||||
pIO->CurrentViewPort->pSize.w - 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ PD_API void Context::UseViewPort(const ID& id) {
|
||||
if (!pIO->ViewPorts.count(id)) {
|
||||
return;
|
||||
}
|
||||
pIO->CurrentViewPort = pIO->ViewPorts[id]->GetSize();
|
||||
pIO->CurrentViewPort = pIO->ViewPorts[id];
|
||||
}
|
||||
|
||||
PD_API Menu::Ref Context::BeginMenu(const ID& id, UI7MenuFlags flags,
|
||||
|
||||
Reference in New Issue
Block a user