diff --git a/src/dawn/component/ui/UICanvas.cpp b/src/dawn/component/ui/UICanvas.cpp index e89b9fa4..bf81a50d 100644 --- a/src/dawn/component/ui/UICanvas.cpp +++ b/src/dawn/component/ui/UICanvas.cpp @@ -46,8 +46,8 @@ struct RenderPassContext &ctx // data.model = this->getItem()->getWorldTransform(); data.projection = glm::ortho( - 0.0f, 1280.0f, - 720.0f, 0.0f, + 0.0f, ctx.renderTarget->getWidth(), + ctx.renderTarget->getHeight(), 0.0f, 0.0f, 1.0f ); data.view = glm::mat4(1.0f); @@ -66,6 +66,11 @@ struct RenderPassContext &ctx auto self = std::ref(*this); while(itComponents != components.end()) { auto component = *itComponents; + component->updateAlignment( + glm::vec2(0, 0), + glm::vec2(ctx.renderTarget->getWidth(), ctx.renderTarget->getHeight()), + 1.0f + ); component->getQuads(self); ++itComponents; } @@ -136,9 +141,4 @@ void UICanvas::flushPass() { void UICanvas::addComponent(std::shared_ptr component) { components.push_back(component); - component->updateAlignment( - glm::vec2(0, 0), - glm::vec2(1280, 720), - 1.0f - ); } \ No newline at end of file