-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDirectDrawUtility.h
59 lines (41 loc) · 1.16 KB
/
DirectDrawUtility.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
49
50
51
52
53
54
55
56
57
58
59
#pragma once
#include <Windows.h>
#include <ddraw.h>
#define WIN32_LEAN_AND_MEAN
#define DDRAW_INIT_STRUCT( dds ) { ZeroMemory( &dds, sizeof( dds ) ); dds.dwSize = sizeof( dds ); }
#define SafeRelease( x ) if ( x ) { x->Release(); x = NULL; }
namespace DirectDrawWrapper
{
#pragma unmanaged
class DirectDrawWrapper
{
public:
DirectDrawWrapper( void );
~DirectDrawWrapper( void );
void Initialize( HWND );
void Release( void );
void CreateDevice();
void ResetDevice();
bool Lock( bool );
void Render();
int Width, Height, Stride;
unsigned int BackgroundColor;
void * VideoMemory;
char PixelSize;
private:
void CreateBackBuffer();
void DisplayError( HRESULT, LPCTSTR );
void InitializeRealColorSurface( LPDDSURFACEDESC2 ddsd );
void InitializeHiColorSurface( LPDDSURFACEDESC2 ddsd );
void InitializeTrueColorSurface( LPDDSURFACEDESC2 ddsd );
HWND hWnd;
RECT clientArea;
POINT p1, p2;
LPDIRECTDRAW7 lpDirectDraw;
LPDIRECTDRAWSURFACE7 lpDDSPrimary;
LPDIRECTDRAWSURFACE7 lpDDSBack;
LPDIRECTDRAWCLIPPER lpDDClipper;
LPDIRECTDRAWPALETTE lpDDPalette;
PALETTEENTRY paletteEntries[ 256 ];
};
}