// Copyright (C) 2023 Samy Bensaid // This file is part of the "Nazara Engine - Widgets module" // For conditions of distribution and use, see copyright notice in Config.hpp #include #include #include #include #include #include namespace Nz { ImageWidget::ImageWidget(BaseWidget* parent, std::shared_ptr material) : BaseWidget(parent) { m_sprite = std::make_shared(std::move(material)); auto& registry = GetRegistry(); m_entity = CreateGraphicsEntity(); auto& gfxComponent = registry.get(m_entity); gfxComponent.AttachRenderable(m_sprite, GetCanvas()->GetRenderMask()); } void ImageWidget::Layout() { BaseWidget::Layout(); m_sprite->SetSize(GetSize()); } }