This commit is contained in:
andromeda
2026-01-17 10:55:18 +01:00
parent e901adf934
commit c42ea43099
3 changed files with 24 additions and 2 deletions

7
Cargo.lock generated
View File

@@ -431,6 +431,7 @@ dependencies = [
"minifb",
"nix 0.30.1",
"vte",
"zeno",
]
[[package]]
@@ -794,6 +795,12 @@ version = "0.8.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ae8337f8a065cfc972643663ea4279e04e7256de865aa66fe25cec5fb912d3f"
[[package]]
name = "zeno"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524"
[[package]]
name = "zmij"
version = "1.0.14"

View File

@@ -7,3 +7,4 @@ edition = "2024"
minifb = "0.28.0"
nix = {default-features = false, features=["term","process","fs"], version="0.30.1"}
vte = "0.15.0"
zeno = "0.3.3"

View File

@@ -9,6 +9,8 @@ use std::ffi::CString;
use vte::{Params, Parser, Perform};
use zeno::{Join, Mask, Stroke};
// window stuff
const WIDTH: usize = 640;
const HEIGHT: usize = 360;
@@ -79,9 +81,21 @@ fn main() {
let mut buf = [0u8; 2048];
while window.is_open() && !window.is_key_down(Key::Escape) {
let mask = Mask::new("M 8,56 32,8 56,56 Z")
.size(WIDTH.try_into().unwrap(), HEIGHT.try_into().unwrap())
.style(Stroke::new(8.0).join(Join::Round))
.render()
.0;
// windowing stuff
for i in buffer.iter_mut() {
*i = 0;
for (p, a) in buffer.iter_mut().zip(mask.iter()) {
let a0 = *a as u32;
*p = a0 << 24 | 0x00FF0000;
*p =
if a0 > 0
{ a0 << 16 | a0 << 8 | a0 }
else { 0x00000000 };
}
let keys = window.get_keys_pressed(KeyRepeat::No);
window.update_with_buffer(&buffer, WIDTH, HEIGHT).unwrap();