Space Fighter
A "shmup" game for Computer Programming C++
Loading...
Searching...
No Matches
KatanaEngine::Font Class Reference

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

#include <Font.h>

Inheritance diagram for KatanaEngine::Font:

Public Member Functions

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

Static Public Member Functions

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

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.
 
void ParseComments (std::string &line)
 Removes c-style, single-line comments from a line of text.
 
void TrimLine (std::string &line)
 Removes white-space at the front and end of a line of text.
 
ResourceManagerGetResourceManager ()
 Gets a pointer to the ResourceManager that was used to load the resource.
 
virtual ResourceClone ()
 Clones a resource.
 

Detailed Description

Represents a font or true-type font.

Definition at line 20 of file Font.h.

Constructor & Destructor Documentation

◆ Font()

KatanaEngine::Font::Font ( )
inline

Definition at line 25 of file Font.h.

◆ ~Font()

virtual KatanaEngine::Font::~Font ( )
inlinevirtual

Definition at line 26 of file Font.h.

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.

Definition at line 62 of file Font.h.

◆ GetLineHeight()

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

Gets the line height of the font in pixels.

Returns
Returns the line height in pixels.

Definition at line 48 of file Font.h.

◆ 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.

Definition at line 53 of file Font.h.

◆ 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.

Definition at line 58 of file Font.h.

◆ 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.

Definition at line 39 of file Font.cpp.

◆ 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.

Definition at line 33 of file Font.cpp.

◆ 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.

Definition at line 26 of file Font.cpp.


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