Maria GDK 5.0.0.738
Documentation of native code in develop branch
Loading...
Searching...
No Matches
Maria::CustomTextRenderItem Class Reference
Inheritance diagram for Maria::CustomTextRenderItem:
STK::TextRenderItem STK::RenderItem2D

Public Member Functions

 CustomTextRenderItem (const std::string &text, std::shared_ptr< STK::TextureFont > font, STK::TextHAlignment h_anchor=STK::TextHAlignment::Left, STK::TextVAlignment v_anchor=STK::TextVAlignment::Bottom, float glyphSpacing=0.0)
 
 CustomTextRenderItem (std::shared_ptr< STK::TextItem > text_item)
 Initialize a new text rendering item from the given text item.
 
void render (STK::GraphicsRender2D &renderer, const STK::Matrix4x4f &pj, const STK::Matrix4x4f &vm, const STK::Viewport &vp) override
 
void updateOffset (const STK::Matrix4x4f &vm)
 
void setScalableOffset (const STK::Vector2f &offset)
 
void clearScalableOffset ()
 
const STK::Vector2fgetScalableffset () const
 
void setMiniumOffsetLength (float l)
 
void setMaximumOffsetLength (float l)
 
- Public Member Functions inherited from STK::TextRenderItem
 TextRenderItem (const std::string &text, std::shared_ptr< TextureFont > font, TextHAlignment h_anchor=TextHAlignment::Left, TextVAlignment v_anchor=TextVAlignment::Bottom, float glyphSpacing=0.0)
 
 TextRenderItem (const std::shared_ptr< VertexBuffer2D > &vtx_buffer, const std::string &text, std::shared_ptr< TextureFont > font, TextHAlignment h_anchor=TextHAlignment::Left, TextVAlignment v_anchor=TextVAlignment::Bottom, float glyphSpacing=0.0)
 
 TextRenderItem (std::shared_ptr< TextItem > text_item)
 Initialize a new text rendering item from the given text item.
 
const std::shared_ptr< TextItem > & getTextItem () const
 Returns the underlying text item.
 
void setColor (const STK::Color4f &color)
 Set foreground text color.
 
const STK::Color4fgetColor () const
 
void setBackgroundColor (const STK::Color4f &color)
 
const STK::Color4fgetBackgroundColor () const
 
void setDrawBackground (bool draw_bg)
 
bool getDrawBackground () const
 
void setCornerRadius (float corner_radius)
 
float getCornerRadius () const
 
void setText (const std::string &text)
 
void setPadding (float pad)
 
void setPadding (float v_pad, float h_pad)
 
void setPadding (float top_pad, float h_pad, float bot_pad)
 
void setPadding (float top_pad, float right_pad, float bot_pad, float left_pad)
 
const STK::Vector4fgetPaddingVector ()
 
void setPaddingVector (const STK::Vector4f &padding)
 
float getPadding () const
 
float getPaddingTop () const
 
float getPaddingRight () const
 
float getPaddingBottom () const
 
float getPaddingLeft () const
 
void drawBackgroundRectangle ()
 Draw (possibly rounded) background rectangle.
 
void render (GraphicsRender2D &renderer, const STK::Matrix4x4f &pj, const STK::Matrix4x4f &vm, const STK::Viewport &vp) override
 
int getBatchId () const override
 
void cleanupBuffers () override
 
void setOffset (float x, float y)
 Set 2D offset position of the text (in pixels). This method will invalidate the transform and cause it to be recalculated on the next frame.
 
void setOffsetAngle (float angle)
 Set offset rotation angle for the text item. Positive rotation direction is counter-clockwise. This rotation is relative to setOffset(), so that the entire label will rotate on an offset vector (in pixels) about the position defined by setPosition(). This method will invalidate the transform and cause it to be recalculated on the next frame.
 
float getOffsetAngle () const
 
void setOffset (const STK::Vector2f &offset)
 Same as above.
 
const STK::Vector2fgetOffset () const
 
const STK::Matrix4x4fgetTextTransform ()
 
void setKeepUpright (bool keep_upright)
 
bool keepUpright () const
 
void updateViewportScaling (const STK::Matrix4x4f &mv)
 
void setTextBoundingBox (std::optional< OrientedBoundingBox2f > bbox)
 
std::optional< OrientedBoundingBox2fgetTextBoundingBox () const
 
virtual STK::Box2< float > getVisibleBoundingBox () const
 Get the visible bounding box for the text, relative to the position of the text item. For SDF fonts, the geometry of each glyph stretches outside the actual border of the visible glyph. For normal texture fonts, the visible bounding box is simply given by the text item width/height.
 
STK::Box2< float > getViewBoundingBox (const STK::Matrix4x4f &mvp, const STK::Viewport &glVp, bool reverse_y=false) override
 Get bounding box in viewport pixel coordinates.
 
- Public Member Functions inherited from STK::RenderItem2D
virtual void render (GraphicsRender2D &renderer, const STK::Matrix4x4f &pj, const STK::Matrix4x4f &vm, const STK::Viewport &vp)=0
 
