From 946ed8d2dbae117d17e31587cf6b152a6a352e5a Mon Sep 17 00:00:00 2001
From: Stephen D <webmaster@scd31.com>
Date: Fri, 21 Feb 2025 17:58:53 -0500
Subject: [PATCH] working

---
 build.rs            |  12 +++++++++---
 src/assets/cat.png  | Bin 737 -> 4514 bytes
 src/assets/meow.png | Bin 0 -> 4805 bytes
 src/lib.rs          |  31 ++++++++++++++++++++++++++-----
 4 files changed, 35 insertions(+), 8 deletions(-)
 create mode 100644 src/assets/meow.png

diff --git a/build.rs b/build.rs
index 2e1c2ff..56ecea4 100644
--- a/build.rs
+++ b/build.rs
@@ -5,10 +5,16 @@ use image::{GenericImageView, ImageReader};
 
 // Example custom build script.
 fn main() {
-    println!("cargo::rerun-if-changed=assets/*");
     println!("cargo::rerun-if-changed=build.rs");
 
-    let img = ImageReader::open("src/assets/cat.png")
+    handle_image("cat");
+    handle_image("meow");
+}
+
+fn handle_image(name: &str) {
+    println!("cargo::rerun-if-changed=src/assets/{name}.png");
+
+    let img = ImageReader::open(format!("src/assets/{name}.png"))
         .unwrap()
         .decode()
         .unwrap();
@@ -33,6 +39,6 @@ fn main() {
 
     let out_dir = env::var("OUT_DIR").unwrap();
 
-    let mut f = File::create(Path::new(&out_dir).join("cat.bin")).unwrap();
+    let mut f = File::create(Path::new(&out_dir).join(format!("{name}.bin"))).unwrap();
     f.write_all(&out.as_raw_slice()).unwrap();
 }
diff --git a/src/assets/cat.png b/src/assets/cat.png
index dbbbd271807ea0af13e2abc7b871f5a3fe618df8..3a6bea0ee6d2dbd8c938d53795e3e7a7845379a7 100644
GIT binary patch
literal 4514
zcmeHLeNa@_6@R-z_^?p4BGFLYc}`H#x9?-WpSuXzU0_ESP*%Z7+WPjryYOVc*nO}I
zu@RhV&`=vmB%08sX?04&BsF$YVyF!?C~e2av?i7|)zC?s)TF7loiU=e^t`vrSIkU@
zndU#<&gGtW?m54E?(d#^*t-X+D$24lmuF%amgOpUY=wR&w1V_|;O~ZG-*I7>Y6+@!
z`CP6-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jp~Kq)y-)rgT2`>RMPi~`q28-dsmF^zv1h@_))QH@7wzqCqm0F`NZ@3mnS0I
UQ2P~AB?gbnS>br`ft`E*3-3e!WdHyG

delta 660
zcmV;F0&D%EBjE**8Gix*006Z62_66d0fT8nLr_UWLm+T+Z)Rz1WdHyuk$sUpNW(xJ
z#a~mUA{7TKh;+zMo$TNT;;2<9LWNK(wCZ4T=@&F<NK#xJ1=oUuAB$B77iV1^Tm?b!
z1H@f$Qgo3L|Cbb6#CUMrk9YSTckck9QDK_ZH4A9EZKjh6F@Kv|6+^EOFo+1o5tW%`
z%t=xTzT@j20lwbFd6xgVKS!UMw-^u*iD#K%+Qb{g)0?)zd7n7KO0r6PPCRDP1&JTI
zu6X>$x#+UMGb3guJx?4V7K<IMbTBKK8u1iyOx1MC7qT9!oVPe@l^Sc^lfN*W*H@Og
zPBV%m7O?~gB7YRrP(}qd;<W0dSV+@;!pA@C`XzEH<SK)aV*yoYkX=9cAN=mtDojpz
zN#O+0{o*(uBS2^uXx1I)``B@sCqVESxYFDHY6F=0B)#6&Vn;y#HgIv>)|5Tqat9cC
zGGtSBr65hAPypV~=$mrDz%9_b=JnRv$LRx*p{`Olz#73JFj}PSb)R?lboTb|nO1*4
z%nEYK9SMZ{lV=bi2NX6F_7%?{laCN6f6PflK~!ko?byo>gCG!v;U2^Lzw&fp(ikch
zVba9IKRXwa@HrPy5%D70u|WV(9+0H5RU}pK4liY!K@ssmk#u~t0-D^_cPc$SN-GNn
zXpRHXv&5=R-Yv0<N0SW7?Xr75K3%G`XgW7`;pkCiCyit5o1bzR6k5sMlHbK;VoT}J
zmNZ;7=BC(KV+N>h<THKUt;F_ggzJH@D}#R4&Vql}O3(4v;6R)J#J^X@JU{>e1kegV
uOU*km-6=7E00IagfB*uB00<y}{vL1Tt5;tjEa}+*0000<MNUMnLSTY>Nh`Pj

diff --git a/src/assets/meow.png b/src/assets/meow.png
new file mode 100644
index 0000000000000000000000000000000000000000..b2f6a40efaa154c56adf842040100db2784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=eq9sVTx8IdxE}5*<#v
z>SN`s*;MvGNhS|fb3}WESRi<%2M^?de-&15OU;0PDr7ipdF54q{G?@FYCoE2SAF!~
zpTE6DN80wSeQfLB|I%a7zn75FG*f%85+vvTGbPt%vsvGN$79`sqcb~iJoaSh%Qa^i
z_rV+7xt`h2n~wKUcY3v!BagJ7>ifV_GrMhi-YMIQul4&HYa1>+k=wQS3iGcc?}ky;
zi`N^bztHpEvDJfF8$WwA$Mo@qr#HT|vK<|;T9rSIH07+%oOb2-7Xz;}-&!!Tqq*_z
z;>IC_zPx09!=*)t;@v}v=HU;KzV4Rct9W~G*`Mprkq_^3ItS<e72Qy$ioCw~g4gPQ
zmd!m?^kwtm_Ycs&%e!>xo$6yP>-H`w+Bdwfs<5~4)t-Y&eaF$e?S&_<y;+ujtT8{W
f9!ZS7D?9Hh*tDK-SGfH$<PmY$OKh*^S3dVY*i2)s

literal 0
HcmV?d00001

diff --git a/src/lib.rs b/src/lib.rs
index f742757..ada07ff 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,7 +1,7 @@
 use bitvec::{order::Msb0, view::BitView};
 
-const WIDTH: usize = 96;
-//const HEIGHT: usize = 38;
+const WIDTH: i32 = 96;
+const HEIGHT: i32 = 38;
 
 #[no_mangle]
 pub extern "C" fn next_frame(frame: u16, ptr: *mut u8) -> u8 {
@@ -12,19 +12,40 @@ pub extern "C" fn next_frame(frame: u16, ptr: *mut u8) -> u8 {
     }
 
     let cat = include_bytes!(concat!(env!("OUT_DIR"), "/cat.bin")).view_bits::<Msb0>();
+    let meow = include_bytes!(concat!(env!("OUT_DIR"), "/meow.bin")).view_bits::<Msb0>();
+
+    let thres = WIDTH / 4;
+
+    let dx = (frame as i32 * 4 - thres).min(thres);
 
     for x in 0..96 {
         for y in 0..38 {
             let out_idx = index(x, y);
-            let in_idx = index((x - frame as usize * 4) % WIDTH, y);
+            let in_idx = index(x - dx, y);
 
             out.set(out_idx, cat[in_idx]);
         }
     }
 
+    if dx == thres && frame / 7 % 2 == 0 {
+        // make meow flash on and off every 4 frames for the remaining time
+
+        for x in 0..96 {
+            for y in 0..38 {
+                let idx = index(x, y);
+
+                out.set(idx, meow[idx] || out[idx]);
+            }
+        }
+    }
+
     0
 }
 
-fn index(x: usize, y: usize) -> usize {
-    x + y * WIDTH
+fn index(x: i32, y: i32) -> usize {
+    if x < 0 || y < 0 || x >= WIDTH || y >= HEIGHT {
+        return 0;
+    }
+
+    x as usize + y as usize * WIDTH as usize
 }
-- 
GitLab