text out

Started by
0 comments, last by duckykim 22 years, 8 months ago
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);
Advertisement
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

This topic is closed to new replies.

Advertisement