Jump to content
  • Advertisement

Archived

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

VGASteve

DirectDraw trouble

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

I can''t believe it! I have Microsoft Visual C++ 6.0 and DirectX 7.0. I put all the DirectX paths at the top of the path lists, and everything works fine with an AppWizard generated Windows app (Not MFC, mind you...). Now, I''m trying to write a wrapper library (NOT AppWizard generated -- a standard .cpp file), and the compiler claims that SetCooperativeLevel() is not a member of lpDD. (lpDD being type LPDIRECTDRAW)... I''ve #included ddraw.h, BTW... Am I missing something obvious?

Share this post


Link to post
Share on other sites
Advertisement
Have you entered ddraw.lib in the project settings? Are you using lpDD->SetCooperativeLevel? Did you forget to DirectDrawCreate()?

Share this post


Link to post
Share on other sites
Yeh, I did all that... Actually, I just want the thing to MAKE, not LINK, so the ddraw.lib shouldn''t really matter in this case...

Share this post


Link to post
Share on other sites
sorry...
here''s the code:
===================

#include
#include

LPDIRECTDRAW sx_dd;

int sx_SetMode( HWND hwnd, int xRes, int yRes, int
colorDepth );


int sx_SetMode( HWND hwnd, int xRes, int yRes, int
colorDepth ) {
if( DirectDrawCreate( NULL, &sx_dd, NULL ) != DD_OK )
return 0;
if( sx_dd->SetCooperativeLevel(hwnd, DDSCL_EXCLUSIVE /
DDSCL_FULLSCREEN ) != DD_OK )
return 0;
if( sx_dd->SetDisplayMode( xRes, yRes, colorDepth ) !=
DD_OK) return 0;
return 1;
}

===================
By the way, the C++ IDE plays right along with me, dropping down it''s little menu of methods, with SetCooperativeLevel and SetDisplayMode among them.

Share this post


Link to post
Share on other sites
if( sx_dd->SetCooperativeLevel(hwnd, DDSCL_EXCLUSIVE /
DDSCL_FULLSCREEN ) != DD_OK )

Was that right? I mean, you should have OR operator between DDSCL_EXCLUSIVE and DDSCL_FULLSCREEN, not forward slash.
And I think you should create directdraw object 7 too.. Like:

LPDIRECTDRAW7 sx_dd;

I don''t know if it matters though..

Share this post


Link to post
Share on other sites
Can you post the actual error message being given to you by the compiler?

Using the LPDIRECTDRAW type is the correct way for you to do this. The call to DirectDrawCreate() is expecting a pointer to an LPDIRECTDRAW object and you will get another error if you use an LPDIRECTDRAW7, since LPDIRECTDRAW7 does not exist. I think they mean LPDIRECTDRAW4 which is a new interface in DirectX 7. You can get an LPDIRECTDRAW4 by calling the method QueryInterface() on the LPDIRECTDRAW you got from DirectDrawCreate() and passing in IID_IDirectDraw4.

Are you including ddraw.h by using include<ddraw.h> or by using include "ddraw.h"

Edited by - bstach on 4/10/00 3:47:44 PM

GRRR stupid forum software is eating my post!


Edited by - bstach on 4/10/00 3:57:23 PM

Edited by - bstach on 4/10/00 3:59:57 PM

Share this post


Link to post
Share on other sites
Sorry... don''t have it at this location...

But it distinctly says that SetCooperativeLevel is not a member of sx_dd, and when I click on the error message, it shows me the header file, and, lo and behold, SetCooperativeLevel is there...

I''ve tried variations such as:

IDirectDraw7 *sx_dd;

... but to no avail ...

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!