2022-11-13 17:02:09 +00:00
|
|
|
#include "TextNode.h"
|
|
|
|
|
2022-11-15 09:32:28 +00:00
|
|
|
#include "Rectangle.h"
|
|
|
|
#include "FontsManager.h"
|
|
|
|
#include "IFontEngine.h"
|
|
|
|
#include "MeshPrimitives.h"
|
2022-11-15 15:50:36 +00:00
|
|
|
#include "FontItem.h"
|
2022-11-15 09:32:28 +00:00
|
|
|
|
2022-11-13 17:02:09 +00:00
|
|
|
#include "Color.h"
|
|
|
|
|
|
|
|
TextNode::TextNode(const std::string& content, const DiscretePoint& loc)
|
2022-11-15 15:50:36 +00:00
|
|
|
: AbstractVisualNode(loc)
|
2022-11-13 17:02:09 +00:00
|
|
|
{
|
2022-11-15 15:50:36 +00:00
|
|
|
mTextData.mContent = content;
|
|
|
|
mTextData.mFont = FontItem("Arial", 16);
|
|
|
|
mTextData.mLocation = loc;
|
|
|
|
mTextData.mFillColor = Color(255, 255, 255);
|
|
|
|
mTextData.mStrokeColor = Color(0, 0, 0);
|
2022-11-13 17:02:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TextNode::~TextNode()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<TextNode> TextNode::Create(const std::string& content, const DiscretePoint& loc)
|
|
|
|
{
|
|
|
|
return std::make_unique<TextNode>(content, loc);
|
|
|
|
}
|
|
|
|
|
|
|
|
const Color& TextNode::getFillColor() const
|
|
|
|
{
|
2022-11-15 15:50:36 +00:00
|
|
|
return mTextData.mFillColor;
|
2022-11-13 17:02:09 +00:00
|
|
|
}
|
|
|
|
const Color& TextNode::getStrokeColor() const
|
|
|
|
{
|
2022-11-15 15:50:36 +00:00
|
|
|
return mTextData.mStrokeColor;
|
2022-11-13 17:02:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string TextNode::getFontLabel() const
|
|
|
|
{
|
2022-11-15 15:50:36 +00:00
|
|
|
return {};
|
2022-11-13 17:02:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string TextNode::getContent() const
|
|
|
|
{
|
2022-11-15 15:50:36 +00:00
|
|
|
return mTextData.mContent;
|
2022-11-13 17:02:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TextNode::setContent(const std::string& content)
|
|
|
|
{
|
2022-11-15 15:50:36 +00:00
|
|
|
mTextData.mContent = content;
|
2022-11-13 17:02:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TextNode::setFillColor(const Color& color)
|
|
|
|
{
|
2022-11-15 15:50:36 +00:00
|
|
|
mTextData.mFillColor = color;
|
2022-11-13 17:02:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TextNode::setStrokeColor(const Color& color)
|
|
|
|
{
|
2022-11-15 15:50:36 +00:00
|
|
|
mTextData.mStrokeColor = color;
|
2022-11-13 17:02:09 +00:00
|
|
|
}
|
2022-11-15 09:32:28 +00:00
|
|
|
|
|
|
|
void TextNode::update(FontsManager* drawingManager)
|
|
|
|
{
|
|
|
|
updateMesh();
|
|
|
|
updateTexture(drawingManager);
|
|
|
|
}
|
|
|
|
|
2022-11-15 15:50:36 +00:00
|
|
|
const TextData& TextNode::getTextData() const
|
2022-11-15 09:32:28 +00:00
|
|
|
{
|
2022-11-15 15:50:36 +00:00
|
|
|
return mTextData;
|
|
|
|
}
|
2022-11-15 09:32:28 +00:00
|
|
|
|
2022-11-15 15:50:36 +00:00
|
|
|
void TextNode::updateMesh()
|
|
|
|
{
|
2022-11-15 09:32:28 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void TextNode::updateTexture(FontsManager* fontsManager)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|