GameKit  0.0.1a
C++ gamedev tools
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
gk::Text Class Reference

#include <Text.hpp>

Inheritance diagram for gk::Text:
gk::IDrawable gk::Transformable

Public Types

enum  Style {
  Normal = TTF_STYLE_NORMAL, Bold = TTF_STYLE_BOLD, Italic = TTF_STYLE_ITALIC, Underline = TTF_STYLE_UNDERLINE,
  Strikethrough = TTF_STYLE_STRIKETHROUGH
}
 

Public Member Functions

 Text ()=default
 
 Text (const std::string &fontResourceName, int ptsize)
 
 Text (const std::string &text, const std::string &fontResourceName, int ptsize)
 
 Text (const std::string &text, const Font &font, int ptsize)
 
IntRect getLocalBounds ()
 
void setFont (const Font &font)
 
void setFont (const std::string &resourceName)
 
const std::string & text () const
 
void setText (const std::string &text)
 
void setStyle (Style style)
 
void setColor (const Color &color)
 
void setCharacterSize (int size)
 
void setSize (const gk::Vector2i &size)
 
void setCentered (bool isCentered)
 
void setScaled (bool isScaled)
 
void setWrapped (bool isWrapped)
 
- Public Member Functions inherited from gk::IDrawable
virtual ~IDrawable ()=default
 Virtual destructor. More...
 
- Public Member Functions inherited from gk::Transformable
virtual ~Transformable ()=default
 
void setPosition (float x, float y, float z=0)
 
void setPosition (const Vector3f &position)
 
void setOrigin (float x, float y, float z=0)
 
void setOrigin (const Vector3f &origin)
 
void setScale (float factorX, float factorY, float factorZ=1)
 
void setScale (const Vector3f &factors)
 
void setRotation (float angle)
 
void setRotation (float angle, const Vector3f &axis)
 
const Vector3fgetPosition () const
 
const Vector3fgetOrigin () const
 
const Vector3fgetScale () const
 
float getRotation () const
 
void move (float offsetX, float offsetY, float offsetZ=0)
 
void move (const Vector3f &offset)
 
void scale (float factorX, float factorY, float factorZ=1)
 
void scale (const Vector3f &factor)
 
void rotate (float angle)
 
void rotate (float angle, const Vector3f &axis)
 
const TransformgetTransform () const
 

Private Member Functions

void update () const
 
void draw (RenderTarget &target, RenderStates states) const override
 Draw the object to a render target. More...
 

Private Attributes

const Fontm_font = nullptr
 
Style m_style = Style::Normal
 
Color m_color
 
bool m_isUpdateNeeded = false
 
Image m_image
 
Texture m_texture
 
std::string m_text
 
int m_characterSize = -1
 
gk::Vector2i m_size {0, 0}
 
bool m_isCentered = false
 
bool m_isScaled = false
 
bool m_isWrapped = false
 

Additional Inherited Members

Detailed Description

Definition at line 27 of file Text.hpp.

Member Enumeration Documentation

§ Style

Enumerator
Normal 
Bold 
Italic 
Underline 
Strikethrough 

Definition at line 42 of file Text.hpp.

Constructor & Destructor Documentation

§ Text() [1/4]

gk::Text::Text ( )
default

§ Text() [2/4]

gk::Text::Text ( const std::string &  fontResourceName,
int  ptsize 
)

Definition at line 22 of file Text.cpp.

§ Text() [3/4]

gk::Text::Text ( const std::string &  text,
const std::string &  fontResourceName,
int  ptsize 
)

Definition at line 28 of file Text.cpp.

§ Text() [4/4]

gk::Text::Text ( const std::string &  text,
const Font font,
int  ptsize 
)

Definition at line 35 of file Text.cpp.

Member Function Documentation

§ draw()

void gk::Text::draw ( RenderTarget target,
RenderStates  states 
) const
overrideprivatevirtual

Draw the object to a render target.

This is a pure virtual function that has to be implemented by the derived class to define how the drawable should be drawn.

Parameters
targetRender target to draw to
statesCurrent render states

Implements gk::IDrawable.

Definition at line 103 of file Text.cpp.

§ getLocalBounds()

IntRect gk::Text::getLocalBounds ( )

Definition at line 43 of file Text.cpp.

§ setCentered()

void gk::Text::setCentered ( bool  isCentered)
inline

Definition at line 55 of file Text.hpp.

§ setCharacterSize()

void gk::Text::setCharacterSize ( int  size)
inline

Definition at line 52 of file Text.hpp.

§ setColor()

void gk::Text::setColor ( const Color color)
inline

Definition at line 51 of file Text.hpp.

§ setFont() [1/2]

void gk::Text::setFont ( const Font font)
inline

Definition at line 36 of file Text.hpp.

§ setFont() [2/2]

void gk::Text::setFont ( const std::string &  resourceName)

Definition at line 49 of file Text.cpp.

§ setScaled()

void gk::Text::setScaled ( bool  isScaled)
inline

Definition at line 56 of file Text.hpp.

§ setSize()

void gk::Text::setSize ( const gk::Vector2i size)
inline

Definition at line 54 of file Text.hpp.

§ setStyle()

void gk::Text::setStyle ( Style  style)
inline

Definition at line 50 of file Text.hpp.

§ setText()

void gk::Text::setText ( const std::string &  text)
inline

Definition at line 40 of file Text.hpp.

§ setWrapped()

void gk::Text::setWrapped ( bool  isWrapped)
inline

Definition at line 57 of file Text.hpp.

§ text()

const std::string& gk::Text::text ( ) const
inline

Definition at line 39 of file Text.hpp.

§ update()

void gk::Text::update ( ) const
private

Definition at line 53 of file Text.cpp.

Member Data Documentation

§ m_characterSize

int gk::Text::m_characterSize = -1
private

Definition at line 74 of file Text.hpp.

§ m_color

Color gk::Text::m_color
private

Definition at line 67 of file Text.hpp.

§ m_font

const Font* gk::Text::m_font = nullptr
private

Definition at line 64 of file Text.hpp.

§ m_image

Image gk::Text::m_image
mutableprivate

Definition at line 70 of file Text.hpp.

§ m_isCentered

bool gk::Text::m_isCentered = false
private

Definition at line 77 of file Text.hpp.

§ m_isScaled

bool gk::Text::m_isScaled = false
private

Definition at line 78 of file Text.hpp.

§ m_isUpdateNeeded

bool gk::Text::m_isUpdateNeeded = false
mutableprivate

Definition at line 69 of file Text.hpp.

§ m_isWrapped

bool gk::Text::m_isWrapped = false
private

Definition at line 79 of file Text.hpp.

§ m_size

gk::Vector2i gk::Text::m_size {0, 0}
private

Definition at line 76 of file Text.hpp.

§ m_style

Style gk::Text::m_style = Style::Normal
private

Definition at line 66 of file Text.hpp.

§ m_text

std::string gk::Text::m_text
private

Definition at line 73 of file Text.hpp.

§ m_texture

Texture gk::Text::m_texture
mutableprivate

Definition at line 71 of file Text.hpp.


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