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
ColorBox.h
Go to the documentation of this file.
1 // Filename: ColorBox.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 "Color4f.h"
17 #include "GameContainer.h"
18 
19 namespace CGF
20 {
22  {
23  friend class GraphicsDevice;
24 
25  private:
26  struct VertexType
27  {
28  XMFLOAT3 position;
29  XMFLOAT4 color;
30  };
31 
32  public:
33  ColorBox(const Vector2f position, const float width, const float height, GameContainer* game);
34  ColorBox(const Vector2f position, const float width, const float height, const Color4f color, GameContainer* game);
35  ~ColorBox();
36 
37  Vector2f GetPosition();
38  void SetPosition(Vector2f position);
39  void SetPosition(float xPos, float yPos);
40  float GetRotation();
41  void SetRotation(float angle);
42 
43  private:
44  void Render(ID3D11DeviceContext* deviceContext);
45  XMMATRIX GetTransformMatrix();
46 
47  private:
48  bool InitializeBuffers(ID3D11Device*);
49  void ShutdownBuffers();
50  void RenderBuffers(ID3D11DeviceContext*);
51 
52  private:
53  ID3D11Buffer* m_vertexBuffer;
54  ID3D11Buffer* m_indexBuffer;
55  int m_vertexCount;
57  float m_width;
58  float m_height;
59  float m_rotation;
61  Vector2f m_position;
62  };
63 }