-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|705|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Snippet Home -> Text and GUI's


 
Jayenkai
Created : 05 February 2008
Edited : 06 February 2008
System : Windows
Language : Blitz

ImageFont Creation and Usage



A "mostly" working ImageFont system.

First up, this is the "Makey bob"
Save it somewhere, (FontMakey_PeepsHappy.bb seems a nice enough name!) then run it.
It'll generate 3 font files, Arial_8.fnt, Arial_16.fnt and Arial_32.fnt



Once that's done, save this to the same directory. (FontShowy_PeopleKnowy.bb seems ok to me.)

It'll load all three of the fonts, and do a nice display for you. There's lots being flung onscreen, though, so you might have to switch to Non-Debug to get a decent fps. Sorry! I tried to keep the drawing routine down as much as I could... But... Well, them's the breaks!


 

Comments


Wednesday, 06 February 2008, 03:29
Jayenkai
Updated to v0.2

The font is now saved, as raw data.. I might add some kind of compression to that at a later time.

Also, given extra time, I might add scrolling, and centering and all that kinda stuff.
For now, though, it'll do as it is. Feel free to add your own stuff to it. Neat character drawing styles, or some justification stuff. Whatever! Post as you do..

Meanwhile I'm going to work on adding this into SoC, so I can actually display text somewhere! At the minute there's no Debug info whatsoever! Kinda needs that, methinks!
Thursday, 23 June 2011, 04:42
waroffice
Just having a look at the code to transfer this to Cobra, looks easy enough.

Thanks
Tuesday, 28 June 2011, 05:25
waroffice
Ey up,

Any chance of a breakdown of how this is made, so I can compare with the one i made.

I coded it the way I could think of, based on this but I premade the bitmap rather than rendering one in game.

A sort of article/tutorial rather than a list of code would be ace
Tuesday, 28 June 2011, 10:15
Jayenkai
*shrugs*
Nothing magical, really. Draws letters on screen, cuts out as images, slaps back down.
The conversion to data's not even compressed.
Geeze, this is lazy coding!!