New module: Platform - Split window management from Utility module (#128)

* New module: Platform - Split window management from Utility module

Final touch

* NDK/SDK: Bring back initialization of Utility
This commit is contained in:
Gawaboumga
2017-08-30 10:22:50 +02:00
committed by Jérôme Leclercq
parent 41a1b5d493
commit 5aa072cee3
125 changed files with 1049 additions and 782 deletions

View File

@@ -0,0 +1,35 @@
#include "Text.hpp"
#include <Nazara/Renderer/RenderWindow.hpp>
#include <Nazara/Utility/SimpleTextDrawer.hpp>
#include <NDK/StateMachine.hpp>
#include <NDK/World.hpp>
#include <NDK/Components/GraphicsComponent.hpp>
#include <NDK/Components/NodeComponent.hpp>
Text::Text(StateContext& stateContext) :
m_context(stateContext)
{
m_text = m_context.world.CreateEntity();
m_text->AddComponent<Ndk::NodeComponent>();
Ndk::GraphicsComponent& graphicsComponent = m_text->AddComponent<Ndk::GraphicsComponent>();
m_textSprite = Nz::TextSprite::New();
graphicsComponent.Attach(m_textSprite);
}
Text::~Text()
{
m_textSprite->Clear();
m_text->Kill();
}
void Text::SetContent(const Nz::String& string, unsigned int size)
{
m_textSprite->Update(Nz::SimpleTextDrawer::Draw(string, size));
}
void Text::SetVisible(bool shouldBeVisible)
{
m_text->Enable(shouldBeVisible);
}