From 89bf2bf2197e44f0745bcae1400227c2999573cd Mon Sep 17 00:00:00 2001 From: Viljami Ilola <+@hix.fi> Date: Mon, 18 Mar 2024 16:27:51 +0200 Subject: fonts from fnt-file --- src/sliceitoff/__main__.py | 6 ++- src/sliceitoff/assets/fonts.lst | 1 + src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.DE | 6 +++ src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.FR | 6 +++ .../assets/gnufonts/APPINFO/GNUFONTS.LSM | 16 ++++++++ src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.SV | 6 +++ src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.TR | 6 +++ .../assets/gnufonts/UTIL/GNUFONTS/8X10.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/8X11SNSF.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/8X14.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/8X8.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/ANTIQUE.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/ARCHON.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/BACKWARD.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/BIGSERIF.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/BLCKSNSF.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/BLOCK.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/BOLD.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/BREEZE.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/BROADWAY.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/COMPUTER.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/COURIER.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/CYRILLIC.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/DECO.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/EMPTY.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/EUROTYPE.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/FAT.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/FINNISH.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/FLAT.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/FRANCE.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/FRESNO.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/FUTURA-1.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/FUTURA-2.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/GREEK.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/HEARST.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/HEBREW.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/HYLAS.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/INVERTED.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/ITALICS.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/KIDS-1.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/KIDS-2.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/LCD.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/MEDIEVAL.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/MODERN-1.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/MODERN-2.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/NORWAY.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/REV8X8.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/REVERSE.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/ROMAN-1.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/ROMAN-2.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/SANSERIF.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/SANSURF.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/SCOTT.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/SCRIPT.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/SILVER.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/STANDARD.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/STRETCH.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/SUPER.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/SURREAL.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/SWISS-1.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/SWISS-2.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/SWISS-3.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/TEKTON.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/TERMINUS.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/THAI.FNT | Bin 0 -> 4096 bytes .../assets/gnufonts/UTIL/GNUFONTS/THIN.FNT | Bin 0 -> 4096 bytes src/sliceitoff/game/gameplay.py | 10 ++++- src/sliceitoff/game/level.py | 2 +- src/sliceitoff/images/__init__.py | 1 + src/sliceitoff/images/fonts.py | 42 +++++++++++++++++++++ src/sliceitoff/status/status.py | 40 ++++++++++++++------ 71 files changed, 125 insertions(+), 17 deletions(-) create mode 100644 src/sliceitoff/assets/fonts.lst create mode 100644 src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.DE create mode 100644 src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.FR create mode 100644 src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.LSM create mode 100644 src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.SV create mode 100644 src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.TR create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/8X10.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/8X11SNSF.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/8X14.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/8X8.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ANTIQUE.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ARCHON.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BACKWARD.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BIGSERIF.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BLCKSNSF.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BLOCK.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BOLD.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BREEZE.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BROADWAY.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/COMPUTER.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/COURIER.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/CYRILLIC.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/DECO.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/EMPTY.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/EUROTYPE.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FAT.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FINNISH.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FLAT.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FRANCE.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FRESNO.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FUTURA-1.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FUTURA-2.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/GREEK.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/HEARST.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/HEBREW.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/HYLAS.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/INVERTED.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ITALICS.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/KIDS-1.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/KIDS-2.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/LCD.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/MEDIEVAL.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/MODERN-1.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/MODERN-2.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/NORWAY.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/REV8X8.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/REVERSE.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ROMAN-1.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ROMAN-2.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SANSERIF.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SANSURF.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SCOTT.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SCRIPT.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SILVER.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/STANDARD.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/STRETCH.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SUPER.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SURREAL.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SWISS-1.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SWISS-2.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SWISS-3.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/TEKTON.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/TERMINUS.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/THAI.FNT create mode 100644 src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/THIN.FNT create mode 100644 src/sliceitoff/images/fonts.py diff --git a/src/sliceitoff/__main__.py b/src/sliceitoff/__main__.py index 6845d94..17e7317 100644 --- a/src/sliceitoff/__main__.py +++ b/src/sliceitoff/__main__.py @@ -8,7 +8,7 @@ from pathlib import Path import pygame from display import Display -from images import Images +from images import Images, Fonts from game import Level @@ -17,7 +17,9 @@ def sliceitoff(): pygame.init() display = Display() - Images.load_images( Path(__file__).parent.resolve() ) + current_path = Path(__file__).parent.resolve() + Images.load_images( current_path ) + Fonts.load_fonts( current_path ) level1 = Level(display = display, level = 10, score = 10) diff --git a/src/sliceitoff/assets/fonts.lst b/src/sliceitoff/assets/fonts.lst new file mode 100644 index 0000000..0e85a1c --- /dev/null +++ b/src/sliceitoff/assets/fonts.lst @@ -0,0 +1 @@ +lcd assets gnufonts UTIL GNUFONTS LCD.FNT diff --git a/src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.DE b/src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.DE new file mode 100644 index 0000000..5082bd5 --- /dev/null +++ b/src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.DE @@ -0,0 +1,6 @@ +Begin3 +Language: DE, 858 +Title: GNU chcp fonts +Description: LOADFONT (GNUCHCP) rohe EGA/VGA-Bitmap-Schriftarten fr Textmodi. +Keywords: loadfont gnuchcp bitmap font ega vga screen schriftart +End diff --git a/src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.FR b/src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.FR new file mode 100644 index 0000000..24ef21a --- /dev/null +++ b/src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.FR @@ -0,0 +1,6 @@ +Begin3 +Language: FR, 850 +Title: GNU chcp fonts +Description: LOADFONT (GNUCHCP) polices bitmap EGA/VGA brutes pour les modes texte. +Keywords: loadfont gnuchcp bitmap police ega vga ‚cran +End diff --git a/src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.LSM b/src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.LSM new file mode 100644 index 0000000..c399da5 --- /dev/null +++ b/src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.LSM @@ -0,0 +1,16 @@ +Begin3 +Title: GNU chcp fonts +Version: 1.0a +Entered-date: 2013-06-04 +Description: EGA/VGA bitmap fonts for text modes +Keywords: loadfont gnuchcp bitmap font ega vga screen +Author: Kurt Zammit +Maintained-by: Kurt Zammit +Primary-site: http://zammitsoft.freeservers.com +Mirror-site: http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/util/system/ +Original-site: http://zammitsoft.freeservers.com +Platforms: DOS +Copying-policy: GNU General Public License, Version 2 +Summary: Raw EGA/VGA bitmap fonts for text modes. +Modified-date: 2022-02-17.0 +end diff --git a/src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.SV b/src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.SV new file mode 100644 index 0000000..df108ff --- /dev/null +++ b/src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.SV @@ -0,0 +1,6 @@ +Begin3 +Language: SV, 850 +Title: GNU chcp-typsnitt +Description: LOADFONT (GNUCHCP) r†a EGA-/VGA-bitmappstypsnitt f”r textl„gen. +Keywords: loadfont gnuchcp bitmapp typsnitt ega vga sk„rm +End diff --git a/src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.TR b/src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.TR new file mode 100644 index 0000000..5fee353 --- /dev/null +++ b/src/sliceitoff/assets/gnufonts/APPINFO/GNUFONTS.TR @@ -0,0 +1,6 @@ +Begin3 +Language: TR, 857 +Title: GNU chcp fonts +Description: Metin kipleri i‡in LOADFONT (GNUCHCP) ham EGA/VGA bitmap yaz tipleri. +Keywords: loadfont gnuchcp bitmap yaz tipi ega vga ekran +End diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/8X10.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/8X10.FNT new file mode 100644 index 0000000..27216e9 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/8X10.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/8X11SNSF.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/8X11SNSF.FNT new file mode 100644 index 0000000..f584fb5 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/8X11SNSF.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/8X14.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/8X14.FNT new file mode 100644 index 0000000..f10237d Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/8X14.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/8X8.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/8X8.FNT new file mode 100644 index 0000000..f0b651e Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/8X8.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ANTIQUE.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ANTIQUE.FNT new file mode 100644 index 0000000..16d304e Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ANTIQUE.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ARCHON.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ARCHON.FNT new file mode 100644 index 0000000..4fc92d7 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ARCHON.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BACKWARD.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BACKWARD.FNT new file mode 100644 index 0000000..d078c0d Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BACKWARD.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BIGSERIF.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BIGSERIF.FNT new file mode 100644 index 0000000..0e0704f Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BIGSERIF.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BLCKSNSF.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BLCKSNSF.FNT new file mode 100644 index 0000000..1b4f5b0 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BLCKSNSF.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BLOCK.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BLOCK.FNT new file mode 100644 index 0000000..682a2ea Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BLOCK.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BOLD.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BOLD.FNT new file mode 100644 index 0000000..b9f4728 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BOLD.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BREEZE.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BREEZE.FNT new file mode 100644 index 0000000..96ecb0d Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BREEZE.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BROADWAY.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BROADWAY.FNT new file mode 100644 index 0000000..565e4ec Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/BROADWAY.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/COMPUTER.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/COMPUTER.FNT new file mode 100644 index 0000000..6862665 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/COMPUTER.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/COURIER.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/COURIER.FNT new file mode 100644 index 0000000..fbba1a1 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/COURIER.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/CYRILLIC.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/CYRILLIC.FNT new file mode 100644 index 0000000..3c07185 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/CYRILLIC.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/DECO.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/DECO.FNT new file mode 100644 index 0000000..d61c7b9 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/DECO.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/EMPTY.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/EMPTY.FNT new file mode 100644 index 0000000..85d0ffd Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/EMPTY.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/EUROTYPE.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/EUROTYPE.FNT new file mode 100644 index 0000000..a92852f Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/EUROTYPE.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FAT.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FAT.FNT new file mode 100644 index 0000000..c30c214 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FAT.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FINNISH.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FINNISH.FNT new file mode 100644 index 0000000..ce9723e Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FINNISH.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FLAT.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FLAT.FNT new file mode 100644 index 0000000..3c011ae Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FLAT.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FRANCE.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FRANCE.FNT new file mode 100644 index 0000000..23aaf38 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FRANCE.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FRESNO.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FRESNO.FNT new file mode 100644 index 0000000..ca3078b Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FRESNO.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FUTURA-1.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FUTURA-1.FNT new file mode 100644 index 0000000..f835e52 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FUTURA-1.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FUTURA-2.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FUTURA-2.FNT new file mode 100644 index 0000000..1a8c9e2 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/FUTURA-2.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/GREEK.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/GREEK.FNT new file mode 100644 index 0000000..63361c6 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/GREEK.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/HEARST.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/HEARST.FNT new file mode 100644 index 0000000..59d20da Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/HEARST.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/HEBREW.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/HEBREW.FNT new file mode 100644 index 0000000..0459008 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/HEBREW.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/HYLAS.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/HYLAS.FNT new file mode 100644 index 0000000..f5691cc Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/HYLAS.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/INVERTED.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/INVERTED.FNT new file mode 100644 index 0000000..e422bb6 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/INVERTED.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ITALICS.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ITALICS.FNT new file mode 100644 index 0000000..ad172ae Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ITALICS.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/KIDS-1.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/KIDS-1.FNT new file mode 100644 index 0000000..c174343 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/KIDS-1.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/KIDS-2.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/KIDS-2.FNT new file mode 100644 index 0000000..c6577dd Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/KIDS-2.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/LCD.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/LCD.FNT new file mode 100644 index 0000000..0d8842b Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/LCD.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/MEDIEVAL.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/MEDIEVAL.FNT new file mode 100644 index 0000000..ab02bd6 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/MEDIEVAL.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/MODERN-1.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/MODERN-1.FNT new file mode 100644 index 0000000..79f69dc Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/MODERN-1.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/MODERN-2.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/MODERN-2.FNT new file mode 100644 index 0000000..90754d5 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/MODERN-2.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/NORWAY.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/NORWAY.FNT new file mode 100644 index 0000000..9841a46 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/NORWAY.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/REV8X8.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/REV8X8.FNT new file mode 100644 index 0000000..7c4e21f Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/REV8X8.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/REVERSE.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/REVERSE.FNT new file mode 100644 index 0000000..7f6a8a8 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/REVERSE.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ROMAN-1.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ROMAN-1.FNT new file mode 100644 index 0000000..3afa137 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ROMAN-1.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ROMAN-2.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ROMAN-2.FNT new file mode 100644 index 0000000..a96eee8 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/ROMAN-2.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SANSERIF.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SANSERIF.FNT new file mode 100644 index 0000000..57c6176 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SANSERIF.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SANSURF.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SANSURF.FNT new file mode 100644 index 0000000..3d55d61 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SANSURF.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SCOTT.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SCOTT.FNT new file mode 100644 index 0000000..10f235b Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SCOTT.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SCRIPT.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SCRIPT.FNT new file mode 100644 index 0000000..f16090d Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SCRIPT.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SILVER.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SILVER.FNT new file mode 100644 index 0000000..245a008 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SILVER.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/STANDARD.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/STANDARD.FNT new file mode 100644 index 0000000..19ff712 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/STANDARD.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/STRETCH.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/STRETCH.FNT new file mode 100644 index 0000000..4b74341 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/STRETCH.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SUPER.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SUPER.FNT new file mode 100644 index 0000000..cfcd60f Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SUPER.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SURREAL.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SURREAL.FNT new file mode 100644 index 0000000..821da52 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SURREAL.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SWISS-1.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SWISS-1.FNT new file mode 100644 index 0000000..7267692 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SWISS-1.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SWISS-2.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SWISS-2.FNT new file mode 100644 index 0000000..3f540ba Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SWISS-2.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SWISS-3.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SWISS-3.FNT new file mode 100644 index 0000000..1f76137 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/SWISS-3.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/TEKTON.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/TEKTON.FNT new file mode 100644 index 0000000..72b3148 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/TEKTON.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/TERMINUS.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/TERMINUS.FNT new file mode 100644 index 0000000..ca93cc7 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/TERMINUS.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/THAI.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/THAI.FNT new file mode 100644 index 0000000..b941e9c Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/THAI.FNT differ diff --git a/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/THIN.FNT b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/THIN.FNT new file mode 100644 index 0000000..f51ece8 Binary files /dev/null and b/src/sliceitoff/assets/gnufonts/UTIL/GNUFONTS/THIN.FNT differ diff --git a/src/sliceitoff/game/gameplay.py b/src/sliceitoff/game/gameplay.py index fc0f52b..a7224ca 100644 --- a/src/sliceitoff/game/gameplay.py +++ b/src/sliceitoff/game/gameplay.py @@ -1,11 +1,15 @@ +""" Reads user input and does actions when game play is on. """ import pygame class Gameplay: - def __init__(self, player = None, field = None): + """ Logic of the playfield """ + def __init__(self, player = None, field = None, status = None): + self.status = status self.player = player self.field = field def step(self): + """ Processes events for the step (frame) """ for event in pygame.event.get(): match event.type: case pygame.KEYDOWN: @@ -22,7 +26,9 @@ class Gameplay: case pygame.MOUSEBUTTONDOWN: self.player.set_position(pygame.mouse.get_pos()) if event.button == 1: - if self.player.fire_lazer(): + if ( + self.player.fire_lazer() + and self.status.lose_life() ): return True if event.button == 3: self.player.set_direction() diff --git a/src/sliceitoff/game/level.py b/src/sliceitoff/game/level.py index 97e64cf..28d9b44 100644 --- a/src/sliceitoff/game/level.py +++ b/src/sliceitoff/game/level.py @@ -14,7 +14,7 @@ class Level: self.field = Field() self.enemies = Enemies(field = self.field, level = level) self.player = Player(field = self.field, enemies = self.enemies) - self.gameplay = Gameplay(player = self.player) + self.gameplay = Gameplay(player = self.player, status = self.status ) self.obj_classes = ( self.status, self.field, diff --git a/src/sliceitoff/images/__init__.py b/src/sliceitoff/images/__init__.py index d87dfa0..c11d718 100644 --- a/src/sliceitoff/images/__init__.py +++ b/src/sliceitoff/images/__init__.py @@ -1 +1,2 @@ from .images import Images +from .fonts import Fonts, Font diff --git a/src/sliceitoff/images/fonts.py b/src/sliceitoff/images/fonts.py new file mode 100644 index 0000000..d3d15cf --- /dev/null +++ b/src/sliceitoff/images/fonts.py @@ -0,0 +1,42 @@ +import os +import pygame + +from display import Scaling + +DEBUG = os.getenv("DEBUG") + +class Fonts: + fonts = {} + + @staticmethod + def load_fonts(base_path): + filename_fontlist = os.path.join(base_path, "assets", "fonts.lst") + with open( filename_fontlist ) as fontlist_file: + for line in fontlist_file: + name, *path = line.strip().split() + filename = os.path.join(base_path, *path) + font = Font(filename) + __class__.fonts[name] = Font(filename) + return True + + +class Font: + def __init__(self, filename, height = 16): + if DEBUG: + print(f"Loading font {filename = }") + self.surfaces = [] + with open(filename, mode="rb") as fnt_file: + for _ in range(256): + surface = pygame.Surface((8,height), pygame.SRCALPHA) + for line in range(16): + byte = fnt_file.read(1)[0] + if line >= height: + continue + for bit in range(8): + if byte & 0x80: + surface.set_at((bit,line),"white") + byte <<= 1 + self.surfaces.append(surface) + + def get(self, ch): + return self.surfaces[ch.encode('cp437')[0]%256] diff --git a/src/sliceitoff/status/status.py b/src/sliceitoff/status/status.py index d99c7d5..a63a7db 100644 --- a/src/sliceitoff/status/status.py +++ b/src/sliceitoff/status/status.py @@ -2,20 +2,31 @@ import os import pygame from display import Scaling -from images import Images +from images import Images, Fonts class LetterSprite(pygame.sprite.Sprite): def __init__(self, image, pos): super().__init__() self.image = image self.rect = self.image.get_rect().move(pos) - + +class TextGroup(pygame.sprite.Group): + def __init__(self, text, pos, size = 8_000, spacing = None, font = 'lcd'): + super().__init__() + if spacing == None: + spacing = size + for i in range(len(text)): + image = pygame.transform.scale_by( + Fonts.fonts[font].get(text[i]), + size/8 * Scaling.factor) + image_pos = Scaling.scale_to_display( (pos[0]+i*spacing, pos[1]) ) + self.add(LetterSprite(image, image_pos)) class Status(): def __init__(self, level = 1): self.score = 0 self.bonus = 20_000 - self.health = 3 + self.lives = 3 self.level = level self.sprites = pygame.sprite.Group() @@ -24,12 +35,17 @@ class Status(): self.bonus = max(0, self.bonus - dt) - self.sprites.empty() - y = 280_000 - #score_str="{:010d}".format(self.score) - score_str="{:010d}".format(self.bonus) - for letter, x in zip(score_str, range(300_000,400_000,10_000)): - self.sprites.add(LetterSprite( - Images.surfaces[f"letter_{letter}"], - Scaling.scale_to_display((x,y)) )) - self.updated = False + score_str="LEVEL{:02d}LIVES{:02d}{:010d}".format(self.level, self.lives, self.bonus) + self.sprites = TextGroup( + score_str, + (0, 280_000), + size = 10_000) + + def lose_life(self): + """ Lose 1 life and return true if no lives left """ + self.lives -= 1 + return not self.lives + + def gain_life(self): + """ Gain 1 life """ + self.lives += 1 -- cgit v1.2.3