Direct Draw...

Started by
2 comments, last by Laroche 22 years, 5 months ago
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?
Check out my music at: http://zed.cbc.ca/go.ZeD?user_id=41947&user=Laroche&page=content
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 errorsHRESULT hr;hr=InitDirectDraw(hWndMain);//do some tests with the returned value  
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?
Check out my music at: http://zed.cbc.ca/go.ZeD?user_id=41947&user=Laroche&page=content
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 somewhereHRESULT InitDirectDraw(HWND);//then in the source fileHRESULT InitDirectDraw(HWND hWndMain){   HRESULT hr = S_OK;   //do directdraw stuff here..   return( hr );}  


hth
Learn about game programming!Games Programming in C++: Start to Finish

This topic is closed to new replies.

Advertisement