Arcade Shooter
Font.h
1 
2 /* ██╗ ██╗ █████╗ ████████╗ █████╗ ███╗ ██╗ █████╗
3  ██║ ██╔╝ ██╔══██╗ ╚══██╔══╝ ██╔══██╗ ████╗ ██║ ██╔══██╗
4  █████╔╝ ███████║ ██║ ███████║ ██╔██╗ ██║ ███████║
5  ██╔═██╗ ██╔══██║ ██║ ██╔══██║ ██║╚██╗██║ ██╔══██║
6  ██║ ██╗ ██║ ██║ ██║ ██║ ██║ ██║ ╚████║ ██║ ██║
7  ╚═╝ ╚═╝ ╚═╝ ╚═╝/\ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝
8  /vvvvvvvvvvvvvvvvvvv \=========================================,
9  `^^^^^^^^^^^^^^^^^^^ /---------------------------------------"
10  Katana Engine \/ © 2012 - Shuriken Studios LLC */
11 
12 #pragma once
13 
14 namespace KatanaEngine
15 {
17  class Font : public Resource
18  {
19 
20  public:
21 
22  Font() { }
23  virtual ~Font() { al_destroy_font(m_pFont); }
24 
29  static void SetLoadSize(const int size, const bool restore = false);
30 
35  static void SetCharacterRange(const int rangeCount, int ranges[]);
36 
41  virtual bool Load(const std::string &path, ResourceManager *pManager);
42 
45  virtual int GetLineHeight() const { return al_get_font_line_height(m_pFont); }
46 
50  virtual int GetTextWidth(const char *text) const { return al_get_text_width(m_pFont, text); }
51 
55  virtual bool IsCloneable() const { return false; }
56 
59  virtual ALLEGRO_FONT *GetAllegroFont() const { return m_pFont; }
60 
61 
62  private:
63 
64  static int s_fontSize;
65  static int s_restoreSize;
66 
67  static bool s_alAddonInitialized;
68 
69  static int s_rangeCount;
70  static int *s_ranges;
71 
72  ALLEGRO_FONT *m_pFont;
73 
74  };
75 }
static void SetLoadSize(const int size, const bool restore=false)
Specifies the size of the font when loaded.
Definition: Font.cpp:23
virtual int GetTextWidth(const char *text) const
Gets the width in pixels of the specified string.
Definition: Font.h:50
Represents a font or true-type font.
Definition: Font.h:17
static void SetCharacterRange(const int rangeCount, int ranges[])
Sets which characters to use when using a bitmap as a font.
Definition: Font.cpp:30
Base class for all resource types to be managed by the ResourceManager class.
Definition: Resource.h:19
virtual int GetLineHeight() const
Gets the line height of the font in pixels.
Definition: Font.h:45
virtual bool IsCloneable() const
Used to determine if the font is cloneable.
Definition: Font.h:55
virtual ALLEGRO_FONT * GetAllegroFont() const
Get the allegro font representation of the texture.
Definition: Font.h:59
Loads and manages the lifespan of objects from external files.
Definition: ResourceManager.h:17
virtual bool Load(const std::string &path, ResourceManager *pManager)
Load the desired font into memory.
Definition: Font.cpp:36
Katana Engine is a library of classes, interfaces, and value types that provides a foundation for dev...
Definition: Animation.cpp:14