-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBackBuffer.h
48 lines (38 loc) · 1.29 KB
/
BackBuffer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//Programmer: Axel Rotter Morgado
//Date: 18.04.2016
#ifndef BACKBUFFER_H
#define BACKBUFFER_H
#include <Windows.h>
class BackBuffer
{
public:
//BackBuffer constructor that take the handle to the window from
//which it will create a device context and the width and height.
BackBuffer(HWND hWnd, int width, int height);
//BackBuffer destructor
~BackBuffer();
//Data member getters
HDC getDC();
int width();
int height();
//Method that presents the back buffer to the client window
void present();
private:
// Make copy constructor and assignment operator private
// so client cannot copy BackBuffers. We do this because
// this class is not designed to be copied because it
// is not efficient--copying bitmaps is slow (lots of memory).
// In addition, most applications will probably only need one
// BackBuffer anyway.
BackBuffer(const BackBuffer& rhs);
BackBuffer& operator=(const BackBuffer& rhs);
private:
//Data members
HWND mhWnd; //Window handle
HDC mhDC; //Device context handle
HBITMAP mhSurface; //Bitmap surfave to be drawn upon
HBITMAP mhOldObject; //Old bitmap that was selected before the draw
int mWidth; //Width of client area
int mHeight; //Height of client area
};
#endif //BACKBUFFER_H