Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Work in Progress / Bitmap Font engine!

Author
Message
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 5th Aug 2008 23:18 Edited at: 7th Aug 2008 21:02
I made a native-DBP module that you can use to get bitmap fonts up and running using a few very handy functions.

In the attached demo, I used a font called "Old German" that I found on SimplyTheBest.net/fonts/.


Download the latest demo (07 Aug 2008 12:14:00)

This code will take your bitmap font image (it can be any format) and copy each section to separate images according to the specified rows and columns. It copies each section by memblock, so there's no loss of quality and no opaque background if your font bitmap is transparent.

To use this...
Take a look at whichever bitmap font you intend to use. The bitmap font must be in line with a universal grid! It is also recommended that your lower-case letters are smushed against the left edge of each grid cell.
Create a text file with all the letters and symbols in the same exact order, left-to-right and top-to-bottom, with no spaces (unless there is a "space" character in your bitmap font) and no linebreaks. If there are any unused spaces, type a symbol that you don't think anyone will be typing in your game (like å or я, or a Chinese character).


So, go ahead and use it as you like, just put me in your credits if you decide it's good enough for your release. I also want your opinions on its functionality, and even the code itself, seeing as you have the whole thing.


Remember those old guys? They made epic renders, I think one of them was called DaVinci, and all they used was MS Paint. Sometimes it's just skill....

Attachments

Login to view attachments
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 6th Aug 2008 04:25 Edited at: 6th Aug 2008 04:31
Hmm... well while it works with the font I already had, it is sucking at a fond whose cells are 20x30 instead of 20x20... must fix

Edit: Problem solved, was collecting the third DWORD from the source image's memblock for height instead of the second. Download updated, works like a charm.


Remember those old guys? They made epic renders, I think one of them was called DaVinci, and all they used was MS Paint. Sometimes it's just skill....
tha_rami
18
Years of Service
User Offline
Joined: 25th Mar 2006
Location: Netherlands
Posted: 6th Aug 2008 12:55
Quote: "Create a text file with all the letters and symbols in the same exact order, right-to-left and top-to-bottom, with no spaces (unless there is a "space" character in your bitmap font) and no linebreaks. If there are any unused spaces, type a symbol that you don't think anyone will be typing in your game (like å or я, or a Chinese character)."

I'm quite sure you mean left-to-right. This might be interesting to the TAC entries.


A mod has been erased by your signature because it was larger than 600x120
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 6th Aug 2008 18:33 Edited at: 6th Aug 2008 18:34
osnap, you are right.

Quote: "This might be interesting to the TAC entries."


The TAgoermaglabalala?


Remember those old guys? They made epic renders, I think one of them was called DaVinci, and all they used was MS Paint. Sometimes it's just skill....
Alucard94
17
Years of Service
User Offline
Joined: 9th Jul 2007
Location: Stockholm, Sweden.
Posted: 6th Aug 2008 20:15
Quote: "The TAgoermaglabalala?
"

Yes, yes exactly


Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 7th Aug 2008 03:47
Added the ability to adjust the spacing of the whole charset or individual characters.


Remember those old guys? They made epic renders, I think one of them was called DaVinci, and all they used was MS Paint. Sometimes it's just skill....
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 7th Aug 2008 10:08 Edited at: 7th Aug 2008 10:50
Have you seen the December 2007 newsletter?

It contains a tutorial and code that demonstrates how to use bitmap fonts of any size and each character can have a different width (no point having 'I' the same width as 'W'). There is also no need to 'smush' characters.

Keep going with your own system by all means but take a look at this, it might give inspiration!

You can also download the tutorial and loads of bitmap fonts from my website .



Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 7th Aug 2008 20:13 Edited at: 7th Aug 2008 20:15
Ok, after reading the basic idea of what was in that issue (not having looked at any code), I re-wrote a chunk of my engine to make use of this automatic-width-finding technique. TBH I had considered doing it this way before, but decided it would be too much work (while instead I could be fiddling about trying to adjust the width of individual characters for each font ) I guess seeing someone else having done something makes me want to keep up.

I also adjusted the system a bit so that you can load multiple bitmap fonts.


Remember those old guys? They made epic renders, I think one of them was called DaVinci, and all they used was MS Paint. Sometimes it's just skill....
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 8th Aug 2008 19:52
Currently re-writing this as a plugin... >.>


Remember those old guys? They made epic renders, I think one of them was called DaVinci, and all they used was MS Paint. Sometimes it's just skill....

Login to post a reply

Server time is: 2024-11-24 07:31:58
Your offset time is: 2024-11-24 07:31:58