Skip to main content
gamedev.net
🔒 Locked

DDraw setup

Started by nagromo Apr 18, 2003 at 1:57 PM 0 replies 250+ views
Original Post
nagromo
nagromo
I am using Dev-Cpp and ddraw 7, and I finally got it to compile, but it gives me an error when I try to create a surface. I got Dev-Cpp's modified headers, etc. Here is the source: Near the top:
      
LPDIRECTDRAW7 lpdd = NULL;
DDSURFACEDESC2 ddsd;
LPDIRECTDRAWSURFACE7 lpddsPrimary;  
  
And in function Init:
  
    if(FAILED(DirectDrawCreateEx(NULL,(void**&lpdd,IID_IDirectDraw7,NULL))) {
        MSGBOX("Init error.");
        KillWindow();
        return false;
    }
    
    INIT_DXSTRUCT(ddsd);
    ddsd.dwFlags = DDSD_CAPS;
    ddsd.ddsCaps.dwCaps=DDSCAPS_PRIMARYSURFACE|DDSCAPS_VIDEOMEMORY;
    
    if (FAILED(lpdd->CreateSurface(&ddsd,&lpddsPrimary,NULL))) {
        MSGBOX("lpdd Init error.");
        KillWindow();
        return false;
    }
    
It always makes a message box saying, "lpdd Init error." I've tried messing around with it but it won't work. [edited by - nagromo on April 18, 2003 2:59:02 PM] [edited by - nagromo on April 18, 2003 2:59:54 PM]
Maker
Maker
Try to do not force the DDSCAPS_VIDEOMEMORY flag and another thing
and another thing:
dont use a Directly chech if you creating a surface I have the same problem as you and I solved it by doing a check after the CreateSurface function finished executing:

  
HRESULT hr;
lpdd->CreateSurface(&ddsd,&lpddsPrimary,NULL);
if (FAILED(hr))
{
MSGBOX("lpdd Init error.");
KillWindow();
return false;
}

I dont use this function INIT_DXSTRUCT I prefer this method:

  
ddsd.dwSize = sizeof(ddsd);

You must give the size of your ddsd structure




Can u run faster than AMD Athlon processor ??:>

[edited by - Maker on April 18, 2003 7:02:34 PM]

[edited by - Maker on April 18, 2003 7:05:16 PM]

[edited by - Maker on April 18, 2003 7:12:37 PM]

[edited by - Maker on April 18, 2003 7:17:45 PM]
Can u run faster than AMD Athlon processor ??:>

Topic Locked

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

Sign in to reply to this topic.