Back with clickable button.
This commit is contained in:
parent
3e53bd9e00
commit
70891ce7b4
20 changed files with 107 additions and 50 deletions
|
@ -13,8 +13,9 @@ class FontsManager;
|
|||
class AbstractVisualNode
|
||||
{
|
||||
public:
|
||||
AbstractVisualNode(const DiscretePoint& location)
|
||||
: mLocation(location)
|
||||
AbstractVisualNode(const DiscretePoint& location, const std::string& name = {})
|
||||
: mLocation(location),
|
||||
mName(name)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -61,6 +62,16 @@ public:
|
|||
return mChildren.size();
|
||||
}
|
||||
|
||||
void setName(const std::string& name)
|
||||
{
|
||||
mName = name;
|
||||
}
|
||||
|
||||
const std::string& getName() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
protected:
|
||||
DiscretePoint mLocation;
|
||||
std::unique_ptr<SceneItem> mSceneItem;
|
||||
|
@ -70,4 +81,5 @@ protected:
|
|||
|
||||
bool mIsVisible{true};
|
||||
bool mTransformIsDirty{true};
|
||||
std::string mName;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "MaterialNode.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
MaterialNode::MaterialNode(const DiscretePoint& location)
|
||||
: AbstractVisualNode(location),
|
||||
mFillColor(Color(255, 255, 255)),
|
||||
|
|
|
@ -71,6 +71,7 @@ void RectangleNode::update(FontsManager* fontsManager)
|
|||
if (!mSceneItem)
|
||||
{
|
||||
mSceneItem = std::make_unique<SceneModel>(std::move(mesh));
|
||||
mSceneItem->setName(mName + "_Model");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -4,10 +4,12 @@
|
|||
#include "FontsManager.h"
|
||||
#include "SceneItem.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
Scene::Scene()
|
||||
: mRootNode(std::make_unique<RootNode>())
|
||||
{
|
||||
|
||||
mRootNode->setName("Scene_RootNode");
|
||||
}
|
||||
|
||||
void Scene::update(FontsManager* fontsManager)
|
||||
|
@ -23,7 +25,11 @@ void Scene::updateNode(AbstractVisualNode* node, FontsManager* fontsManager)
|
|||
}
|
||||
|
||||
node->update(fontsManager);
|
||||
mSceneItems.push_back(node->getSceneItem());
|
||||
|
||||
if(auto item = node->getSceneItem())
|
||||
{
|
||||
mSceneItems.push_back(node->getSceneItem());
|
||||
}
|
||||
}
|
||||
|
||||
RootNode* Scene::getRootNode() const
|
||||
|
|
|
@ -3,12 +3,15 @@
|
|||
#include "Color.h"
|
||||
#include "Transform.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class SceneItem
|
||||
{
|
||||
public:
|
||||
|
||||
enum class Type
|
||||
{
|
||||
UNSET,
|
||||
MODEL,
|
||||
TEXT
|
||||
};
|
||||
|
@ -31,6 +34,16 @@ public:
|
|||
|
||||
void updateTransform(const Transform& transform);
|
||||
|
||||
void setName(const std::string& name)
|
||||
{
|
||||
mName = name;
|
||||
}
|
||||
|
||||
const std::string& getName() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
protected:
|
||||
Transform mTransform;
|
||||
Color mUniformColor;
|
||||
|
@ -38,4 +51,6 @@ protected:
|
|||
bool mColorIsDirty{true};
|
||||
bool mTransformIsDirty{true};
|
||||
bool mIsVisible{true};
|
||||
|
||||
std::string mName;
|
||||
};
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include "Color.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
TextNode::TextNode(const std::string& content, const DiscretePoint& loc)
|
||||
: MaterialNode(loc)
|
||||
{
|
||||
|
@ -50,9 +52,10 @@ void TextNode::update(FontsManager* fontsManager)
|
|||
if (!mSceneItem)
|
||||
{
|
||||
mSceneItem = std::make_unique<SceneText>();
|
||||
mSceneItem->setName(mName + "_SceneText");
|
||||
}
|
||||
|
||||
if (!mContentIsDirty)
|
||||
if (mContentIsDirty)
|
||||
{
|
||||
dynamic_cast<SceneText*>(mSceneItem.get())->setContent(mContent);
|
||||
mContentIsDirty = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue