2026-03-29 04:28:45 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <pd/lithium/lithium.hpp>
|
2026-04-03 12:43:49 +02:00
|
|
|
#include <pd/ultra/canvas.hpp>
|
2026-03-29 04:28:45 +02:00
|
|
|
#include <pd/ultra/elems/element.hpp>
|
|
|
|
|
|
|
|
|
|
namespace PD {
|
|
|
|
|
namespace Ultra {
|
|
|
|
|
class Container {
|
|
|
|
|
public:
|
|
|
|
|
Container() {}
|
|
|
|
|
Container(const PD::Li::Rect& r) : pRect(r) {}
|
|
|
|
|
virtual ~Container() {}
|
|
|
|
|
|
2026-04-03 12:43:49 +02:00
|
|
|
void Push(PD::Ultra::ElementBase& elem) {
|
|
|
|
|
elem.SetParent(this);
|
|
|
|
|
pElems.Push(&elem);
|
2026-03-29 04:28:45 +02:00
|
|
|
}
|
|
|
|
|
void Reset() { pElems.ResetFast(); }
|
|
|
|
|
const PD::Li::Rect& GetRenderspace() const { return pRect; }
|
|
|
|
|
|
2026-04-03 12:43:49 +02:00
|
|
|
void SetViewport(const PD::fvec2& vp) {
|
|
|
|
|
pCanvas.SetViewport(vp);
|
|
|
|
|
pRect = PD::fvec4(PD::fvec2(0), vp);
|
|
|
|
|
}
|
|
|
|
|
void SetBaseViewport(const PD::ivec2& vp) { pCanvas.SetVirtualViewport(vp); }
|
2026-03-29 04:28:45 +02:00
|
|
|
|
|
|
|
|
const PD::fvec2 GetTopLeft() const { return pRect.TopLeft(); }
|
|
|
|
|
const PD::fvec2 GetTopRight() const { return pRect.TopRight(); }
|
|
|
|
|
const PD::fvec2 GetBotLeft() const { return pRect.BotLeft(); }
|
|
|
|
|
const PD::fvec2 GetBotRight() const { return pRect.BotRight(); }
|
|
|
|
|
const PD::fvec2 GetSize() const { return pRect.BotRight() - pRect.TopLeft(); }
|
|
|
|
|
const PD::fvec2 GetPosition() const { return pRect.TopLeft(); }
|
2026-04-03 12:43:49 +02:00
|
|
|
const Canvas& GetCanvas() const { return pCanvas; }
|
2026-03-29 04:28:45 +02:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
PD::Pool<PD::Ultra::ElementBase*>& GetElements() { return pElems; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
PD::Li::Rect pRect;
|
2026-04-03 12:43:49 +02:00
|
|
|
Canvas pCanvas;
|
2026-03-29 04:28:45 +02:00
|
|
|
PD::Pool<PD::Ultra::ElementBase*> pElems;
|
|
|
|
|
};
|
|
|
|
|
} // namespace Ultra
|
|
|
|
|
} // namespace PD
|