1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
5 #include "DirectDrawGlobals.h"
7 static char *VB_Name = "DirectDrawGlobals";
11 DirectDraw7 DirectDraw;
12 DirectDrawSurface7 PrimarySurface;
14 void InitDirectDraw(long hWndClip)
18 // DirectX = New DirectX7; // (handle this later, if needed)
19 DirectDraw = DirectX.DirectDrawCreate("");
20 DirectDraw.SetCooperativeLevel(0, DDSCL_NORMAL);
21 // Create PrimarySurface:
23 SD.lFlags = DDSD_CAPS;
24 SD.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE;
26 PrimarySurface = DirectDraw.CreateSurface(SD);
28 ClipToWindow(hWndClip);
31 void ReleaseDirectDraw()
33 SET_TO_NOTHING(&PrimarySurface, sizeof(PrimarySurface));
34 SET_TO_NOTHING(&DirectDraw, sizeof(DirectDraw));
35 SET_TO_NOTHING(&DirectX, sizeof(DirectX));
38 void ClipToWindow(long hWnd)
40 DirectDrawClipper Clipper;
43 Clipper = DirectDraw.CreateClipper(0);
44 Clipper.SetHWnd(hWnd);
45 PrimarySurface.SetClipper(Clipper);
46 SET_TO_NOTHING(&Clipper, sizeof(Clipper));