Rework Project Ultra
- Added container - Made container the base of Layout - Set Containers theirself as pParent for Elements on Push
This commit is contained in:
@@ -11,16 +11,5 @@ PD_API bool ElementBase::RevisionUpdate(PD::u32 req) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
PD_API void ElementBase::Update(Canvas& c) {
|
||||
if (RevisionUpdate(c.GetRevision())) {
|
||||
if (pParent) {
|
||||
pRenderspace = c.VTranslateObject(
|
||||
pParent->pRenderspace.TopLeft(),
|
||||
pRenderspace.BotRight() - pRenderspace.TopLeft(), pAlignment, true);
|
||||
} else {
|
||||
pRenderspace = c.VTranslateObject(pPos, pSize, pAlignment);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace Ultra
|
||||
} // namespace PD
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace PD {
|
||||
namespace Ultra {
|
||||
PD_API void Image::Draw(PD::Li::Drawlist& l) {
|
||||
l.BindTexture(*pTex);
|
||||
l.PathRect(pRenderspace.TopLeft(), pRenderspace.BotRight(), pRounding);
|
||||
l.PathFill(pColor);
|
||||
// l.BindTexture(*pTex);
|
||||
// l.PathRect(pRenderspace.TopLeft(), pRenderspace.BotRight(), pRounding);
|
||||
// l.PathFill(pColor);
|
||||
}
|
||||
} // namespace Ultra
|
||||
} // namespace PD
|
||||
@@ -3,10 +3,12 @@
|
||||
namespace PD {
|
||||
namespace Ultra {
|
||||
PD_API void Rect::Draw(PD::Li::Drawlist& l) {
|
||||
l.PathRect(pRenderspace.TopLeft(), pRenderspace.BotRight(), pRounding);
|
||||
l.PathFill(pColor);
|
||||
l.DrawText(pRenderspace.BotRight(), std::to_string(pCanvasRev).c_str(),
|
||||
0xff0000ff);
|
||||
l.PathRect(pPos, pPos + pSize, pRounding);
|
||||
if (pLined) {
|
||||
l.PathStroke(pColor, pThickness, LiDrawFlags_Close);
|
||||
} else {
|
||||
l.PathFill(pColor);
|
||||
}
|
||||
}
|
||||
} // namespace Ultra
|
||||
} // namespace PD
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace PD {
|
||||
namespace Ultra {
|
||||
PD_API void Text::Draw(PD::Li::Drawlist& l) {
|
||||
l.DrawText(pRenderspace.TopLeft(), pText.c_str(), pColor);
|
||||
l.DrawText(pPos, pText.c_str(), pColor);
|
||||
}
|
||||
} // namespace Ultra
|
||||
} // namespace PD
|
||||
@@ -2,14 +2,11 @@
|
||||
|
||||
namespace PD {
|
||||
namespace Ultra {
|
||||
PD_API void Layout::Add(ElementBase& elem) { *pElements.Allocate() = &elem; }
|
||||
|
||||
PD_API void Layout::SetFont(PD::Li::Font& font) { pList.SetFont(&font); }
|
||||
|
||||
PD_API void Layout::Render() {
|
||||
pList.Clear();
|
||||
for (auto& it : pElements) {
|
||||
it->Update(pCanvas);
|
||||
for (auto& it : GetElements()) {
|
||||
it->Draw(pList);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user