Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Hmmm error I cant solve, anyone?

This topic is 6130 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

ddsd.dwSize  = sizeof(ddsd);

// 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)))  

// 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

} // 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

Share this post

Link to post
Share on other sites
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?

Share this post

Link to post
Share on other sites
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.......

Share this post

Link to post
Share on other sites
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)

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!