3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
Loading...
Searching...
No Matches
Engine3DRadSpace.Objects.TextPrint Class Reference

Represents a 2D text object that can be drawn on the screen using a specified font. More...

#include <TextPrint.hpp>

Inheritance diagram for Engine3DRadSpace.Objects.TextPrint:
Collaboration diagram for Engine3DRadSpace.Objects.TextPrint:

Public Member Functions

 TextPrint ()
 TextPrint ()
 Default constructor.
 TextPrint (const std::string &name, bool visible, RefFont font, const std::string &text, const Math::Vector2 &pos, float rotation, float scale, Math::Color color, float depth)
 Constructs a text object from a numerical asset identifier.
 TextPrint (const std::string &name, bool visible, const std::filesystem::path &font, const std::string &text, const Math::Vector2 &pos, float rotation, float scale, Math::Color color, float depth)
 Constructs a text object from a file path.
 TextPrint (TextPrint &&) noexcept=default
TextPrint & operator= (TextPrint &&) noexcept=default
void Initialize () override
 Does nothing.
void Update () override
 Does nothing.
void Load () override
 Loads the font asset.
void Load (const std::filesystem::path &path) override
 Loads a font from a specified path.
Reflection::UUID GetUUID () const noexcept override
 Gets the UUID of the TextPrint type.
void Draw2D () override
 Draws the text.
Gizmos::IGizmo * GetGizmo () const noexcept override
 Returns the gizmo object of this object, used for editor/debug rendering.
Graphics::Font * GetFont () const noexcept
 Gets the underlying font used by this object.
Public Member Functions inherited from Engine3DRadSpace.Objects.InstIObject2D
 InstIObject2D (IntPtr natPtr)
Public Member Functions inherited from Engine3DRadSpace.NatPtrWrapper
virtual void Dispose ()
Public Member Functions inherited from Engine3DRadSpace.Objects.IObject2D
virtual ~IObject2D ()=default
Public Member Functions inherited from Engine3DRadSpace.Objects.IObject
void Enable ()
void Disable ()
bool Switch ()
void Show ()
void Hide ()
bool SwitchVisibility ()
IObject GetChild (int idx)
int GetChildrenCount ()
void InternalInitialize (IGame *game)
 Called by ObjectsList to set the _game Game instance. If there are objects manually managed, this MUST be called before Initialize or EditorInitialize.
Graphics::IGraphicsDevice * GetGraphicsDeviceHandle () const noexcept
 Returns the graphics device handle associated with this object.
IGame * GetGame () const noexcept
 Gets the game that this object belongs to.
IObject * operator[] (size_t idxChild) const
 Returns the idx-th child of this object.
IObject * GetParent () const noexcept
 Returns the parent of this object.
void SetParent (IObject *newParent) noexcept
 Sets the parent of this object.
bool HasParent () const noexcept
 Checks if this object has a parent.
size_t GetChildrenCount () const noexcept
 Returns the number of children of this object.
virtual void Enable ()
 Enables this object.
virtual void Disable ()
 Disables this object.
virtual bool Switch ()
 Switched the enable/disable state of this object.
virtual void Show ()
 Shows this object.
virtual void Hide ()
 Hides this object.
virtual bool SwitchVisibility ()
 Switches the visibility state of this object.
void Uninitialize () override
 Called before the object has the destructor called.
virtual ~IObject ()
Public Member Functions inherited from Engine3DRadSpace.IInitializable
void Initialize ()
virtual ~IInitializable ()=default
Public Member Functions inherited from Engine3DRadSpace.IUpdateable
void Update ()
virtual ~IUpdateable ()=default
Public Member Functions inherited from Engine3DRadSpace.ILoadable
void Load ()
void Load (string path)
virtual ~ILoadable ()=default
Public Member Functions inherited from Engine3DRadSpace.IDrawable2D
void Draw2D ()
virtual ~IDrawable2D ()=default

Public Attributes

RefFont Font = 0
 Numerical reference to the font asset used by this object.
Math::Color Colour
 Colour of the text.
