Jump to content
  • Advertisement
Sign in to follow this  
MadHaTr

Directx and Dev-C++

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

Okay this has probably been covered and I have been all over the net and seen it covered, but I just can't seem to get it to work. I think I picked a bad time to learn DirectX INFO Newest Dev-C++ Directx 10 SDK (may be the problem) Windows Vista Ultimate x64 (may also be the problem) Okay so I am going through one of the directx tutorials on the site(http://www.gamedev.net/reference/articles/article608.asp). I grabbed some code put it in a win32 project and tried to compile. Didn't work, so I turned all the lib files into .a files with the reimp tool. I moved them all into the Dev-C++ lib folder. I made sure my directory had no spaces C:\Dev-Cpp . I added some *.a directx files to the project. I must still be doing something wrong. Here is the code. Its the first bit of code in the tutorial. I get these errors. Thanks for any help. This is really bumming me out I just wanted to be able to compile something in directx. EDIT: While i did add only a few lib files to the project, now i've added them all. :( could someone tell me which ones i would need to add. `LPDIRECTDRAW' does not name a type `HWND' was not declared in this scope expected `,' or `;' before '{' token [main.o] Error 1 /////////// // globals (ugh) LPDIRECTDRAW lpDD; // DirectDraw object defined in DDRAW.H << Error ? /* * Function to initialize DirectDraw * Demonstrates: * 1) Creating the Direct Draw Object * 2) Setting the Cooperative level * 3) Setting the Display mode * */ bool DirectDrawInit(HWND hwnd) { HRESULT ddrval; /* * Create the main DirectDraw object. * * This function takes care of initializing COM and Constructing * the DirectDraw object. */ ddrval = DirectDrawCreate( NULL, &lpDD, NULL ); if( ddrval != DD_OK ) { return(false); } /* * The cooperative level determines how much control we have over the * screen. This must at least be either DDSCL_EXCLUSIVE or DDSCL_NORMAL * * DDSCL_EXCLUSIVE allows us to change video modes, and requires * the DDSCL_FULLSCREEN flag, which will cause the window to take over * the fullscreen. This is the preferred DirectDraw mode because it allows * us to have control of the whole screen without regard for GDI. * * DDSCL_NORMAL is used to allow the DirectDraw app to run windowed. */ ddrval = lpDD->SetCooperativeLevel( hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ); if( ddrval != DD_OK ) { lpDD->Release(); return(false); } /* * Set the video mode to 640x480x8 * This is allowed because we have set exclusive mode above */ ddrval = lpDD->SetDisplayMode( 640, 480, 8); if( ddrval != DD_OK ) { lpDD->Release(); return(false); } return(true); }

Share this post


Link to post
Share on other sites
Advertisement
You don't seem to include any headers at all. I don't know what the deal is with Dev-C++, but last time I used Direct3D, the first thing I did was including the respective DirectX header (d3d9.h). At the very least, if you're using Win32 types such as HWND, you should include <windows.h>.

If you _did_ do this, and left it out of the snippet, my bad :-).

Share this post


Link to post
Share on other sites
I can't see any #includes, and the error you're getting (XXX does not name a type) indicates that you haven't included the correct files. I can't say what these files are as I'm not a direct X programmer.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!