From a9b730ff12b250095140bba4da4b2c8bc9572290 Mon Sep 17 00:00:00 2001 From: klemek Date: Wed, 11 Nov 2026 18:42:16 +0100 Subject: [PATCH] feat: display demo/autorandom --- resources/background.png | Bin 301 -> 283 bytes src/forge_invar/display.py | 29 +++++++++++++++++++++++++---- src/forge_invar/tools/gen_img.py | 1 - 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/resources/background.png b/resources/background.png index 22de263eba9fbe29273270b441f78424ab1343f3..2f5c6c9fa20d4a823782eabbe4d2c0d06d204990 100644 GIT binary patch delta 255 zcmVk9q_5BH+>`y zkS3`p!HB|C#(0B+?AR6Ut$q8)=;c=8wm%O_Cz+v=`6T<}6%4VtOH0b==bC zuWan!dpVE(3*%fbf6#$2t7t3Ws|H)}o(gt|sGyAid;kuBS^+Nssg(c#002ovPDHLk FV1lemcgg?& delta 274 zcmV+t0qy>q0<8j&B!BctL_t(|oVAfLPQySDMc=F~Ws3->q)Tp+Jqj1#47lVNoPrW< zdc+Nok~R%Eii9I!e+oMU#aP%NrkT~({+&1bv6uVe5y-9|B7oEL?e-3Mb2|VWNy#3d zo`y!KxSRs8kL`{8=?Z`gzOO`*q;lT$n92a~zUjf8JAM{AkAL>e9$A^z+~|woSrBXl z*Z_1qOGT6Fp_UZbSip{dJYsB8l*|=LkAlooSimt+WLbCl9G)3r+;S7G2Z5!hPx# diff --git a/src/forge_invar/display.py b/src/forge_invar/display.py index 96a74aa..f60618c 100644 --- a/src/forge_invar/display.py +++ b/src/forge_invar/display.py @@ -21,6 +21,7 @@ from .constants import ( ) from .enums import ForgeState from .forge_data import ForgeData +from .glsl_funcs import mod FONT_1 = ImageFont.truetype(FONT_1_PATH, 5) FONT_2 = ImageFont.truetype(FONT_2_PATH, 8) @@ -63,10 +64,30 @@ def __get_running_display(data: ForgeData) -> Image.Image: draw.rectangle((6, 7, 6 + int(53 * data.beat_progress), 10), fill="white", width=0) # time - draw.text((94, -2), f"{int(data.time)}", fill="white", font=FONT_1) - draw.rectangle( - (67, 7, 67 + int(53 * data.time_progress), 10), fill="white", width=0 - ) + if data.demo: + draw.text((68, -2), "DEMO", fill="white", font=FONT_1) + else: + draw.text((68, -2), f"TIME: {int(data.time)}", fill="white", font=FONT_1) + + if data.auto_random: + draw.rectangle( + ( + 67, 7, + 67 + + int( + 53 + * mod(data.beats, data.auto_random_cycle) + / data.auto_random_cycle + ), + 10, + ), + fill="white", + width=0, + ) + else: + draw.rectangle( + (67, 7, 67 + int(53 * data.time_progress), 10), fill="white", width=0 + ) # page draw.circle((55 + 8 * data.page, 61), 2, fill="white") diff --git a/src/forge_invar/tools/gen_img.py b/src/forge_invar/tools/gen_img.py index e27487f..6348525 100644 --- a/src/forge_invar/tools/gen_img.py +++ b/src/forge_invar/tools/gen_img.py @@ -33,7 +33,6 @@ def generate_background_image() -> None: draw.rectangle((6, 6, 60, 11), outline="white", fill="black") # time - draw.text((68, -2), "TIME:", fill="white", font=FONT_1) draw.rectangle((67, 6, 121, 11), outline="white", fill="black") # pipes