std::string Text
 Text to display.
Public Attributes inherited from Engine3DRadSpace.Objects.IObject2D
Math::Vector2 Position
 Position of this object in screen coordinates.
Math::Vector2 RotationCenter
 Rotation pivot.
Math::Vector2 Scale
 Scale of this object. Usually (1.0f, 1.0f).
Public Attributes inherited from Engine3DRadSpace.Objects.IObject
std::string Name
 Name of the object.
ChildObjectCollection Children
 Children of this object.

Properties

uint FontID [get, set]
unsafe Color Color [get, set]
string Text [get, set]
Properties inherited from Engine3DRadSpace.Objects.InstIObject2D
Vector2 Position [get, set]
Vector2 RotationCenter [get, set]
float Rotation [get, set]
Vector2 Scale [get, set]
float Depth [get, set]
Properties inherited from Engine3DRadSpace.NatPtrWrapper
IntPtr Handle [get]
Properties inherited from Engine3DRadSpace.Objects.IObject2D
Vector2 Position [get, set]
Vector2 RotationCenter [get, set]
Vector2 Scale [get, set]
float Depth [get, set]
 Z-depth for layering 2D objects.
float Rotation [get, set]
 Rotation in radians.
Properties inherited from Engine3DRadSpace.Objects.IObject
string Name [get, set]
bool Enabled [get, set]
 Is this object enabled?
bool Visible [get, set]
 Is this object visible?
Reflection.UUID UUID [get]
IGame Game [get]
IGraphicsDevice GraphicsDevice [get]
IGizmo Gizmo [get]
ObjectCollection Children [get]
IObject Parent [get, set]

Additional Inherited Members

Protected Member Functions inherited from Engine3DRadSpace.NatPtrWrapper
 NatPtrWrapper (IntPtr handle, Action< IntPtr > fnDestroy)
 NatPtrWrapper (Action< IntPtr > fnDestroy)
void Reset (IntPtr newObj)
void Dispose (bool disposing)
Protected Member Functions inherited from Engine3DRadSpace.Objects.IObject2D
 IObject2D (const std::string &name="", bool enabled=false, bool visible=false, const Math::Vector2 &pos=Math::Vector2::Zero(), const Math::Vector2 &scale=Math::Vector2(0.1f, 0.1f), float rotation=0.0f, const Math::Vector2 &pivot=Math::Vector2::Zero(), float depth=0.0f)
Protected Member Functions inherited from Engine3DRadSpace.Objects.IObject
 IObject (const std::string &name="Empty", bool enabled=false, bool visible=false)
 Default constructor used for reflection. Objects created with this constructor are initially invalid, until internalInitialize() is called.
 IObject (const IObject &) noexcept=delete
IObject & operator= (const IObject &) noexcept=delete
 IObject (IObject &&) noexcept=default
