Jump to content

Photo

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


12 replies to this topic

#1 RevEng OFFLINE  

RevEng

    River Patroller

  • 3,343 posts
  • bit player
  • Location:Canada

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   197 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

  • 51 posts
  • Location:Germany - Munich

Posted Sun Jul 19, 2009 5:20 AM

Thats Great,
Thanks!

#3 RevEng OFFLINE  

RevEng

    River Patroller

  • Topic Starter
  • 3,343 posts
  • bit player
  • Location:Canada

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 OFFLINE  

RevEng

    River Patroller

  • Topic Starter
  • 3,343 posts
  • bit player
  • Location:Canada

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 OFFLINE  

RevEng

    River Patroller

  • Topic Starter
  • 3,343 posts
  • bit player
  • Location:Canada

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,149 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 OFFLINE  

RevEng

    River Patroller

  • Topic Starter
  • 3,343 posts
  • bit player
  • Location:Canada

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

    Quadrunner

  • 8,071 posts
  • The brightest ideas in the world are here to play.
  • 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 OFFLINE  

RevEng

    River Patroller

  • Topic Starter
  • 3,343 posts
  • bit player
  • Location:Canada

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   130 downloads Attached File  font.bas   361bytes   134 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 OFFLINE  

RevEng

    River Patroller

  • Topic Starter
  • 3,343 posts
  • bit player
  • Location:Canada

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 OFFLINE  

Philsan

    River Patroller

  • 2,758 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




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users