85 lines
1.9 KiB
C++
Executable File
85 lines
1.9 KiB
C++
Executable File
#pragma once
|
|
|
|
#include <dtEntity/component.h>
|
|
#include <dtEntity/entity.h>
|
|
#include <dtEntity/defaultentitysystem.h>
|
|
#include <dtEntityOSG/nodecomponent.h>
|
|
#include <osg/AutoTransform>
|
|
#include <dtEntity/dynamicproperty.h>
|
|
#include <dtEntityOSG/transformcomponent.h>
|
|
|
|
namespace VCtrl
|
|
{
|
|
|
|
class TextComponent final : public dtEntityOSG::TransformComponent
|
|
{
|
|
|
|
public:
|
|
static const dtEntity::StringId TYPE;
|
|
|
|
static const dtEntity::StringId PathId;
|
|
|
|
|
|
TextComponent();
|
|
|
|
dtEntity::ComponentType GetType() const override { return TYPE; }
|
|
|
|
virtual bool IsInstanceOf(dtEntity::ComponentType id) const
|
|
{
|
|
return ((id == TYPE));
|
|
}
|
|
|
|
std::string GetText() const;
|
|
void SetText(const std::string& text);
|
|
|
|
std::string GetDisText() const;
|
|
void SetDisText(const std::string& text);
|
|
|
|
osg::Vec4 GetColor() const { return mColor; }
|
|
void SetColor(const osg::Vec4&);
|
|
|
|
dtEntity::Vec3d GetTranslation() const override;
|
|
void SetTranslation(const dtEntity::Vec3d&) override;
|
|
|
|
dtEntity::Vec3d GetScale() const override;
|
|
void SetScale(const dtEntity::Vec3d&) override;
|
|
|
|
dtEntity::Quat GetRotation() const override;
|
|
void SetRotation(const dtEntity::Quat&) override;
|
|
|
|
bool GetShowSelection() const;
|
|
void SetShowSelection(bool v);
|
|
|
|
void SetVisible(bool v);
|
|
bool GetVisible() const { return mVisible; }
|
|
|
|
private:
|
|
|
|
void Rebuild();
|
|
|
|
dtEntity::DynamicStringProperty mPath;
|
|
|
|
std::string mText;
|
|
std::string mDisText;
|
|
osg::Vec4 mColor;
|
|
bool mSelected = false;
|
|
bool mVisible = false;
|
|
};
|
|
|
|
|
|
///////////////////////////////////////////////
|
|
|
|
|
|
// iterates over MovementComponents and updates the translation of the entity
|
|
// after applying forces
|
|
class TextSystem final
|
|
: public dtEntity::DefaultEntitySystem<TextComponent>
|
|
{
|
|
|
|
public:
|
|
explicit TextSystem(dtEntity::EntityManager& em);
|
|
|
|
};
|
|
|
|
}
|