fix: mark parent dirty
This commit is contained in:
@@ -26,7 +26,7 @@ int main()
|
||||
export_font["sizes"] = json::object();
|
||||
|
||||
std::vector<uint32_t> sizes =
|
||||
{12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 100, 250};
|
||||
{12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 35, 40, 100, 250};
|
||||
|
||||
for(auto& size : sizes)
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace frame::widgets
|
||||
|
||||
void ContainerWidget::setSlot(size_t slot, Widget::shared_ptr ptr)
|
||||
{
|
||||
ptr->setParent(this);
|
||||
widgets[slot] = ptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace frame::widgets
|
||||
{
|
||||
|
||||
Widget::shared_ptr Widget::getParent() const
|
||||
Widget::week_ptr Widget::getParent() const
|
||||
{
|
||||
return mParent;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace frame::widgets
|
||||
{
|
||||
public:
|
||||
using shared_ptr = std::shared_ptr<Widget>;
|
||||
using week_ptr = std::shared_ptr<Widget>;
|
||||
using week_ptr = Widget*;
|
||||
|
||||
public:
|
||||
virtual ~Widget() = default;
|
||||
@@ -20,7 +20,7 @@ namespace frame::widgets
|
||||
virtual void Render(render::RenderTarget& rt) = 0;
|
||||
virtual void ComputeChildSize(Vector size){};
|
||||
|
||||
shared_ptr getParent() const;
|
||||
week_ptr getParent() const;
|
||||
void setParent(week_ptr ptr);
|
||||
|
||||
void setSize(Vector size);
|
||||
@@ -34,7 +34,7 @@ namespace frame::widgets
|
||||
void setClear();
|
||||
|
||||
private:
|
||||
week_ptr mParent;
|
||||
week_ptr mParent = nullptr;
|
||||
bool mDirty = true;
|
||||
|
||||
Vector mRelativePosition;
|
||||
|
||||
@@ -127,8 +127,6 @@ namespace frame::widgets
|
||||
|
||||
// Top
|
||||
|
||||
rt.setInvert(true);
|
||||
|
||||
auto top = getSlot(0);
|
||||
if(top)
|
||||
{
|
||||
@@ -147,8 +145,6 @@ namespace frame::widgets
|
||||
rt.popViewport();
|
||||
}
|
||||
|
||||
rt.setInvert(false);
|
||||
|
||||
// Text
|
||||
|
||||
/*auto font = font::GetFont("Fira Code");
|
||||
|
||||
@@ -41,12 +41,14 @@ namespace frame::widgets
|
||||
|
||||
auto font_size = font->getOptimalSize(text, draw);
|
||||
|
||||
rt.setInvert(true);
|
||||
rt.DrawText(draw,
|
||||
text,
|
||||
*font,
|
||||
font_size,
|
||||
AlignHorizontal::CENTER,
|
||||
AlignVertical::CENTER);
|
||||
rt.setInvert(false);
|
||||
|
||||
setClear();
|
||||
}
|
||||
|
||||
@@ -43,12 +43,14 @@ namespace frame::widgets
|
||||
|
||||
auto font_size = font->getOptimalSize(text, draw);
|
||||
|
||||
rt.setInvert(true);
|
||||
rt.DrawText(draw,
|
||||
text,
|
||||
*font,
|
||||
font_size,
|
||||
AlignHorizontal::CENTER,
|
||||
AlignVertical::CENTER);
|
||||
rt.setInvert(false);
|
||||
|
||||
setClear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user