Advertisement

How do I blit text helluva fast?

Started by January 24, 2000 10:34 PM
8 comments, last by Bigshot 25 years, 1 month ago
I just converted the code in my game to use BltFast instead of Blt and I implemented some software clipping. Now I''m proceeding to the next bottleneck: text. Right now I''m blitting text with GDI which is slow as a mofo so I need to write a fast text blitting function. Can someone tell me how to do this? I know I''ll probably have to use my own font set, and I could probably figure it out if I think about it for a while, but I''d really just like some source code or an example. I need fast text blitting! I''d appreciate any help. Thanks, Al
Alexbigshot@austin.rr.comFoolish man give wife grand piano. Wise man give wife upright organ.
*Bump*
Sorry... hopefully I''ll get a response this time. Text blitting is an important topic and I can''t seem to find much information on it... at least not on this forum. I''m going to start looking into it on my own.

Al
Alexbigshot@austin.rr.comFoolish man give wife grand piano. Wise man give wife upright organ.
Advertisement
I would say just make little bitmaps for all the letters and numbers and symbols, and blit them just like normal. hope it helps


_________________Gecko___

_________________Gecko___Gecko Design
If you look on this forum this subject has come up a couple times lately.
Anyways the general consensus seems to be the fastest type of text is using a tileset of all the ascii characters and simply blting them like you do any other sprites.
Just because the church was wrong doesn't mean Galileo wasn't a heretic.It just means he was a heretic who was right.
Thanks. That''s what I was thinking, but I''m a lazy man when it comes to graphics... I''m going to hunt for some pre-made character sets.

Al
Alexbigshot@austin.rr.comFoolish man give wife grand piano. Wise man give wife upright organ.
Ill offer you what I used to test my engine:

http://www.cadvision.com/mjking/systembw2.bmp

its a simple ascii set (32-127) each character is 8x15 on two lines to avoid a wider than screen surface, its pretty easy to make a bit of code to find where any given character is.

Another tip: a great place to find character sets you can use in this way is web page counter fonts
Just because the church was wrong doesn't mean Galileo wasn't a heretic.It just means he was a heretic who was right.
Advertisement
I remember a program from my dos and allegro days that mught help you. Find the allegro web page(shouldn''t be hard),and look for a program called well i cant remember the exact name,but im usre it will be there. It allows you to convert any true type fonts(The ones that come with windows ,ect) to a pcx file. Then you can convert it to any file format you want and not worry about drawing your own fonts.
Another thing you could do is generate the text at run time, when you load all your DirectX stuff. Just use GDI calls to render the text to a DirectSraw surface and Blt from that surface whenever you want to draw text.
My Geekcode: "GCS d s: a14 C++$ P+(++) L+ E-- W+++$ K- w++(+++) O---- M-- Y-- PGP- t XR- tv+ b++ DI+(+++) D- G e* h!"Decode my geekcode!Geekcode.com
Visit our web site:Asylum Entertainment
I posted a reply but I guess it got sent as a new post.
Here is what it said:

I did some checking on the program Zenroth spoke of (I need it also). It can be found at:

http://www.talula.demon.co.uk/ttf2pcx/index.html


L8tr, Kinfira
Regards, KinfiraLead ProgrammerKinfiraSoftMakers of Swordplay, a 3D fighting game engine.Check out our home on the web:http://www.kinfirasoft.com
These lookup table methods are really lame. I''m submitting an article on how to dynamically use True Type fonts w\o going through GDI. Also, since alpha blend values are coded into TTF, my algorithm has a nice transparency option. Stay tuned. If you are really anxious, download the Nuke directx wrapper and fiddle with the code for a while.

This topic is closed to new replies.

Advertisement