Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Nz::TextSprite Class Reference

Graphics class that represents the rendering of a sprite containing text. More...

Inheritance diagram for Nz::TextSprite:
Nz::InstancedRenderable Nz::RefCounted

Public Member Functions

 TextSprite ()
 Constructs a TextSprite object by default.
 
 TextSprite (const AbstractTextDrawer &drawer)
 Constructs a TextSprite object with a drawer. More...
 
 TextSprite (const TextSprite &sprite)
 Constructs a TextSprite object by assignation. More...
 
void AddToRenderQueue (AbstractRenderQueue *renderQueue, const InstanceData &instanceData) const override
 Adds the text to the rendering queue. More...
 
void Clear ()
 Clears the data.
 
const ColorGetColor () const
 Gets the color of the text sprite. More...
 
float GetScale () const
 Gets the current scale of the text sprite. More...
 
void SetColor (const Color &color)
 Sets the color of the text sprite. More...
 
void SetDefaultMaterial ()
 Sets the default material of the text sprite (just default material)
 
void SetMaterial (MaterialRef material)
 Sets the material of the text sprite. More...
 
void SetMaterial (std::size_t skinIndex, MaterialRef material)
 
void SetScale (float scale)
 Sets the current scale of the text sprite. More...
 
void Update (const AbstractTextDrawer &drawer)
 Updates the text. More...
 
TextSpriteoperator= (const TextSprite &text)
 Sets the current text sprite with the content of the other one. More...
 
- Public Member Functions inherited from Nz::InstancedRenderable
 InstancedRenderable ()
 Constructs a InstancedRenderable object by default.
 
 InstancedRenderable (const InstancedRenderable &renderable)
 Constructs a InstancedRenderable object by assignation. More...
 
 InstancedRenderable (InstancedRenderable &&renderable)=delete
 
virtual ~InstancedRenderable ()
 Destructs the object and calls OnInstancedRenderableRelease. More...
 
virtual bool Cull (const Frustumf &frustum, const InstanceData &instanceData) const
 Culls the instanced if not in the frustum. More...
 
void EnsureBoundingVolumeUpdated () const
 Ensures that the bounding volume is up to date.
 
virtual const BoundingVolumefGetBoundingVolume () const
 Gets the bounding volume. More...
 
const MaterialRefGetMaterial (std::size_t matIndex=0) const
 Gets one of the material used by the object. More...
 
const MaterialRefGetMaterial (std::size_t skinIndex, std::size_t matIndex) const
 Gets one of the material used by the object, independently from the active skin. More...
 
std::size_t GetMaterialCount () const
 Gets the number of material per skin. More...
 
std::size_t GetSkin () const
 Gets the current active skin index. More...
 
std::size_t GetSkinCount () const
 Gets the number of skins this object has. More...
 
virtual void InvalidateData (InstanceData *instanceData, UInt32 flags) const
 Invalidates data for instanced. More...
 
void SetSkin (std::size_t skinIndex)
 Changes the active skin. More...
 
void SetSkinCount (std::size_t skinCount)
 Changes the maximum skin count of the object. More...
 
virtual void UpdateBoundingVolume (InstanceData *instanceData) const
 Updates the bounding volume. More...
 
InstancedRenderableoperator= (const InstancedRenderable &renderable)
 Sets the current instanced renderable with the content of the other one. More...
 
InstancedRenderableoperator= (InstancedRenderable &&renderable)=delete
 
 NazaraSignal (OnInstancedRenderableInvalidateBoundingVolume, const InstancedRenderable *)
 
 NazaraSignal (OnInstancedRenderableInvalidateData, const InstancedRenderable *, UInt32)
 
 NazaraSignal (OnInstancedRenderableInvalidateMaterial, const InstancedRenderable *, std::size_t, std::size_t, const MaterialRef &)
 
 NazaraSignal (OnInstancedRenderableRelease, const InstancedRenderable *)
 
 NazaraSignal (OnInstancedRenderableResetMaterials, const InstancedRenderable *, std::size_t)
 
 NazaraSignal (OnInstancedRenderableSkinChange, const InstancedRenderable *, std::size_t)
 
