Jump to content
  • Advertisement
Sign in to follow this  
cornflake

getdc() GDI query PART 2

This topic is 4979 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'm trying to draw a rectangle in my game_main function, but I get the following error - error C2065: 'Getdc' : undeclared identifier It works in the pre-written examples I have, but in these it isn't used in a function so presumably I have to do something to have it recognised inside the game_main??? This is the game_main -
int Game_Main(void *parms = NULL, int num_parms = 0)
{

// Test if user is hitting ESC and send WM_CLOSE
if (KEYDOWN(VK_ESCAPE))
   SendMessage(main_window_handle,WM_CLOSE,0,0);

// Draw rectangle
HWND hwnd;
//get DC
HDC hdc = Getdc(hwnd);
// create pen and brush
HPEN blue_pen = createpen(PS_SOLID, 1, RGB(0,0,255));
HBRUSH red_brush = createsolidbrush(RGB(255,0,0));
// select pen and brush into context
selectobject(blue_pen);
selectobject(red_brush);
// draw rectangle
rectangle(hdc, 10,10, 20,20);

// return code
return(1);

} // end Game_Main

Share this post


Link to post
Share on other sites
Advertisement
Thanks. I'm so used to VB.NET I forgot about case-sensitive C++!!!

It compiles and runs now, but no rectangle appearing???

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!