Graphics.h
1 
7 #pragma once
8 #include <Windows.h>
9 #include <d2d1.h>
10 
15 class Graphics
16 {
20  ID2D1Factory* EngineFactory;
21 
25  ID2D1HwndRenderTarget* EngineRendertarget;
26 
30  ID2D1SolidColorBrush* brush;
31 
32 public:
36  Graphics();
37 
41  ~Graphics();
42 
46  bool Inti(HWND engineWindowHandle);
47 
52  ID2D1RenderTarget* Rendertarget()
53  {
54  return EngineRendertarget;
55  }
56 
60  void BeginDarw() { EngineRendertarget->BeginDraw(); }
61 
65  void EndDraw() { EngineRendertarget->EndDraw(); }
66 
70  void ClearScreen(float r, float g, float b);
71 
75  void DrawCircle(float c, float y, float radius, float r, float g, float b, float a);
76 };
ID2D1RenderTarget * Rendertarget()
This is allows the handing of bitmap image during the conversion process
Definition: Graphics.h:52
ID2D1Factory * EngineFactory
This factory allow many types of D2D resources to be created
Definition: Graphics.h:20
ID2D1HwndRenderTarget * EngineRendertarget
The render-target is similar to a back buffer from the GPU memory
Definition: Graphics.h:25
bool Inti(HWND engineWindowHandle)
This is initialize the game window
Definition: Graphics.cpp:43
Graphics()
This is the constructor for the graphics object
Definition: Graphics.cpp:16
Class for Graphics This class manages the Graphics objects
Definition: Graphics.h:15
void EndDraw()
This ends the drawing process
Definition: Graphics.h:65
void DrawCircle(float c, float y, float radius, float r, float g, float b, float a)
This draws a circle in the game window
Definition: Graphics.cpp:79
ID2D1SolidColorBrush * brush
This is a COM interface that should also be release at the end
Definition: Graphics.h:30
void ClearScreen(float r, float g, float b)
This provides a clear screen
Definition: Graphics.cpp:71
~Graphics()
This is the destructor for the graphics objects
Definition: Graphics.cpp:30
void BeginDarw()
This starts the drawing process
Definition: Graphics.h:60