DD initialization problem
Hi,
I have a little problem. I init DD using the following code:
ddrval = DirectDrawCreate(NULL, &lpDD, NULL);
if(ddrval!=DD_OK) goto error;
ddrval = lpDD->SetCooperativeLevel (Handle,DDSCL_EXCLUSIVE I DDSCL_FULLSCREEN);
if(ddrval!=DD_OK) goto error;
ddrval = lpDD->SetDisplayMode(800,600,16);
if(ddrval!=DD_OK) goto error;
ZeroMemory(&ddsd,sizeof(ddsd));
ddsd.dwSize=sizeof(ddsd);
ddsd.dwFlags=DDSD_CAPS I DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps=DDSCAPS_PRIMARYSURFACE I DDSCAPS_FLIP I DDSCAPS_COMPLEX;
ddsd.dwBackBufferCount=1;
ddrval=lpDD->CreateSurface(&ddsd, &lpDDSPrimary, NULL);
if(ddrval!=DD_OK) goto error;
ddscaps.dwCaps=DDSCAPS_BACKBUFFER;
ddrval=lpDDSPrimary->GetAttachedSurface(&ddscaps,&lpDDSBack);
if(ddrval!=DD_OK) goto error;
OK, it works. I'd like to blt the same picture to the backbuffer and to the primary surface (so the user cannot
notice the flip.)
ddrval=FDDBlt(lpDDSBack,0,0,lpDDSBG,0,0,800,600,DDBLTFAST_NOCOLORKEY);//my blt, destination, source,options
if(ddrval!=DD_OK) goto error;
ddrval=FDDFlip(); //it's my own flip, handling lost surfaces, etc.
if(ddrval!=DD_OK) goto error;
ddrval=FDDBlt(lpDDSBack,0,0,lpDDSBG,0,0,800,600,DDBLTFAST_NOCOLORKEY);
if(ddrval!=DD_OK) goto error;
Then I use a timer (in BCB 3) to switch between the surfaces, but the screen flickers ! (One of the surfaces is empty.)
Then I tried to wait for a second after the DD init. And the flickering disappeared !
Why ????????????????????
Do I have to wait between the initialization and the first blt ????
thx,
ferceg
Edited by - ferceg on 1/30/00 3:25:51 PM
Well the first thing I noticed that you are using slashes (/) instead of pipes (/) to OR flags together.
Scratch that... seems the board can''t handle pipe characters
///////////////////////////// yup.... sorry...
///////////////////////////// yup.... sorry...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement