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