-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathVideoMemory.cpp
73 lines (58 loc) · 1.05 KB
/
VideoMemory.cpp
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include "VideoMemory.h"
namespace DirectDrawWrapper
{
VideoMemory::VideoMemory( IntPtr hWnd )
{
pDDW = new DirectDrawWrapper();
pDDW->Initialize
(
static_cast<HWND>( hWnd.ToPointer() )
);
}
void VideoMemory::CreateDevice()
{
pDDW->CreateDevice();
Width = pDDW->Width; Height = pDDW->Height;
}
void VideoMemory::ResetDevice()
{
pDDW->ResetDevice();
Width = pDDW->Width; Height = pDDW->Height;
}
void VideoMemory::SetColorFormat( PixelSize pixelSize )
{
pDDW->PixelSize = ( int )pixelSize;
}
void VideoMemory::SetBackgroundColor( unsigned int color )
{
pDDW->BackgroundColor = color;
}
bool VideoMemory::ReadyFrame( bool clearFrame )
{
if( pDDW->Lock( clearFrame ) )
{
VideoMemoryPtr = ( IntPtr )pDDW->VideoMemory;
Stride = pDDW->Stride;
return true;
}
return false;
}
void VideoMemory::RenderFrame()
{
pDDW->Render();
}
void VideoMemory::Release()
{
pDDW->Release();
}
VideoMemory::~VideoMemory()
{
delete pDDW;
pDDW = 0;
}
VideoMemory::!VideoMemory()
{
delete pDDW;
pDDW = 0;
}
}