Archived

This topic is now archived and is closed to further replies.

text out

This topic is 5971 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

hi.... when i print text i am using GetDC but somebody said it is slow. i heard some other way to display faster. tell me how.. waiting for answering. my code is : HDC hdc; backbuffer->GetDC(&hdc); sprintf(imsi, "x:%d, y:%d", x, y ); TextOut(hdc, 100, 100, temp, strlen(temp)); backbuffer->ReleaseDC(hdc);

Share this post


Link to post
Share on other sites
Another way to do it is store an array of surfaces with the letters, numbers, and characters that you want in the order that they occur in the ASCII table. Then, what you can do is iterate through the string that you want to print, getting each character's ASCII value and being sure to subtract it by whatever amount your lowest characters value is if the surface array is 0 based. As you do that, you can BltFast (or Blt if it's your poison) each character, and keep adding to an X value (if you are doing your text horizontally) that is used the BltFast. That is how I do it (this is for left justified text, for right I just decrement the XPos instead and start at the top of string to be printed and iterate through it down). Hope this helps!

Edited by - HardMario on August 8, 2001 8:50:31 PM

Share this post


Link to post
Share on other sites