- Public Member Functions inherited from Nz::RefCounted
 RefCounted (bool persistent=true)
 Constructs a RefCounted object with a persistance aspect. More...
 
 RefCounted (const RefCounted &)=delete
 
 RefCounted (RefCounted &&)=default
 
virtual ~RefCounted ()
 Destructs the object. More...
 
void AddReference () const
 Adds a reference to the object.
 
unsigned int GetReferenceCount () const
 Gets the number of references to the object. More...
 
bool IsPersistent () const
 Checks whether the object is persistent. More...
 
bool RemoveReference () const
 Removes a reference to the object. More...
 
bool SetPersistent (bool persistent=true, bool checkReferenceCount=false)
 Sets the persistence of the object. More...
 
RefCountedoperator= (const RefCounted &)=delete
 
RefCountedoperator= (RefCounted &&)=default
 

Static Public Member Functions

template<typename... Args>
static TextSpriteRef New (Args &&... args)
 Creates a new text sprite from the arguments. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Nz::InstancedRenderable
void InvalidateBoundingVolume ()
 Invalidates the bounding volume.
 
void InvalidateInstanceData (UInt32 flags)
 Invalidates the instance data based on flags. More...
 
void ResetMaterials (std::size_t matCount, std::size_t skinCount=1)
 Resets the materials, material count and skin count. More...
 
void SetMaterial (std::size_t matIndex, MaterialRef material)
 Changes the material used at the specified index by another one. More...
 
void SetMaterial (std::size_t skinIndex, std::size_t matIndex, MaterialRef material)
 Changes the material used at the specified index by another one, independently from the active skin. More...
 
- Protected Attributes inherited from Nz::InstancedRenderable
BoundingVolumef m_boundingVolume
 

Detailed Description

Graphics class that represents the rendering of a sprite containing text.

Constructor & Destructor Documentation

◆ TextSprite() [1/2]

Nz::TextSprite::TextSprite ( const AbstractTextDrawer &  drawer)
inline

Constructs a TextSprite object with a drawer.

Parameters
drawerDrawer used to compose text on the sprite

◆ TextSprite() [2/2]

Nz::TextSprite::TextSprite ( const TextSprite sprite)
inline

Constructs a TextSprite object by assignation.

Parameters
spriteTextSprite to copy into this

Member Function Documentation

◆ AddToRenderQueue()

void Nz::TextSprite::AddToRenderQueue ( AbstractRenderQueue renderQueue,
const InstanceData &  instanceData 
) const
overridevirtual

Adds the text to the rendering queue.

Parameters
renderQueueQueue to be added
instanceDataData for the instance

Implements Nz::InstancedRenderable.

◆ GetColor()

const Color & Nz::TextSprite::GetColor ( ) const
inline

Gets the color of the text sprite.

Returns
Current color

◆ GetScale()

float Nz::TextSprite::GetScale ( ) const
inline

Gets the current scale of the text sprite.

Returns
Current scale

◆ New()

template<typename... Args>
TextSpriteRef Nz::TextSprite::New ( Args &&...  args)
static

Creates a new text sprite from the arguments.

Returns
A reference to the newly created text sprite
Parameters
argsArguments for the text sprite

◆ operator=()

TextSprite & Nz::TextSprite::operator= ( const TextSprite text)
inline

Sets the current text sprite with the content of the other one.

Returns
A reference to this
Parameters
textsprite The other TextSprite

◆ SetColor()

void Nz::TextSprite::SetColor ( const Color color)
inline

Sets the color of the text sprite.

Parameters
colorColor for the text sprite

◆ SetMaterial()

void Nz::TextSprite::SetMaterial ( MaterialRef  material)
inline

Sets the material of the text sprite.

Parameters
materialMaterial for the text sprite

◆ SetScale()

void Nz::TextSprite::SetScale ( float  scale)
inline

Sets the current scale of the text sprite.

Parameters
scaleScale of the text sprite

◆ Update()

void Nz::TextSprite::Update ( const AbstractTextDrawer &  drawer)

Updates the text.

Parameters
drawerDrawer used to compose the text
Remarks
Produces a NazaraAssert if atlas does not use a hardware storage

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