Author: mbosma Date: Tue Dec 12 20:51:50 2006 New Revision: 25130
URL: http://svn.reactos.org/svn/reactos?rev=25130&view=rev Log: Make it a compile time choice, whether you want to use a clipper or not, because our ddraw does not support it yet.
Modified: trunk/rosapps/demos/ddraw/main.cpp
Modified: trunk/rosapps/demos/ddraw/main.cpp URL: http://svn.reactos.org/svn/reactos/trunk/rosapps/demos/ddraw/main.cpp?rev=25... ============================================================================== --- trunk/rosapps/demos/ddraw/main.cpp (original) +++ trunk/rosapps/demos/ddraw/main.cpp Tue Dec 12 20:51:50 2006 @@ -1,15 +1,15 @@ #include <windows.h> #include <ddraw.h>
-LPDIRECTDRAW7 DirectDraw; -LPDIRECTDRAWSURFACE7 FrontBuffer; -LPDIRECTDRAWCLIPPER Clipper; +LPDIRECTDRAW7 DirectDraw = NULL; +LPDIRECTDRAWSURFACE7 FrontBuffer = NULL; +LPDIRECTDRAWCLIPPER Clipper = NULL;
PCHAR DDErrorString (HRESULT hResult); LONG WINAPI WndProc (HWND hwnd, UINT message, UINT wParam, LONG lParam);
bool Fullscreen, Running; - +//#define USE_CLIPPER
bool Init (HWND hwnd) { @@ -69,6 +69,7 @@ return 0; }
+#ifdef USE_CLIPPER // Set up the clipper OutputDebugString("=> DDraw->CreateClipper\n");
@@ -94,13 +95,16 @@ MessageBox(0,DDErrorString(hResult), "FrontBuffer->SetClipper", 0); return 0; } +#endif
return true; }
-void Draw (void) -{ - // Make the fronbuffer pink +void Draw (HWND hwnd) +{ + // Make the frontbuffer pink + RECT rect; + GetWindowRect(hwnd, &rect); // this is not necessary when clippper is used
DDBLTFX ddbltfx; ddbltfx.dwSize = sizeof(DDBLTFX); @@ -108,8 +112,8 @@
OutputDebugString("=> Surface->Blt (DDBLT_COLORFILL)\n"); - FrontBuffer->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); -} + FrontBuffer->Blt(&rect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); +}
void CleanUp (void) { @@ -158,7 +162,11 @@
HWND hwnd = CreateWindow("DDrawDemo", "ReactOS DirectDraw Demo", - Fullscreen ? WS_POPUP :WS_OVERLAPPEDWINDOW, +#ifdef USE_CLIPPER + Fullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW, +#else + WS_POPUP, +#endif CW_USEDEFAULT, CW_USEDEFAULT, 800, @@ -179,7 +187,7 @@ while (Running) { if(Fullscreen) - Draw(); + Draw(hwnd);
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { @@ -203,7 +211,7 @@ case WM_PAINT: { if(!Fullscreen) - Draw(); + Draw(hwnd); } break;
case WM_KEYDOWN: