Arcade Shooter
Public Member Functions | Static Public Member Functions | List of all members
KatanaEngine::Font Class Reference

Represents a font or true-type font. More...

#include <Font.h>

Inheritance diagram for KatanaEngine::Font:
KatanaEngine::Resource

Public Member Functions

virtual bool Load (const std::string &path, ResourceManager *pManager)
 Load the desired font into memory. More...
 
virtual int GetLineHeight () const
 Gets the line height of the font in pixels. More...
 
virtual int GetTextWidth (const char *text) const
 Gets the width in pixels of the specified string. More...
 
virtual bool IsCloneable () const
 Used to determine if the font is cloneable. More...
 
virtual ALLEGRO_FONT * GetAllegroFont () const
 Get the allegro font representation of the texture. More...
 
- Public Member Functions inherited from KatanaEngine::Resource
unsigned short GetResourceID () const
 Gets the ID of the resource. More...
 

Static Public Member Functions

static void SetLoadSize (const int size, const bool restore=false)
 Specifies the size of the font when loaded. More...
 
static void SetCharacterRange (const int rangeCount, int ranges[])
 Sets which characters to use when using a bitmap as a font. More...
 

Additional Inherited Members

- Protected Member Functions inherited from KatanaEngine::Resource
void Split (const std::string &line, const char delimeter, std::vector< std::string > &elements)
 Splits a string into a vector of strings. More...
 
void ParseComments (std::string &line)
 Removes c-style, single-line comments from a line of text. More...
 
void TrimLine (std::string &line)
 Removes white-space at the front and end of a line of text. More...
 
ResourceManagerGetResourceManager ()
 Gets a pointer to the ResourceManager that was used to load the resource. More...
 
virtual ResourceClone ()
 Clones a resource. More...
 

Detailed Description

Represents a font or true-type font.

Member Function Documentation

◆ GetAllegroFont()

virtual ALLEGRO_FONT* KatanaEngine::Font::GetAllegroFont ( ) const
inlinevirtual

Get the allegro font representation of the texture.

Returns
Returns the underlaying allegro font.

◆ GetLineHeight()

virtual int KatanaEngine::Font::GetLineHeight ( ) const
inlinevirtual

Gets the line height of the font in pixels.

Returns
Returns the line height in pixels.

◆ GetTextWidth()

virtual int KatanaEngine::Font::GetTextWidth ( const char *  text) const
inlinevirtual

Gets the width in pixels of the specified string.

Parameters
textThe string to measure.
Returns
Returns the width in pixels.

◆ IsCloneable()

virtual bool KatanaEngine::Font::IsCloneable ( ) const
inlinevirtual

Used to determine if the font is cloneable.

Returns
Returns true if the font is clonable, false otherwise.
Remarks
Fonts should usually not be cloneable.

Implements KatanaEngine::Resource.

◆ Load()

bool KatanaEngine::Font::Load ( const std::string &  path,
ResourceManager pManager 
)
virtual

Load the desired font into memory.

Parameters
pathThe path to the desired font.
pManagerA pointer to the ResourceManager that will manage the font.
Returns
Returns true if the font was loaded, false otherwise.

Implements KatanaEngine::Resource.

◆ SetCharacterRange()

void KatanaEngine::Font::SetCharacterRange ( const int  rangeCount,
int  ranges[] 
)
static

Sets which characters to use when using a bitmap as a font.

Parameters
rangeCountThe length of the ranges array.
rangesThe character ranges.
Remarks
See https://www.allegro.cc/manual/5/al_grab_font_from_bitmap for more information.

◆ SetLoadSize()

void KatanaEngine::Font::SetLoadSize ( const int  size,
const bool  restore = false 
)
static

Specifies the size of the font when loaded.

Parameters
sizeThe desired size of the font.
restoreTo determine if the load size should revert back to previous after the next font is loaded.

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