Switching SceneItems to smarts
This commit is contained in:
@ -14,7 +14,7 @@ std::shared_ptr<UICanvas> UICanvas::create(Scene *scene) {
|
||||
return item->addComponent<UICanvas>();
|
||||
}
|
||||
|
||||
UICanvas::UICanvas(SceneItem *item) :
|
||||
UICanvas::UICanvas(std::weak_ptr<SceneItem> item) :
|
||||
SceneItemComponent(item),
|
||||
camera(nullptr)
|
||||
{
|
||||
@ -26,7 +26,7 @@ void UICanvas::rebufferShaderParameters() {
|
||||
switch(this->drawType) {
|
||||
case UI_DRAW_TYPE_WORLD_ABSOLUTE:
|
||||
data.projection = camera->getProjection();
|
||||
data.view = camera->item->getWorldTransform();
|
||||
data.view = camera->item.lock()->getWorldTransform();
|
||||
break;
|
||||
|
||||
case UI_DRAW_TYPE_WORLD_CAMERA_RELATIVE:
|
||||
@ -91,7 +91,7 @@ void UICanvas::onStart() {
|
||||
this->h = h / this->getScale();
|
||||
this->rebufferShaderParameters();
|
||||
|
||||
auto comps = this->item->findChildren<UIComponent>();
|
||||
auto comps = this->item.lock()->findChildren<UIComponent>();
|
||||
auto itComps = comps.begin();
|
||||
while(itComps != comps.end()) {
|
||||
(*itComps)->alignmentNeedsUpdating = true;
|
||||
|
Reference in New Issue
Block a user