Former-commit-id: 685295853d1f0edf28c36b2f698eca881da25ea2 [formerly f65f951ed3d2edfd9c12d390837cd13e5691eaa3] [formerly 5e239f37c28bf5e93a71cba29a94f0de680a79a2 [formerly 38346fa5d68c7bf79ddebc1990959e7c56617640]] Former-commit-id: 92da4ed40fb63fe0b02c7543ea64cebda0575623 [formerly 2db1fe5fca87a1461ceb8314709d764af079a7be] Former-commit-id: 77d61a99fd5a2bb21701fbe4a4b4451c3655663a
29 lines
787 B
C++
29 lines
787 B
C++
// Copyright (C) 2015 Jérôme Leclercq
|
|
// This file is part of the "Nazara Development Kit"
|
|
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
|
|
|
#include <NDK/Widgets/LabelWidget.hpp>
|
|
#include <NDK/Components/GraphicsComponent.hpp>
|
|
#include <NDK/Components/NodeComponent.hpp>
|
|
#include <NDK/World.hpp>
|
|
|
|
namespace Ndk
|
|
{
|
|
LabelWidget::LabelWidget(BaseWidget* parent) :
|
|
BaseWidget(parent)
|
|
{
|
|
m_textSprite = Nz::TextSprite::New();
|
|
|
|
m_textEntity = CreateEntity();
|
|
m_textEntity->AddComponent<GraphicsComponent>().Attach(m_textSprite);
|
|
m_textEntity->AddComponent<NodeComponent>().SetParent(this);
|
|
|
|
Layout();
|
|
}
|
|
|
|
void LabelWidget::ResizeToContent()
|
|
{
|
|
SetContentSize(Nz::Vector2f(m_textSprite->GetBoundingVolume().obb.localBox.GetLengths()));
|
|
}
|
|
}
|