Jump to content
  • Advertisement

Archived

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

Darc

DirectDraw 7 initialization isn't working...

This topic is 5231 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

hey, I took this code straight from GameDev.net and it''s giving me a compiler error: if (FAILED(ddDevice->CreateSurface(&ddsd, &ddPrimary, NULL))) //Get Primary Surface from Device Free(); if (FAILED(ddPrimary->GetAttachedSurface(&ddscaps, &ddBack))) //Get Back Buffer from Primary Surface Free(); the compiler is saying this: cGraphics.cpp(26) : error C2664: ''IDirectDraw::CreateSurface'' : cannot convert parameter 1 from ''DDSURFACEDESC2 *'' to ''LPDDSURFACEDESC'' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast cGraphics.cpp(32) : error C2664: ''IDirectDrawSurface::GetAttachedSurface'' : cannot convert parameter 1 from ''DDSCAPS2 *'' to ''LPDDSCAPS'' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast I''ve tried type casting or changing the Surface Desc or Caps to the above named objects but it just gives me a run-time error. Any help?

Share this post


Link to post
Share on other sites
Advertisement
1. : you ddDevice must be a IDirectDraw7 interface not a 3D Device.

2. ddsd = type DDSurfaceDesc2
- ddPrimary = type IDirectDrawSurface7

3. ddscaps = type DDScaps2
- ddscaps.dwCaps := DDSCAPS_BACKBUFFER;
- ddBack = type IDirectDrawSurface7

4. if (FAILED(ddDevice->CreateSurface(ddsd, ddPrimary, NULL))) //Get Primary Surface from Device
Free();
- its not a pointer call, so dont use "&" (at least its not a pointer call in pascal, not sure of c++)

5. if (FAILED(ddPrimary->GetAttachedSurface(ddscaps, ddBack))) //Get Back Buffer from Primary Surface
Free();
- same thing no "&"

Hope this helps

Share this post


Link to post
Share on other sites
yeah I know it isn''t a device, just force of habit after learning DirectX 9.0 (just too slow for me, and no DDraw alpha blending )

I still can''t get it to work... I used this article to make this code: http://www.gamedev.net/reference/articles/article1077.asp

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!