Jump to content
  • Advertisement
Sign in to follow this  
jagguy

text to the screen

This topic is 4847 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 want to print the value of a varibale to the screen using directX7 and vc6++, do I need to create a surface for the text then display , can i convert a number to a string easy enough. the win32 app wont accept strings at all and simply displaying value to the screen seems complicated....any ideas?

Share this post


Link to post
Share on other sites
Advertisement
To convert a number to string "sprintf" or "stringstream" or "itoa"

An easy way to draw text in windows in with "TextOut" I believe. Its not part of DX but rather part of Win32.

Share this post


Link to post
Share on other sites
Something along the lines of



char buffer[32];
int test = 400;
//...

hdc = GetDC(hwnd);

int length = snprintf(buffer, 32, "%d", test);

TextOut(hdc,40,40,buffer, length); // print "400" at coords(40,40) with the given length

ReleaseDC(hwnd, hdc);

Share this post


Link to post
Share on other sites
thanks for the info, i actually just did the code before exactly as you did it.

there must be a c++ soln as this is C.
the problem i have is a flicker and just writing to a backbuffer with CreateTextFromSurface didnt solve the problem.
the sprite doesnt flicker?

I worked out with variables my screen draws to the screen 190 times a sec!
190 frames per second is huge(in VB6 the same program does 6 frames per second)

and text displayed like that is flickering badly but not the 64*64 animated sprite on the same page.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!