Jump to content

Photo

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


20 replies to this topic

#1 RevEng ONLINE  

RevEng

    River Patroller

  • 4,994 posts
  • Bitnik
  • Location:bottom of the stack

Posted Sat Jul 18, 2009 5:44 PM

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: Attached File  score_graphics.zip   3.89KB   275 downloads

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.

font_stock.png font_snake.png font_retroputer.png font_plok.png font_newcentury.png font_interrupted.png font_husky.png font_handwritten.png font_curves.png font_alarmclock.png font_tiny.png font_whimsey.png font_symbols.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, Mon Aug 24, 2009 7:58 PM.


#2 Richi_S OFFLINE  

Richi_S

    Star Raider

  • 55 posts
  • Location:Germany - Munich

Posted Sun Jul 19, 2009 5:20 AM

Thats Great,
Thanks!

#3 RevEng ONLINE  

RevEng

    River Patroller

  • Topic Starter
  • 4,994 posts
  • Bitnik
  • Location:bottom of the stack

Posted Sun Jul 19, 2009 11:06 AM

No problem. Glad to give back a little!

#4 yuppicide OFFLINE  

yuppicide

    I am the Black Knight. Give me your money!

  • 6,933 posts
  • Location:New Jersey

Posted Sun Jul 19, 2009 11:39 AM

Awesome work! I'm gonna make some more fonts for it. Is there a limit as to how large the score graphics file can be?

#5 RevEng ONLINE  

RevEng

    River Patroller

  • Topic Starter
  • 4,994 posts
  • Bitnik
  • Location:bottom of the stack

Posted Sun Jul 19, 2009 12:31 PM

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, Sun Jul 19, 2009 12:32 PM.


#6 RevEng ONLINE  

RevEng

    River Patroller

  • Topic Starter
  • 4,994 posts
  • Bitnik
  • Location:bottom of the stack

Posted Sun Jul 19, 2009 1:06 PM

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.

#7 Gateway OFFLINE  

Gateway

    River Patroller

  • 2,165 posts
  • Trotter Atari Globetrotter now on Facebook!
  • Location:St. Joseph area, Missouri

Posted Sun Jul 19, 2009 5:08 PM

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:

#8 RevEng ONLINE  

RevEng

    River Patroller

  • Topic Starter
  • 4,994 posts
  • Bitnik
  • Location:bottom of the stack

Posted Sun Jul 19, 2009 5:44 PM

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.

#9 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • 11,485 posts
  • Location:Salem, Oregon

Posted Sun Jul 19, 2009 5:54 PM

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, Sun Jul 19, 2009 5:54 PM.


#10 RevEng ONLINE  

RevEng

    River Patroller

  • Topic Starter
  • 4,994 posts
  • Bitnik
  • Location:bottom of the stack

Posted Sun Jul 19, 2009 6:23 PM

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
Attached File  font.bas.bin   4KB   183 downloads Attached File  font.bas   361bytes   174 downloads

Edited by RevEng, Mon Aug 24, 2009 8:07 PM.


#11 yuppicide OFFLINE  

yuppicide

    I am the Black Knight. Give me your money!

  • 6,933 posts
  • Location:New Jersey

Posted Sun Jul 19, 2009 9:04 PM

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!



#12 RevEng ONLINE  

RevEng

    River Patroller

  • Topic Starter
  • 4,994 posts
  • Bitnik
  • Location:bottom of the stack

Posted Mon Aug 24, 2009 8:06 PM

I updated the original post: I added one more font (Ste's, not my own) and some new symbols.

I probably won't be updating this for a while, if at all... Consider it the final version.

#13 Philsan ONLINE  

Philsan

    River Patroller

  • 3,724 posts
  • New Orleans Saints Super Bowl XLIV Champions
  • Location:Switzerland

Posted Fri Dec 17, 2010 4:45 AM

If I am not wrong, if you want to avoid a compilation error (it's only cosmethical, compiled files works perfectly), instead of
const fontstyle=FONTNAME
you should use
const fontstyle=FONTNUMBER

#14 Coolcrab OFFLINE  

Coolcrab

    Moonsweeper

  • 385 posts
  • Location:Stockholm

Posted Sat Aug 25, 2018 1:50 PM

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? 

Attached Files



#15 RevEng ONLINE  

RevEng

    River Patroller

  • Topic Starter
  • 4,994 posts
  • Bitnik
  • Location:bottom of the stack

Posted Sat Aug 25, 2018 4:12 PM

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

Attached Files



#16 Coolcrab OFFLINE  

Coolcrab

    Moonsweeper

  • 385 posts
  • Location:Stockholm

Posted Sun Aug 26, 2018 1:41 AM

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.



#17 RevEng ONLINE  

RevEng

    River Patroller

  • Topic Starter
  • 4,994 posts
  • Bitnik
  • Location:bottom of the stack

Posted Sun Aug 26, 2018 6:49 AM

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


Not an intentional one, but I guess that can be handy.

#18 Coolcrab OFFLINE  

Coolcrab

    Moonsweeper

  • 385 posts
  • Location:Stockholm

Posted Tue Oct 16, 2018 2:24 PM

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.

Attached Files



#19 Lillapojkenpćön OFFLINE  

Lillapojkenpćön

    Chopper Commander

  • 118 posts

Posted Wed Oct 17, 2018 1:47 PM

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
 
 

bug.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.



#20 Muddyfunster OFFLINE  

Muddyfunster

    Chopper Commander

  • 150 posts

Posted Wed Oct 17, 2018 5:26 PM

Love the "Railslider" logo, reminds me of the big demoscene logos from the Atart ST and Amiga days.



#21 Gemintronic OFFLINE  

Gemintronic

    Jason S. - Lead Developer & CEO

  • 9,221 posts

Posted Wed Oct 17, 2018 5:40 PM

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.






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users