Home » Community » Forums » Article Feedback » Game Programming Genesis Part III : Tracking Your Window and Using GDI
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 Game Programming Genesis Part III : Tracking Your Window and Using GDI
Post New Topic  Post Reply 
Comments for the article Game Programming Genesis Part III : Tracking Your Window and Using GDI

 User Rating: 2088   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

How does it work?
ive blitted everything, it compiles, but i get a white screen!
plz send answer to my mail!

_________________________________________________________________________
Can someone be nice and help me on my way to be the next Hideo Kojima?
Thought So...


 User Rating: 1469   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

I've been using TextOut() in my tetris clone, and I need to display the player's score (an integer). Now, TextOut() needs a pointer to a string; is there another GDI function that will display an integer?

I've got a (convoluted) function that will make a string out of an integer, so I can use TextOut(). There's got to be an easier way though

Ideas? Thanks


 User Rating: 1015    Report this Post to a Moderator | Link

Use wsprintf to build the string buffer, then pass it to TextOut.

Example:


TCHAR szBuf [1024] ; // String buffer to store message
LONG nScore ; // Integer to store player's score
HDC hDC ; // Handle to a device context
LONG X, Y ; // Coordinates of output text

// Initialise these variables here
// ...
// ...
// ...

// Build the string like this
wsprintf (szBuf, TEXT ("Your score is : %d", nScore) ;

// Pass it to Text out
TextOut (hDC, X, Y, szBuf, lstrlen (szBuf)) ;


 User Rating: 1015    Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: