Hmmm error I cant solve, anyone?

Started by
2 comments, last by ACAC 22 years, 3 months ago
c:\windows\desktop\direct x\frodo\functions.cpp(256) : error C2664: 'CreateSurface' : cannot convert parameter 1 from 'struct _DDSURFACEDESC2 *' to 'struct _DDSURFACEDESC *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Ive tried all sorts of things, anyways heres the function
    
																			     

LPDIRECTDRAWSURFACE4 DDraw_Create_Surface(int width, int height, int mem_flags, int color_key = 0)
{
// this function creates an offscreen plain surface


DDSURFACEDESC2 ddsd;         // working description

LPDIRECTDRAWSURFACE4 lpdds;  // temporary surface

    
// set to access caps, width, and height

memset(&ddsd,0,sizeof(ddsd));
ddsd.dwSize  = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;

// set dimensions of the new bitmap surface

ddsd.dwWidth  =  width;
ddsd.dwHeight =  height;

// set surface to offscreen plain

ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | mem_flags;

//************************************************************/
//******************!!!!!error line*!!!!!*********************/
//************************************************************/

if (FAILED(lpdd->CreateSurface(&ddsd,&lpdds,NULL)))  
   return(NULL);

// test if user wants a color key

if (color_key >= 0)
   {
   // set color key to color 0

   DDCOLORKEY color_key; // used to set color key

   color_key.dwColorSpaceLowValue  = 0;
   color_key.dwColorSpaceHighValue = 0;

   // now set the color key for source blitting

   lpdds->SetColorKey(DDCKEY_SRCBLT, &color_key);
   } // end if


// return surface

return(lpdds);
} // end DDraw_Create_Surface

    
DDSURFACEDESC2 ddsd; Ive tried changeing this, LPDIRECTDRAWSURFACE4 lpdds; and this Ive tried casting, but nope...... Anyone? Edited by - ACAC on January 8, 2002 4:28:21 PM
Advertisement
I''m not quite sure what verision of directx your using, but you obviously can''t use DDSURFACEDESC2 you need to use DDSURFACEDESC....Is there a reason your doing this?
-Pac "The thing I like about friends in my classes is that they can't access my private members directly." "When listening to some one tell about their problem (whether it's code or not), don't listen to what went right or wrong, but what they assumed....."
Ehhhh????
Ive tried that it flags another error.

C:\Windows\Desktop\Direct X\frodo\Functions.cpp(256) : error C2664: ''CreateSurface'' : cannot convert parameter 2 from ''struct IDirectDrawSurface4 ** '' to ''struct IDirectDrawSurface ** ''

Which I can solve but it messes up everything, can someone please help there has to be a way!! Thanks all.......
You are not using the right version of the lpdd variable.

When initializing it, its probably using DX5 or 3 or 2 or 1, when the other functions require it to be 6 7 8... (Depending on what you are coding for)

This topic is closed to new replies.

Advertisement