#include <renderable2dtextcomponent.h>
Public Attributes | |
utility::ETextOrientation | mOrientation = utility::ETextOrientation::Left |
Property: 'Orientation' text draw orientation. More... | |
glm::ivec2 | mLocation = { 0,0 } |
Property: 'Location' text location in pixel coordinates. More... | |
EDepthMode | mDepthMode = EDepthMode::NoReadWrite |
Property: 'DepthMode' how text is handled by z-buffer. More... | |
bool | mIgnoreTransform = true |
Property: 'IgnoreTransform' if the transform is ignored when present. More... | |
bool | mDPIAware = true |
Property: 'DPI Aware' if the text is scaled based on display DPI. High DPI rendering must be enabled for this flag to have any effect. More... | |
![]() | |
ResourcePtr< Font > | mFont |
Property: 'Font' that represents the style of the text. More... | |
std::string | mText |
Property: 'Text' to draw. More... | |
RGBColorFloat | mColor = { 1.0f, 1.0f, 1.0f } |
Property: 'TextColor' the color of the text. More... | |
![]() | |
bool | mVisible = true |
Property: 'Visible' if this object is rendered to target by the render service. More... | |
ResourcePtr< RenderLayer > | mLayer |
Property: 'Layer' the render layer assigned to this component. More... | |
std::vector< ResourcePtr< RenderTag > > | mTags |
Property: 'Tags' List of tags specifying the category this render component belongs to. More... | |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Additional Inherited Members | |
![]() | |
virtual void | getDependentComponents (std::vector< rtti::TypeInfo > &components) const |
virtual const rtti::TypeInfo | getInstanceType () const =0 |
![]() | |
Resource () | |
![]() | |
Object () | |
virtual | ~Object () |
virtual bool | init (utility::ErrorState &errorState) |
virtual void | onDestroy () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
Allows you to render text at a specific location in screen space. Use this component when you want to render text at a specific location on screen or in a render-target. Use the Renderable3DTextComponent to draw text in 3D space with a perspective camera.
Call draw() in the render part of your application to render text to a specific location on screen or a render-target. It is also possible to render the text using RenderService::renderObjects(), this is similar to how meshes are rendered. In that case the x/y location of the camera influences the final location of the text.
When the parent entity has a transform component attached to it and 'IgnoreTransform' is set to false, the x/y Translate values are used as offset in pixel space. 2D text cannot be scaled or rotated, this ensures that every Glyph is rendered in it's native resolution. When rendering this component through the render interface of the render service it is advised to use an orthographic camera.
It is possible to cache multiple lines at once, where each line can be selected and drawn individually inside a render loop. This is useful when you want the same component to render multiple lines of text, removing the need to declare a component for each individual line. You cannot update or add a line of text when rendering a frame: inside the render loop. Only update or add new lines of text on update. You can however change the position and line of text to draw inside the render loop.
For example, on update:
And on render:
EDepthMode mDepthMode = EDepthMode::NoReadWrite |
Property: 'DepthMode' how text is handled by z-buffer.
bool mDPIAware = true |
Property: 'DPI Aware' if the text is scaled based on display DPI. High DPI rendering must be enabled for this flag to have any effect.
bool mIgnoreTransform = true |
Property: 'IgnoreTransform' if the transform is ignored when present.
glm::ivec2 mLocation = { 0,0 } |
Property: 'Location' text location in pixel coordinates.
utility::ETextOrientation mOrientation = utility::ETextOrientation::Left |
Property: 'Orientation' text draw orientation.