text to the screen

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 on other sites
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 on other sites
can you give me some idea on how to do this, (i will check the heplp as well)

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 lengthReleaseDC(hwnd, hdc);

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.

Create an account

Register a new account

• Forum Statistics

• Total Topics
628278
• Total Posts
2981789

• 10
• 11
• 17
• 14
• 9