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
DrawableString.h
Go to the documentation of this file.
1 // Filename: DrawableString.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 <d3d11.h>
10 #include <DirectXMath.h>
11 #include "CGFInclude.h"
12 #include "CGFException.h"
13 #include "CGFMath.h"
14 #include "IGraphicsObject.h"
15 #include "Vector2f.h"
16 #include "Texture.h"
17 #include "GameContainer.h"
18 #include "Font.h"
19 
20 namespace CGF
21 {
23  {
24  friend class GraphicsDevice;
25 
26  private:
27  struct VertexType
28  {
29  XMFLOAT3 position;
30  XMFLOAT2 texture;
31  };
32 
33  public:
34  DrawableString(const Vector2f position, char* string, Font* font, GameContainer* game);
35  DrawableString(const Vector2f position, char* string, Font* font, Color4f color, GameContainer* game);
36  ~DrawableString();
37 
38  Vector2f GetPosition();
39  void SetPosition(Vector2f position);
40  void SetPosition(float xPos, float yPos);
41 
42  private:
43  void Render(ID3D11DeviceContext* deviceContext);
44  XMMATRIX GetTransformMatrix();
45 
46  bool LoadTexture(ID3D11Device* device, char* filename);
47  void ReleaseTexture();
48 
49  private:
50  bool InitializeBuffers(ID3D11Device* device, int length);
51  bool InitializeSentence(ID3D11DeviceContext* deviceContext, int length);
52  void ShutdownBuffers();
53  void RenderBuffers(ID3D11DeviceContext*);
54 
55  private:
56  ID3D11Buffer* m_vertexBuffer;
57  ID3D11Buffer* m_indexBuffer;
58  int m_vertexCount;
60  Font* m_font;
61  char* m_string;
63  Vector2f m_position;
64  };
65 }