Commit current work

Former-commit-id: 79be9d4e937a73626cd5ec02c1d2e2fcbd440d18
This commit is contained in:
Lynix
2016-05-13 13:00:52 +02:00
parent c15dd5221d
commit 5588a573a6
6 changed files with 280 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
// 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(const WorldHandle& world, BaseWidget* parent) :
BaseWidget(world, parent)
{
m_textSprite = Nz::TextSprite::New();
m_textEntity = CreateEntity();
m_textEntity->AddComponent<GraphicsComponent>().Attach(m_textSprite);
m_textEntity->AddComponent<NodeComponent>().SetParent(this);
}
void LabelWidget::ResizeToContent()
{
SetContentSize(Nz::Vector2f(m_textSprite->GetBoundingVolume().obb.localBox.GetLengths()));
}
}