Jump to content
  • Advertisement

Archived

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

Laroche

Direct Draw...

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

Ive made a function called: HRESULT InitDirectDraw(HWND hWnd); and its just a standard direct draw initialization function, but im having difficulty declaring it. The function itself is in DirectX.cpp, while the prototype declaration is in Windows.cpp. The problem is that it does not seem to recognize the function when i call it in Windows.cpp, just before the message loop. The line of code is simply: HRESULT InitDirectDraw(HWND hWnd); I get 3 error messages because of this. they are: syntax error : missing '';'' before identifier ''InitDirectDraw'' ''HRESULT'' : missing storage-class or type specifiers unexpected end of file found can anyone help me figure out what is wrong? am i declaring it wrong?

Share this post


Link to post
Share on other sites
Advertisement
it looks like ur calling it wrong. Is that 2nd line your call?
this is what it should be:
  
/* this should bet a global and it should contain the HWND returned when you created the window */
HWND hWndMain;

//create a hresult to test for errors

HRESULT hr;


hr=InitDirectDraw(hWndMain);
//do some tests with the returned value

Share this post


Link to post
Share on other sites
Yes the second line is my call, forgot to mention that. I did your suggestion, but pardon me for being a newbie, but should i change the prototype as well? and what about the actual function itself? In the function i need the handle to the window to set the coopertive level. do i set this as hWndMain?

Share this post


Link to post
Share on other sites
No leave the prototype as is..it''s working fine.

To your second question, yes use the hwndMain window handle passed into your function as the window handle to use for your directdraw calls..

The actual function itself you''ve already written right??

  
//declared in a header file somewhere

HRESULT InitDirectDraw(HWND);

//then in the source file

HRESULT InitDirectDraw(HWND hWndMain){

HRESULT hr = S_OK;

//do directdraw stuff here..


return( hr );
}



hth

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!