Advertisement

DirectDraw and Borland C++

Started by April 22, 2002 06:17 PM
0 comments, last by rixxx 22 years, 4 months ago
Hi. I''m using Borland''s free command line compiler and I''m killing myself with that and directdraw. This is my first DirectDraw program and my first Windows program and even my first C++ program. (But I''ve coded years with different Basics, Assembler (Z80, x86), Java, C, Pascal and a few other). The problem is that I can''t get DirectDraw initialized. Everything goes out just fine until I try to create the primary surface. I''ve carefully read through many different DirectDraw tutorials, and still can''t figure out what''s wrong. I''m using DirectX 8.0 Here''s my code:

    DDSURFACEDESC2 ddsd;
    ZeroMemory(&ddsd, sizeof(ddsd));
    ddsd.dwSize = sizeof(ddsd);
    ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; 
    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; 
    ddsd.dwBackBufferCount = 1;
    r = dd->CreateSurface(&ddsd, &primary, 0);

    if(FAILED(r))
    {
        dd->Release();
        return false;
    }
dd is my directdraw object (global) and primary is my primary surface object (global, too). I get a DDERR_INVALIDPARAMS error when I try to execute this. I was wondering if this has any effect. I had some problems with getting the directdraw object initialized, because while linking I had an error message that DirectDrawCreateEx was an undefined symbol. So instead of: DirectDrawCreateEx(0, (void**)ⅆ, IID_IDirectDraw7, 0); I did: DirectDrawCreate(0, (IDirectDraw**)ⅆ, 0); This seems to work out fine, I can set the co-op level and display mode (640*480*8bpp) just fine. Is this Borland C++ related problem or something with the code or my version of DirectX? Is there something I should have done or defined before. NO, AND I''M NOT BUYING MICROSOFT VISUAL C++, IF THAT''S WHAT YOU''RE THINKING! =) Thanks in advance, guys. -Richardo
---------------------------for(goodness_sake()){  do  {    something();  } while(you_can());}
In case you didn''t already know, those of us who handicap ourselves with Borland products have to download a special version of the DX Libs. If you already have these, and you are positive that you are linking to them, and not the default DX Libs.... post your full code and I''ll take a close look at it..



This topic is closed to new replies.

Advertisement