From 91828eaa3ead9786fc19cd87805ca3e20069026c Mon Sep 17 00:00:00 2001 From: shokre Date: Thu, 16 Sep 2021 17:25:40 +0200 Subject: [PATCH] feat(chargen): add color params --- orao/chargen.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/orao/chargen.py b/orao/chargen.py index 9e10401..c2fe4dc 100644 --- a/orao/chargen.py +++ b/orao/chargen.py @@ -6,17 +6,17 @@ def chargen_init(char_data): chars = char_data -def chargen_draw_char(surf, px, py, ch): +def chargen_draw_char(surf, px, py, ch, color=(0, 255, 0), bg=(0, 0, 0)): char_loc = (ord(ch) - 32) * 8 for y in range(8): c = chars[char_loc + y] for x in range(8): if (c >> x) & 1: - surf.set_at((px + x, py + y), (0, 255, 0)) + surf.set_at((px + x, py + y), color) else: - surf.set_at((px + x, py + y), (0, 0, 0)) + surf.set_at((px + x, py + y), bg) -def chargen_draw_str(surf, px, py, str): +def chargen_draw_str(surf, px, py, str, color=(0, 255, 0), bg=(0, 0, 0)): for x in range(len(str)): - chargen_draw_char(surf, px + x * 8, py, str[x]) + chargen_draw_char(surf, px + x * 8, py, str[x], color=color, bg=bg)