Skip to main content
gamedev.net
🔒 Locked

Wierd DirectDraw problem

Started by crazy-vasey Oct 11, 2000 at 3:00 PM 5 replies 350+ views
Original Post
crazy-vasey
crazy-vasey
        

void Setup()

	{
		
		DDSURFACEDESC2 Stuff;
		ZeroMemory(&Stuff, sizeof(Stuff));
		Stuff.dwSize = sizeof(Stuff);
		Stuff.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
		Stuff.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
		Stuff.dwBackBufferCount =1;
		DirectDrawCreateEx(NULL, (void **)&lpDD, IID_IDirectDraw7, NULL);
		lpDD->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
		lpDD->SetDisplayMode(800,600,16,0,0);
		lpDD->CreateSurface(&Stuff, &Surface, NULL);
		ZeroMemory(&X, sizeof(X));
		X.dwCaps= DDSCAPS_BACKBUFFER;
		check=Surface->GetAttachedSurface(&X,&Buffer); //Problem

		
		
	}

        
When it gets to the last line the program terminates if I comment the line out it doesn't. Coould somebody please explain this to me? My Homepage Edited by - crazy-vasey on 10/11/00 3:03:06 PM
djsteffey
djsteffey
1) what is buffer ?
2) set the size of X
    
X.dwSize = sizeof(X);



"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
themGames Productions

EnochDagor
EnochDagor
I didn''t use the ZeroMemory on X... but set the dwSize property would help.
Enoch DagorLead DeveloperDark Sky EntertainmentBeyond Protocol
EnochDagor
EnochDagor
Hehe, what he said.

Basically, I think I used the same DDSD for setting up my surfaces...

Once the primary was made, I simply just set my dwCaps to DDSCAPS_BACKBUFFER. I don''t recall doing too much more than that.
Enoch DagorLead DeveloperDark Sky EntertainmentBeyond Protocol
crazy-vasey
crazy-vasey
Thanks for the quick responses. Buffer is the back buffer I''m too lazy to write all that hungararian notation crap. Sizeof isn''t a member of DDSCAPS2 and it won''t take the DDSURFACEDESC struct I used originally.

My Homepage
Trancelucid
Trancelucid

You shouldn''t need X at all.. Here''s what you should do (which I learned from the SDK samples):

    
lpDD->CreateSurface(&Stuff, &Surface, NULL);
Stuff.ddsCaps.dwCaps= DDSCAPS_BACKBUFFER;
check=Surface->GetAttachedSurface(&Stuff.ddsCaps,&Buffer);


I also noticed you posted another message asking how we learned DirectDraw. I suggest you read and re-read the SDK . Check out the tutorials, and tinker with the samples that come with it until you feel comfortable enough to make your game.

HTH,
.(Trancelucid).
crazy-vasey
crazy-vasey
All I''m trying to do now is to get comfortable with the commands. I was using the same method that the first sdk example used. I get it now. Thanks for the help.

My Homepage

Topic Locked

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

Sign in to reply to this topic.