virtual void cleanupBuffers ()=0
 
virtual int getBatchId () const =0
 
void setDepth (float depth)
 
float getDepth () const
 
void setStencilValue (unsigned char stencil_value)
 Set value for stencil operations.
 
unsigned char getStencilValue () const
 Get value for stencil operations.
 
void setStencilMode (StencilMode mode)
 Stencil buffer operations.
 
StencilMode getStencilMode () const
 Stencil buffer operations.
 
const STK::Matrix4x4fgetTransform ()
 
void setPosition (float x, float y)
 Set 2D position of the item. This method will invalidate the transform and cause it to be recalculated on the next frame.
 
void setPosition (const STK::Vector2f &pos)
 Same as above.
 
void setPositionX (float x)
 Set X position separately.
 
void setPositionY (float y)
 Set Y position separately.
 
const STK::Vector2fgetPosition () const
 
float getPositionX () const
 
float getPositionY () const
 
void setScale (const STK::Vector2f &scale)
 
void setScale (float scale)
 Set scale factor for the text item. This method will invalidate the transform and cause it to be recalculated on the next frame.
 
STK::Vector2f getScale () const
 Returns current scale factor for the item.
 
void setAngle (float angle)
 Set rotation angle for the item. Positive rotation direction is counter-clockwise. This method will invalidate the transform and cause it to be recalculated on the next frame.
 
float getAngle () const
 
void setTransform (const STK::Matrix4x4f &transform)
 Set transform directly. This method will set the transformation matrix for this item directly. This will override any values for setPosition(), setScale(), setDepth() and setAngle(). Also, any subsequent calls to these methods will again override this method. In short, either use setTransform() or setPosition/Scale/Angle/Depth.
 
void setPreTransform (const STK::Matrix4x4f &transform)
 
void setPostTransform (const STK::Matrix4x4f &transform)
 
std::optional< STK::Matrix4x4fgetPreTransform () const
 
std::optional< STK::Matrix4x4fgetPostTransform () const
 
void setOpacity (float opacity)
 
float getOpacity () const
 
virtual STK::Box2< float > getViewBoundingBox (const STK::Matrix4x4f &mvp, const STK::Viewport &glVp, bool reverse_y=false)=0
 Get bounding box in viewport pixel coordinates.
 

Protected Attributes

STK::Vector2f scalableOffset_
 
float minOffsetLength_
 
float maxOffsetLength_
 
bool hasScalableOffset_
 
- Protected Attributes inherited from STK::TextRenderItem
std::shared_ptr< TextItemtext_item_
 
STK::Matrix4x4f text_transform_
 
STK::Vector2f offset_
 
float offset_angle_ = 0.0f
 
STK::Color4f color_ = STK::Color4f(0.0f, 0.0f, 0.0f, 1.0f)
 
STK::Color4f bg_color_ = STK::Color4f(0.0f, 0.0f, 0.0f, 0.0f)
 
bool draw_bg_ = false
 
bool keep_upright_ = false
 
STK::Vector4f padding_
 
float corner_radius_ = 0.0f
 
bool bg_dirty_ = false
 
std::shared_ptr< STK::VertexBuffer2Dbg_vtx_buf_
 
float viewportScale_ = 1.0f
 
std::optional< OrientedBoundingBox2ftextBbox_
 
- Protected Attributes inherited from STK::RenderItem2D
float depth_ = 0
 
STK::Matrix4x4f transform_
 
STK::Vector2f pos_
 
float angle_ = 0.0f
 
float opacity_ = 1.0f
 
STK::Vector2f scale_ { 1.0f, 1.0f }
 
bool transform_dirty_ = false
 
std::optional< STK::Matrix4x4fpre_transform_
 
std::optional< STK::Matrix4x4fpost_transform_
 
std::mutex xfm_mutex_
 
unsigned char stencil_value_ = 0
 
StencilMode stencil_mode_ = StencilMode::NONE
 
float view_scale_x_ = 1.0f
 
float view_scale_y_ = 1.0f
 

Additional Inherited Members

- Protected Member Functions inherited from STK::TextRenderItem
void updateTransform () override
 
void setViewportScale (const float scale)
 
- Protected Member Functions inherited from STK::RenderItem2D
virtual void updateTransform ()
 
void setViewScale (float x, float y)
 

Constructor & Destructor Documentation

◆ CustomTextRenderItem()

CustomTextRenderItem::CustomTextRenderItem ( std::shared_ptr< STK::TextItem text_item)

Initialize a new text rendering item from the given text item.

Parameters
text_item

Member Function Documentation

◆ render()

void CustomTextRenderItem::render ( STK::GraphicsRender2D renderer,
const STK::Matrix4x4f pj,
const STK::Matrix4x4f vm,
const STK::Viewport vp 
)
overridevirtual

Render item into the current frame. This method should render a single item into the GraphicsRender2D.

Implements STK::RenderItem2D.


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