IObject & operator= (IObject &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.IInitializable
 IInitializable ()=default
 IInitializable (const IInitializable &) noexcept=default
IInitializable & operator= (const IInitializable &) noexcept=default
 IInitializable (IInitializable &&) noexcept=default
IInitializable & operator= (IInitializable &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.IUpdateable
 IUpdateable ()=default
 IUpdateable (const IUpdateable &) noexcept=default
IUpdateable & operator= (const IUpdateable &) noexcept=default
 IUpdateable (IUpdateable &&) noexcept=default
IUpdateable & operator= (IUpdateable &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.ILoadable
 ILoadable ()=default
 ILoadable (const ILoadable &) noexcept=default
ILoadable & operator= (const ILoadable &) noexcept=default
 ILoadable (ILoadable &&) noexcept=default
ILoadable & operator= (ILoadable &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.IDrawable2D
 IDrawable2D ()=default
 IDrawable2D (const IDrawable2D &)=default
IDrawable2D & operator= (const IDrawable2D &)=default
 IDrawable2D (IDrawable2D &&) noexcept=default
IDrawable2D & operator= (IDrawable2D &&) noexcept=default
Protected Attributes inherited from Engine3DRadSpace.NatPtrWrapper
IntPtr _handle
bool _disposed
Protected Attributes inherited from Engine3DRadSpace.Objects.IObject
IGame * _game = nullptr
Graphics::IGraphicsDevice * _device = nullptr
IObject * _parent = nullptr

Detailed Description

Represents a 2D text object that can be drawn on the screen using a specified font.

Constructor & Destructor Documentation

◆ TextPrint() [1/5]

TextPrint.TextPrint ( )
inline

◆ TextPrint() [2/5]

◆ TextPrint() [3/5]

Engine3DRadSpace.Objects.TextPrint.TextPrint ( const std::string & name,
bool visible,
RefFont font,
const std::string & text,
const Math::Vector2 & pos,
float rotation,
float scale,
Math::Color color,
float depth )

Constructs a text object from a numerical asset identifier.

Parameters
nameName of the object
visibleIs this object visible?
fontNumerical asset identifier for the font
textText to display
posPosition of the text
rotationRotation of the text, in radians
scaleScale of the text
colorColour of the text
depthDraw depth of the text

◆ TextPrint() [4/5]

Engine3DRadSpace.Objects.TextPrint.TextPrint ( const std::string & name,
bool visible,
const std::filesystem::path & font,
const std::string & text,
const Math::Vector2 & pos,
float rotation,
float scale,
Math::Color color,
float depth )

Constructs a text object from a file path.

Parameters
nameName of the object
visibleIs this object visible?
fontFile path to the font
textText to display
posPosition of the text
rotationRotation of the text, in radians
scaleScale of the text
colorColour of the text
depthDraw depth of the text

◆ TextPrint() [5/5]

Member Function Documentation

◆ Draw2D()

void TextPrint::Draw2D ( )
overridevirtual

Draws the text.

Implements Engine3DRadSpace.IDrawable2D.

◆ GetFont()

Graphics::Font * TextPrint::GetFont ( ) const
noexcept

Gets the underlying font used by this object.

Returns
Pointer to the underlying font

◆ GetGizmo()

Gizmos::IGizmo * TextPrint::GetGizmo ( ) const
overridevirtualnoexcept

Returns the gizmo object of this object, used for editor/debug rendering.

Returns
Pointer to a gizmo instance. Null if no gizmo is associated with this object.

Implements Engine3DRadSpace.Objects.IObject.

◆ GetUUID()

Reflection::UUID TextPrint::GetUUID ( ) const
overridevirtualnoexcept

Gets the UUID of the TextPrint type.

Returns
{12B25ECE-A980-4A58-9388-872AEA9FD2B5}

Implements Engine3DRadSpace.Objects.IObject.

◆ Initialize()

void TextPrint::Initialize ( )
overridevirtual

Does nothing.

Implements Engine3DRadSpace.IInitializable.

◆ Load() [1/2]

void TextPrint::Load ( )
overridevirtual

Loads the font asset.

Implements Engine3DRadSpace.ILoadable.

◆ Load() [2/2]

void TextPrint::Load ( const std::filesystem::path & path)
overridevirtual

Loads a font from a specified path.

Parameters
pathFont file

Implements Engine3DRadSpace.ILoadable.

◆ operator=()

TextPrint & Engine3DRadSpace.Objects.TextPrint.operator= ( TextPrint && )
defaultnoexcept

◆ Update()

void TextPrint::Update ( )
overridevirtual

Does nothing.

Implements Engine3DRadSpace.IUpdateable.

Member Data Documentation

◆ Colour

Math::Color Engine3DRadSpace.Objects.TextPrint.Colour

Colour of the text.

◆ Font

RefFont Engine3DRadSpace.Objects.TextPrint.Font = 0

Numerical reference to the font asset used by this object.

◆ Text

Text to display.

Property Documentation

◆ Color

unsafe Color Engine3DRadSpace.Objects.TextPrint.Color
getset

◆ FontID

uint Engine3DRadSpace.Objects.TextPrint.FontID
getset

◆ Text

string Engine3DRadSpace.Objects.TextPrint.Text
getset

The documentation for this class was generated from the following files: