Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2002 Bolton Institute Fonts Andrew Williams

Similar presentations


Presentation on theme: "Copyright © 2002 Bolton Institute Fonts Andrew Williams"— Presentation transcript:

1 Copyright © 2002 Bolton Institute Fonts Andrew Williams A.Williams@bolton.ac.uk http://www.bolton.ac.uk/staff/adw1

2 Copyright © 2002 Bolton Institute AWFont Class Very simple Very restrictive Can print strings… –print_string(..).. Or integers –print_integer(..)

3 Copyright © 2002 Bolton Institute Supplied Font Bitstream Vera Sans, 10.5pt Nothing special about this –It just looks nice You can create your own font files –But there are rules that you MUST follow –There can be no exceptions to these rules

4 Copyright © 2002 Bolton Institute Bitmapped Font File Created with a program called Bitmap Font Builder, by Thom Wetzel –See the link on my webpage There is also a data file which gives character widths

5 Copyright © 2002 Bolton Institute Font Files There are two in the example project –vera.bmp –vera.dat These contain the bitmap and the character width data, respectively

6 Copyright © 2002 Bolton Institute Bitmap Font Builder Must be 256x256

7 Copyright © 2002 Bolton Institute Bitmap Font Builder Background must be black

8 Copyright © 2002 Bolton Institute Bitmap Font Builder Grid must be OFF

9 Copyright © 2002 Bolton Institute Bitmap Font Builder Must be only one font

10 Copyright © 2002 Bolton Institute Bitmap Font Builder You should accept the default size

11 Copyright © 2002 Bolton Institute Bitmap Font Builder You should left-justify your font

12 Copyright © 2002 Bolton Institute Saving Your Font Save as.BMP, eg arial.bmp

13 Copyright © 2002 Bolton Institute Saving Your Font Save font widths (Byte Format) eg arial.dat

14 Copyright © 2002 Bolton Institute Using AWFont You can use as many as you like You load each one like this (do this at the top of the program, but after SDL_SetVideoMode ): font1 = new AWFont(“arial.bmp”, “arial.dat”); Of course, the files must be in the project directory

15 Copyright © 2002 Bolton Institute Using AWFont Printing something out: int endX = font->print_string(“SCORE: ", 10, 10); font->print_integer(score, endX, 10); Parameters (for both) are: 1.What you want to print 2.X coordinate (screen, not world) 3.Y coordinate (screen, not world) Do this in the game loop, sometime after drawing the background


Download ppt "Copyright © 2002 Bolton Institute Fonts Andrew Williams"

Similar presentations


Ads by Google