Jump to content
IGNORED

custom fonts for bB, all-in-one score_graphics.asm


Recommended Posts

I created and collected various fonts and stuck them all in a single score_graphics.asm file. The font is selectable from within your basic code by setting the the "fontstyle" constant.

 

The stock font is the default, so this score_graphics.asm will function exactly as the stock score_graphics.asm that came with bB if you don't specify a custom font or custom characters.

 

This file is a drop-in replacement for the official bB score_graphics.asm. You can either replace the official score_graphics.asm with this one, or just drop the file in your project directory: score_graphics.zip

 

My fonts are public domain, though it would be nice if you mention them if you use of them in a project, to help spread the word. Plok is one of Ste's bitmap fonts and the license for it is basically Public Domain. The bB stock font is under the bB license.

 

post-23476-125116435447_thumb.pngpost-23476-125116434216_thumb.pngpost-23476-125116432947_thumb.pngpost-23476-125116431987_thumb.pngpost-23476-125116430669_thumb.pngpost-23476-125116429174_thumb.pngpost-23476-125116428265_thumb.pngpost-23476-125116427407_thumb.pngpost-23476-125116426616_thumb.pngpost-23476-125116424374_thumb.pngpost-23476-125116436915_thumb.pngpost-23476-125116437929_thumb.pngpost-23476-125116436206_thumb.png

 

 rem Example of enabling a custom font. Options are: NOFONT, STOCK, NEWCENTURY, 
rem WHIMSEY, ALARMCLOCK, HANDWRITTEN, INTERRUPTED, TINY, RETROPUTER, SNAKE,
rem HUSKY, CURVES, or PLOK...
const fontstyle = WHIMSEY

rem Example of enabling a custom font and enabling hex characters...
const fontstyle = HANDWRITTEN
const fontcharsHEX = 1

rem Example of enabling custom characters. Custom chars are: fontcharSPACE, fontcharDOLLAR,
rem fontcharPOUND, fontcharMRHAPPY, fontcharMRSAD, fontcharCOPYRIGHT, fontcharFUJI,
rem fontcharHEART, fontcharDIAMOND, fontcharSPADE, fontcharCLUB, fontcharCOLON,
rem fontcharBLOCK, fontcharUNDERLINE, fontcharARISIDE, fontcharARIFACE
const fontcharSPACE = 1
const fontcharCOPYRIGHT = 1

rem You can only use 16 possible characters, so while the following is valid syntax, 
rem you'll never be able to access the custom characters...
const fontcharsHEX = 1
const fontcharSPACE = 1
const fontcharMRHAPPY = 1

[edit: added in PLOK, and some new custom symbols.]

Edited by RevEng
  • Like 4

Cool! The more the merrier!

 

I've actually added a few new ones since I releaseed it this yesterday! :roll:

 

In my defense, I find font work very relaxing and a productive way to procrastinate when I'm not working on my game.

 

There's no practical limit to the size of the file, other than your filesystem's maximum file size or dasm's maximum file size, whichever is lesser. Either way it has a lot of room to grow!

Edited by RevEng

I added in my 3 new fonts to the first post and updated the zipfile.

 

If anybody wants to add to the pack, just post your score_graphics here and I'll do the merge and preview graphics. All additions will be attributed, naturally.

Thanks for posting this!

 

Some questions:

 

1. How do you "use" the custom characters i.e. the dollar sign, blank space, etc. ? Are these in addition to the 6 hex values "A - F" or do they take the place of them to total 16 characters in all for each font?

 

2. This is great for testing the look of fonts in your game, however, once you choose the font you want, you don't need the other fonts taking up ROM in your .asm file. I assume you transfer the font you want to your game then you no longer need to include the constants: STOCK, NEW CENTURY, etc in your program?

 

3. Can you include more than one font in your game by switching between more than one font during the game loop ( in order to have access to more than 16 custom characters ) ?

 

Thanks :cool:

You're welcome. Glad you like the fonts!

 

1. How do you "use" the custom characters i.e. the dollar sign, blank space, etc. ? Are these in addition to the 6 hex values "A - F" or do they take the place of them to total 16 characters in all for each font?

You need to use them in place of the hex characters. The bB score can only access 16 characters per digit.

 

It's also possible to replace the regular digits with special characters by setting "const fontstyle=NOFONT". That may make more sense when there are a lot more characters and your game doesn't need numbers. (so the score can behave like an inventory list, or what have you)

 

2. This is great for testing the look of fonts in your game, however, once you choose the font you want, you don't need the other fonts taking up ROM in your .asm file. I assume you transfer the font you want to your game then you no longer need to include the constants: STOCK, NEW CENTURY, etc in your program?

No need to do that; the fonts and characters that you don't select aren't compiled into the rom, so they don't take up any space.

 

3. Can you include more than one font in your game by switching between more than one font during the game loop ( in order to have access to more than 16 custom characters ) ?

It would be cool to be able to do that, but that's not possible without some modifications to the bB score routine.

1. How do you "use" the custom characters i.e. the dollar sign, blank space, etc. ? Are these in addition to the 6 hex values "A - F" or do they take the place of them to total 16 characters in all for each font?
You need to use them in place of the hex characters. The bB score can only access 16 characters per digit.

