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
D3DManager.h
Go to the documentation of this file.
1 // Filename: D3DManager.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 <dxgi.h>
10 #include <d3dcommon.h>
11 #include <d3d11.h>
12 #include <DirectXMath.h>
13 #include "CGFInclude.h"
14 #include "CGFMath.h"
15 
16 namespace CGF
17 {
19  {
20  public:
21  D3DManager();
22  ~D3DManager();
23 
24  bool Initialize(int screenWidth, int screenHeight, bool vsync, HWND hwnd, bool fullscreen, float screenDepth, float screenNear);
25  void Shutdown();
26 
27  void BeginScene(float red, float green, float blue, float alpha);
28  void EndScene();
29 
30  void ZBuffer(const bool isSwitchedOn);
31  void AlphaBlending(const bool isSwitchedOn);
32 
33  ID3D11Device* GetDevice();
34  ID3D11DeviceContext* GetDeviceContext();
35 
36  XMMATRIX GetProjectionMatrix();
37  XMMATRIX GetWorldMatrix();
38  XMMATRIX GetOrthoMatrix();
39 
40  void GetVideoCardInfo(char* cardName, int& memory);
41 
42  private:
43  bool m_vsyncEnabled;
44  int m_videoCardMemory;
45  char m_videoCardDescription[128];
47  IDXGISwapChain* m_swapChain;
48  ID3D11Device* m_device;
49  ID3D11DeviceContext* m_deviceContext;
51  ID3D11RenderTargetView* m_renderTargetView;
52  ID3D11Texture2D* m_depthStencilBuffer;
53  ID3D11DepthStencilState* m_depthStencilState;
54  ID3D11DepthStencilView* m_depthStencilView;
56  ID3D11DepthStencilState* m_depthDisabledStencilState;
58  ID3D11RasterizerState* m_rasterState;
59  XMMATRIX m_projectionMatrix;
60  XMMATRIX m_worldMatrix;
61  XMMATRIX m_orthoMatrix;
63  ID3D11BlendState* m_alphaEnableBlendingState;
64  ID3D11BlendState* m_alphaDisableBlendingState;
65  };
66 }