Skip to main content
GameDev.net gamedev.net
🔒 Locked

Stupid Rectangle Error--need help!

Started by DrMol Sep 30, 2002 at 1:33 AM 0 replies 500+ views
Original Post
DrMol
DrMol
Alright, I have a pounding headache and need some serious help: I have made a DX wrapper. In it is a function for blitting to the Primary surface- baasically this without the error checking: CGraphics::XBlitToSurface( LPDIRECTDRAWSURFACE7 lpDDS, LPRECT rectSource, LPRECT rectDest ) { hr = lpddsPrimary->Blt( rectDest, lpDDS, rectSource, DDBLT_WAIT, NULL ); } Everytime I run through, hr is INVAIDRECT. When I run it with rectSource as NULL, the program runs through. I call XBlitToSurface with my windows drawing routine. Here are the pertinant parts: RECT destRect, srcRect; LPDIRECTDRAWSURFACE7 LV, RV, TH, BH; //This sets up all the surfaces cGraphics.CreateOSSurface( sBorders.VWidth , sBorders.VLegnth, &LV ); //Assign destRect values.... srcRect.top = 0; srcRect.left = 0; srcRect.bottom = 100; //sBorders.VLegnth; srcRect.right = 5; //sBorders.VWidth; cGraphics.XBlitToSurface( LV, &srcRect, &destRect ); I have tried everything, making srcRect an LPRECT directly, createing a placebo RECT in the XBlit function, making sure the values were long, made sure nothing in the rect (including the address) change during execution. Am I missing something? I alos made sure LV-the offscreen surface is valid. I dont lock the surface. Should I be doing that? I didn''t think you needed to to blit something. Anyways, I am out of ideas. Please help!!
DrMol
DrMol
Ok, on a hunch I went back over my offscreen creation code:
Can you spot the error?

bool CGraphics::CreateOSSurface( int xSize, int ySize, LPDIRECTDRAWSURFACE7 *lpDDS)
{
//SETUP the structure
INIT_DXSTRUCT( ddsd );
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN| DDSCAPS_VIDEOMEMORY;
ddsd.dwHeight = xSize;
ddsd.dwWidth = ySize;

if ( FAILED (
lpDD->CreateSurface( &ddsd, lpDDS , NULL ) ) )
return false; //Error check

return true;
}

.
.
.
.
.
.
.
.
.
.
.
Give up? Look at xSize and ySize in ddsd

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.