Make UI7::IO::CurrentViewPort a Reference (finally)

This commit is contained in:
2026-03-18 21:33:35 +01:00
parent 3d8b57ead6
commit 0501a4f87c
6 changed files with 18 additions and 15 deletions

View File

@@ -55,7 +55,7 @@ class PD_API Slider : public Container {
this->min = min;
this->max = max;
this->precision = precision;
this->width = io->CurrentViewPort.z * 0.3f;
this->width = io->CurrentViewPort->pSize.z * 0.3f;
this->tdim = io->Font->GetTextBounds(label, io->FontScale);
}
~Slider() = default;

View File

@@ -43,8 +43,8 @@ class PD_API IO {
FDL = Li::DrawList::New(pCtx);
DeltaStats = TimeStats::New(60);
/** Probably not the best solution i guess */
CurrentViewPort.z = pCtx.Gfx()->ViewPort.x;
CurrentViewPort.w = pCtx.Gfx()->ViewPort.y;
CurrentViewPort =
ViewPort::New("Default", ivec4(ivec2(0, 0), pCtx.Gfx()->ViewPort));
}
~IO() {}
@@ -61,7 +61,8 @@ class PD_API IO {
* Possible thanks to the DrawList::Merge Feature
*/
Li::DrawList::Ref FDL = nullptr;
ivec4 CurrentViewPort = ivec4(0, 0, 0, 0);
ViewPort::Ref CurrentViewPort;
// ivec4 CurrentViewPort = ivec4(0, 0, 0, 0);
std::unordered_map<u32, ViewPort::Ref> ViewPorts;
float Framerate = 0.f;
float Delta = 0.f;

View File

@@ -45,7 +45,7 @@ class PD_API Layout {
Scrolling[0] = false;
Scrolling[1] = false;
CursorInit();
Pos = fvec2(io->CurrentViewPort.x, io->CurrentViewPort.y);
Pos = fvec2(io->CurrentViewPort->pSize.x, io->CurrentViewPort->pSize.y);
Size = 0;
WorkRect = fvec4(IO->MenuPadding, Size - (fvec2(2) * IO->MenuPadding));
}