MinGfx Toolkit  1.0
A minimal library for writing cross-platform (Windows, OSX, linux) graphics programs.
Classes | Public Types | Public Member Functions | List of all members
mingfx::TextShader Class Reference

Detailed Description

Definition at line 36 of file text_shader.h.

#include <text_shader.h>

Classes

class  TextFormat
 

Public Types

enum class  HorizAlign { HORIZ_ALIGN_LEFT , HORIZ_ALIGN_CENTER , HORIZ_ALIGN_RIGHT }
 
enum class  VertAlign { VERT_ALIGN_TOP , VERT_ALIGN_CENTER , VERT_ALIGN_BASELINE , VERT_ALIGN_BOTTOM }
 

Public Member Functions

 TextShader ()
 
virtual ~TextShader ()
 
bool Init (const std::string &font_file, int native_font_size)
 Call this from within the InitOpenGL() function since it will initialize not just the Font's internal data but also an OpenGL texture to be stored on the graphics card. Internally, this uses the stb_truetype library to load true type fonts (files with a .ttf extension). More...
 
void Draw3D (const Matrix4 &model, const Matrix4 &view, const Matrix4 &projection, const std::string &text, TextFormat format, bool cache=false)
 
Vector2 TextExtents (const std::string &text, TextFormat format, bool cache=false)
 
float native_font_size ()
 

Member Enumeration Documentation

◆ HorizAlign

Enumerator
HORIZ_ALIGN_LEFT 
HORIZ_ALIGN_CENTER 
HORIZ_ALIGN_RIGHT 

Definition at line 47 of file text_shader.h.

◆ VertAlign

Enumerator
VERT_ALIGN_TOP 
VERT_ALIGN_CENTER 
VERT_ALIGN_BASELINE 
VERT_ALIGN_BOTTOM 

Definition at line 53 of file text_shader.h.

Constructor & Destructor Documentation

◆ TextShader()

mingfx::TextShader::TextShader ( )

◆ ~TextShader()

virtual mingfx::TextShader::~TextShader ( )
virtual

Member Function Documentation

◆ Draw3D()

void mingfx::TextShader::Draw3D ( const Matrix4 model,
const Matrix4 view,
const Matrix4 projection,
const std::string &  text,
TextFormat  format,
bool  cache = false 
)

◆ Init()

bool mingfx::TextShader::Init ( const std::string &  font_file,
int  native_font_size 
)

Call this from within the InitOpenGL() function since it will initialize not just the Font's internal data but also an OpenGL texture to be stored on the graphics card. Internally, this uses the stb_truetype library to load true type fonts (files with a .ttf extension).

◆ native_font_size()

float mingfx::TextShader::native_font_size ( )

◆ TextExtents()

Vector2 mingfx::TextShader::TextExtents ( const std::string &  text,
TextFormat  format,
bool  cache = false 
)

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