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
FontShader.h
Go to the documentation of this file.
1 // Filename: FontShader.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 <D3Dcompiler.h>
12 #include "CGFInclude.h"
13 #include "Color4f.h"
14 
15 using namespace DirectX;
16 
17 namespace CGF
18 {
20  {
21  private:
22  struct MatrixBufferType
23  {
24  XMMATRIX world;
25  XMMATRIX view;
26  XMMATRIX projection;
27  };
28 
29  struct PixelBufferType
30  {
31  XMFLOAT4 pixelColor;
32  };
33 
34  public:
35  FontShader();
36  ~FontShader();
37 
38  bool Initialize(ID3D11Device* device, HWND hwnd);
39  void Shutdown();
40  bool Render(ID3D11DeviceContext* deviceContext, int indexCount, const XMMATRIX &worldMatrix, const XMMATRIX &viewMatrix, const XMMATRIX &projectionMatrix, ID3D11ShaderResourceView* texture, Color4f pixelColor);
41 
42  private:
43  bool InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename);
44  void ShutdownShader();
45 
46  bool SetShaderParameters(ID3D11DeviceContext* deviceContext, const XMMATRIX &worldMatrix, const XMMATRIX &viewMatrix, const XMMATRIX &projectionMatrix, ID3D11ShaderResourceView* texture, XMFLOAT4 pixelColor);
47  void RenderShader(ID3D11DeviceContext* deviceContext, int indexCount);
48 
49  private:
50  ID3D11VertexShader* m_vertexShader;
51  ID3D11PixelShader* m_pixelShader;
52  ID3D11InputLayout* m_layout;
53  ID3D11Buffer* m_matrixBuffer;
54  ID3D11SamplerState* m_sampleState;
55  ID3D11Buffer* m_pixelBuffer;
56  };
57 }