Sign in to follow this  
jagguy

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 this post


Link to post
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 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this