Sign in to follow this  
MadHaTr

Directx and Dev-C++

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this