More stuff done at Project Ultra
- Added renderspace - Revision System (to not always update pRenderspace - added some test scene
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#include <pd/ultra/canvas.hpp>
|
||||
#include <pd/ultra/elems/element.hpp>
|
||||
|
||||
namespace PD {
|
||||
namespace Ultra {
|
||||
PD_API bool ElementBase::RevisionUpdate(PD::u32 req) {
|
||||
if (req != pCanvasRev) {
|
||||
pCanvasRev = req;
|
||||
return true;
|
||||
} else {
|
||||
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
|
||||
@@ -0,0 +1,11 @@
|
||||
#include <pd/ultra/elems/image.hpp>
|
||||
|
||||
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);
|
||||
}
|
||||
} // namespace Ultra
|
||||
} // namespace PD
|
||||
@@ -3,8 +3,10 @@
|
||||
namespace PD {
|
||||
namespace Ultra {
|
||||
PD_API void Rect::Draw(PD::Li::Drawlist& l) {
|
||||
l.PathRect(pPos, pPos + pSize, pRounding);
|
||||
l.PathRect(pRenderspace.TopLeft(), pRenderspace.BotRight(), pRounding);
|
||||
l.PathFill(pColor);
|
||||
l.DrawText(pRenderspace.BotRight(), std::to_string(pCanvasRev).c_str(),
|
||||
0xff0000ff);
|
||||
}
|
||||
} // namespace Ultra
|
||||
} // namespace PD
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace PD {
|
||||
namespace Ultra {
|
||||
PD_API void Text::Draw(PD::Li::Drawlist& l) {
|
||||
l.DrawText(pPos, pText.c_str(), pColor);
|
||||
l.DrawText(pRenderspace.TopLeft(), pText.c_str(), pColor);
|
||||
}
|
||||
} // namespace Ultra
|
||||
} // namespace PD
|
||||
Reference in New Issue
Block a user