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.

DarkBASIC Discussion / Is it possible to use bitmap fonts in DBC?

Author
Message
Yodaman Jer
User Banned
Posted: 19th May 2009 21:20
Well, the thread title is pretty self-explanatory.

I want to use a certain text style in a game I want to make over the course of the summer. I've tried searching the DBC boards and have not found any threads about using a bitmap font.

I'm also not entirely sure of the process, but I can Google how to do that. Any advice is appreciated!

"If you want lots of people to play your game make it simple; lots of people are simple." -Obese87
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 19th May 2009 22:47
prolly dumb question but wat is a bitmap font?

There are only 10 kinds of people in the world, those who understand binary and those who dont
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 20th May 2009 00:48
I think its when you use images as characters so you can have more vibrant text in your games.

It's actually quite simple. You just have to store the character width of every character and keep track of the cursor.

I've just had an interesting idea: could you add the character widths of the characters you input to a string like this "15+16+22+15" and so forth, then to find the cursor position convert it to a value. Would it convert and execute the sum?
The reason I ask instead of just adding to a variable is that this way if you deleted a character you could just remove the last numerical digits and plus sign, and the cursor would be back at the correct position automatically.

There is an eight letter word. You can insert a letter into it or remove a letter from it without changing its meaning. Answer
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 20th May 2009 00:53
Quote: "Would it convert and execute the sum?"

Just tried it, no, it only takes the numeric value of every character until it hits one that isn't a number.

So with your example it would return 15

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th May 2009 01:09
What is prolly?
A bitmap font is basically a font you draw yourself. You use bitmaps or images of the font so it's all one style however you want it.

@Yodaman Jer
It depends on how you want to do it. You could use any paint program and draw each letter piece by piece. You could also screen capture a certain size of existing font (as long as there aren't any licensing restrictions). There are also a series of font makers out there.

Because DB doesn't use vector graphics for rendering bitmaps, if you try to resize (especially making larger) a bitmap font, it will get jagged. So, you may have to have several sizes of your font all stored as one image. You then load that picture of all your fonts into DBC, and use get image to capture the specific letter and location.

If, for example, all of the of a particular font were 17 pixels apart and 32 pixels high, you could access each letter using the ASCII code minus 65 or minus 97 (capital A and lower case a) and multiply that value times the sizes. I just used courier for this example. Pretend that the alphabet is stored as a custom bitmap offscreen:



Enjoy your day.
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 20th May 2009 03:17
prolly = probably

There are only 10 kinds of people in the world, those who understand binary and those who dont
Yodaman Jer
User Banned
Posted: 20th May 2009 05:31 Edited at: 20th May 2009 05:32
I like your example Latch! It's very clever.

I think I'll use a slightly modified technique and design the 'font' in GIMP. My game is just barely in the planning stage, but I can definitely do it (remember my Coins Galore game? It's based off of that) and I want to use a certain text style. Your technique is definitely what I was looking for and needed!

"If you want lots of people to play your game make it simple; lots of people are simple." -Obese87
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th May 2009 08:33
If you have a lot of words and such, it would probably be best to capture/calculate all of the letters from the fonts ahead of time and store the values in arrays so you can just reference them as entire words when you need them instead of calculating which letters to use on the fly.

Or store that stuff in data statements or a text file.

Enjoy your day.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st May 2009 04:05
Quote: ""If you want lots of people to play your game make it simple; lots of people are simple." -Obese87"

haha I didn't realise that until now.
I am immortal!

bet you'll change it now just to ruin my fun.

[on topic]
I did this for YaBasic (a version of basic for the PS2), mainly because there was only one text size!
I plotted out the letters in data statements and above had a data statement with the width of the character. It was quite simple after I had all the data.

You should enter the DBC challenge Jer.

There is an eight letter word. You can insert a letter into it or remove a letter from it without changing its meaning. Answer
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 21st May 2009 04:09
off-topic:

call me blonde but im confused on ur sig obese,wat letters canu add or remove?

There are only 10 kinds of people in the world, those who understand binary and those who dont
Yodaman Jer
User Banned
Posted: 21st May 2009 04:34
Quote: "Quote: ""If you want lots of people to play your game make it simple; lots of people are simple." -Obese87"
haha I didn't realise that until now.
I am immortal!

bet you'll change it now just to ruin my fun."


Nope, I won't change it. It's too good to change!

"If you want lots of people to play your game make it simple; lots of people are simple." -Obese87
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 21st May 2009 04:36
mines betr

off-off-topic:
how did we get THIS off-topic, we're so off-topic i had to say off-off-topic for this

There are only 10 kinds of people in the world, those who understand binary and those who dont
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st May 2009 06:50 Edited at: 21st May 2009 06:53
Quote: "call me blonde but im confused on ur sig obese,wat letters can u add or remove?"

Letters as in the ones you write to people you blonde!

Quote: "off-off-topic:how did we get THIS off-topic, we're so off-topic i had to say off-off-topic for this"

haha

[off-off-off-topic]
We are so off topic that I think we're actually back on topic!
Have you got it working yet Jer?

There is an eight letter word. You can insert a letter into it or remove a letter from it without changing its meaning. Answer
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 21st May 2009 06:58
Quote: "Quote: "call me blonde but im confused on ur sig obese,wat letters can u add or remove?"
Letters as in the ones you write to people you blonde!


Quote: "off-off-topic:how did we get THIS off-topic, we're so off-topic i had to say off-off-topic for this"
haha

[off-off-off-topic]
We are so off topic that I think we're actually back on topic!
Have you got it working yet Jer?"


roflmao
roflmao
roflmao

There are only 10 kinds of people in the world, those who understand binary and those who dont
Yodaman Jer
User Banned
Posted: 21st May 2009 22:28
I haven't really messed with it yet, I'm still constructing the basic subroutines/functions I need to use for the game I want to make. I'll be sure to let you know when I try it out and get it working.

"If you want lots of people to play your game make it simple; lots of people are simple." -Obese87

Login to post a reply

Server time is: 2025-05-15 00:37:14
Your offset time is: 2025-05-15 00:37:14