Files
palladium/include/pd/ultra/elems/element.hpp
T

38 lines
933 B
C++
Raw Normal View History

2026-03-26 21:02:10 +01:00
#pragma once
#include <pd/lithium/lithium.hpp>
2026-03-28 13:52:36 +01:00
#include <pd/ultra/flags.hpp>
2026-03-26 21:02:10 +01:00
namespace PD {
namespace Ultra {
2026-03-28 13:52:36 +01:00
class Canvas;
2026-03-29 04:28:45 +02:00
class Container;
2026-03-28 13:52:36 +01:00
class PD_API ElementBase {
2026-03-26 21:02:10 +01:00
public:
ElementBase() {}
~ElementBase() {}
virtual void Draw(PD::Li::Drawlist& dl) = 0;
/**
* Reset Function (for PD::Pool::FastReset)
*/
virtual void Reset() {}
2026-03-28 13:52:36 +01:00
void SetAlignment(UltraAlignment a) { pAlignment = a; }
void SetPosition(const PD::fvec2& pos) { pPos = pos; }
void SetPosition(float x, float y) { pPos = PD::fvec2(x, y); }
void SetSize(const PD::fvec2& size) { pSize = size; }
void SetSize(float w, float h) { pSize = PD::fvec2(w, h); }
protected:
2026-03-29 04:28:45 +02:00
friend class Container;
void SetParent(Container* c) { pParent = c; }
2026-03-28 13:52:36 +01:00
bool RevisionUpdate(PD::u32 req);
2026-03-29 04:28:45 +02:00
Container* pParent;
2026-03-28 13:52:36 +01:00
PD::u32 pCanvasRev = 0;
UltraAlignment pAlignment = 0;
PD::fvec2 pPos;
PD::fvec2 pSize;
2026-03-26 21:02:10 +01:00
};
} // namespace Ultra
} // namespace PD