C++ Game Framework  2013-06-04
CGF is a DirectX 11 game framework, built in C++ and DirectX 11. This is used to contain many to the DirectX functionality and wrap them into a framework to make game development easier.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Font.h
Go to the documentation of this file.
1 // Filename: Font.h
4 
5 //Preprocessor directive designed to cause the current source file to be included only once in a single compilation
6 #pragma once
7 
8 //Includes
9 #include "CGFInclude.h"
10 #include "CGFException.h"
11 #include "Texture.h"
12 #include <d3d11.h>
13 #include <DirectXMath.h>
14 #include "GameContainer.h"
15 #include <fstream>
16 
17 namespace CGF
18 {
19  class CGF_API Font
20  {
21  friend class DrawableString;
22 
23  private:
24  struct FontType
25  {
26  float left, right;
27  int size;
28  };
29 
30  struct VertexType
31  {
32  XMFLOAT3 position;
33  XMFLOAT2 texture;
34  };
35 
36  public:
37  Font(char* fontFilename, WCHAR* textureFilename, GameContainer* game);
38  ~Font();
39 
40  void BuildVertexArray(VertexType*, char*, float, float);
41 
42  Texture* GetTexture();
43 
44  private:
45  bool LoadFontData(char* filename);
46  void ReleaseFontData();
47  bool LoadTexture(ID3D11Device* device, WCHAR* filename);
48  void ReleaseTexture();
49 
50  private:
51  FontType* m_font;
52  Texture* m_texture;
53  };
54 }