Window resizing works
This commit is contained in:
@@ -8,6 +8,7 @@ Window::Window(PWindowManager owner, Gfx::OWindow handle)
|
||||
: owner(owner)
|
||||
, gfxHandle(std::move(handle))
|
||||
{
|
||||
gfxHandle->setResizeCallback([this](uint32 w, uint32 h) {onResize(w, h); });
|
||||
}
|
||||
|
||||
Window::~Window()
|
||||
@@ -57,3 +58,15 @@ void Window::setFocused(PView view)
|
||||
owner->notifyWindowClosed(this);
|
||||
});
|
||||
}
|
||||
|
||||
void Window::onResize(uint32 width, uint32 height)
|
||||
{
|
||||
for (auto& view : views)
|
||||
{
|
||||
// TODO: some sort of layouting algorithm should do this
|
||||
view->applyArea(URect{
|
||||
.size = UVector2(width, height),
|
||||
.offset = UVector2(0, 0),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user