OK, so I'm using the digits in Alarm Clock 0-9. Suppose I want to put spaces in. How would I do this?

Edited by atari2600land
OK, so I'm using the digits in Alarm Clock 0-9. Suppose I want to put spaces in. How would I do this?

The special characters get put into the hex digit positions starting with $a, in the order that they're defined in score_graphics.asm.

 

The following example puts a "©1983" with a space after it in the score. Be sure to add in the spaces that the AA forum eats from the margin, or download the bas at the end of the post...

 

 const fontstyle=ALARMCLOCK
const fontcharSPACE=1
const fontcharCOPYRIGHT=1

dim sc0=score
dim sc1=score+1
dim sc2=score+2

rem we update the score bytes individually...
sc0=$b1
sc1=$98
sc2=$3a

scorecolor=$0f

gameloop

drawscreen
goto gameloop

font.bas.bin font.bas

Edited by RevEng

Relaxing might be a good word. When I'm doing a game and I can't get something to work, at least I know I can draw a font and it'll ALWAYS work.

 

Cool! The more the merrier!

 

I've actually added a few new ones since I releaseed it this yesterday! :roll:

 

In my defense, I find font work very relaxing and a productive way to procrastinate when I'm not working on my game.

 

There's no practical limit to the size of the file, other than your filesystem's maximum file size or dasm's maximum file size, whichever is lesser. Either way it has a lot of room to grow!

  • 1 month later...
  • 1 year later...
  • 7 years later...

The special characters get put into the hex digit positions starting with $a, in the order that they're defined in score_graphics.asm.

 

The following example puts a "©1983" with a space after it in the score. Be sure to add in the spaces that the AA forum eats from the margin, or download the bas at the end of the post...

 

const fontstyle=ALARMCLOCK
 const fontcharSPACE=1
 const fontcharCOPYRIGHT=1

 dim sc0=score
 dim sc1=score+1
 dim sc2=score+2

 rem we update the score bytes individually...
 sc0=$b1
 sc1=$98
 sc2=$3a

 scorecolor=$0f

gameloop

 drawscreen
 goto gameloop
attachicon.giffont.bas.bin attachicon.giffont.bas

 

I tried this out but for some reason it only works for up to 2 new characters. once I add a 3rd one it just refuses to compile.

It should be possible get up to 6 new characters right?

font.bas

score_graphics.asm

A couple things... you replaced some of the original labels, but didn't replace the names in the "scorelength = " calculation at the top of the file.

 

You also dropped an "endif" after one of the character definitions, and that basically made everything after it part of the condition. (in this case, conditionally off)

 

Here's your fixed score_graphics.asm

score_graphics.asm

  • Like 1

Ah I missed that endif! Thanks for that.

 

I also noticed that the order of the characters matters in the ASM file, is that a feature?

 

So if you do

 const fontcharSPACE=1
 const fontcharBACK=1
 const fontcharCROSS=1

while BACK is before SPACE in the asm then $a will be BACK and $b will be SPACE.

 

Just wanted to put it down for future generations, as this took me some time to figure out.

  • Like 1
  • 1 month later...

I stumbled across a strange effect with this .asm. If you move the font to be all the way on the left. e.g.

       .byte %00000000 ; TINY
       .byte %11100000 ; TINY
       .byte %10100000 ; TINY
       .byte %10100000 ; TINY
       .byte %10100000 ; TINY
       .byte %11100000 ; TINY
       .byte %00000000 ; TINY
       .byte %00000000 ; TINY

Then it will give a strange error for the most right score digit, inserting an always active row of pixels. I'm using this in conjunction with KarlG's player_score kernel and he also thinks its probably some kind of glitch with the lefter most pixel not getting erased.

 

Is this a known issue? I could really use the extra pixel to align my fonts with.

score_graphics_broken.asm

What are the odds of two Swedish guys encountering this at the same time??

I moved my titlescreen font to the left so it would line up with the score in my game

 

.byte %00111111 ; STOCK
.byte %00100001 ; STOCK
.byte %00100001 ; STOCK
.byte %00100001 ; STOCK
.byte %00100001 ; STOCK
.byte %00100001 ; STOCK
.byte %00100001 ; STOCK
.byte %00111111 ; STOCK

post-17076-0-15657900-1539804905_thumb.jpg

That's suppose to be a one and doesn't happen all the time but every time with that number, allmost looks like the first row of the two is being duplicated there.

I'm using the DPC+ Kernel option with the titlescreen if that matters.

What are the odds of two Swedish guys encountering this at the same time??

I moved my titlescreen font to the left so it would line up with the score in my game

 

.byte %00111111 ; STOCK
.byte %00100001 ; STOCK
.byte %00100001 ; STOCK
.byte %00100001 ; STOCK
.byte %00100001 ; STOCK
.byte %00100001 ; STOCK
.byte %00100001 ; STOCK
.byte %00111111 ; STOCK

That's suppose to be a one and doesn't happen all the time but every time with that number, allmost looks like the first row of the two is being duplicated there.

I'm using the DPC+ Kernel option with the titlescreen if that matters.

 

I've learned to just not use the first and last column of pixels in score digits. Not really a bug but I bet it has to do with the tight timing needed to display the digits where they are.

  • Like 2

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...