Skip to content

Instantly share code, notes, and snippets.

@peterhellberg
Created November 11, 2023 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterhellberg/e56ca1373f3fdf18a54733263196e0ab to your computer and use it in GitHub Desktop.
Save peterhellberg/e56ca1373f3fdf18a54733263196e0ab to your computer and use it in GitHub Desktop.
const math = @import("std").math;
const tic = @import("tic80.zig");
export fn BDR(row: i32) void {
const urow: u8 = @intCast(row);
{ // skygradient
scanline(0x42, 0xFF -| urow, 0x99 +| urow);
}
{ // screen wave
if (row < 90) {
tic.poke(0x3ff9, 0);
} else {
tic.poke(0x3ff9, @intFromFloat(
5 + math.sin(tic.time() / 200 + @as(
f32,
@floatFromInt(row),
) / 5) * 10,
));
}
}
}
fn scanline(r: u8, g: u8, b: u8) void {
tic.poke(0x3fc0, r);
tic.poke(0x3fc1, g);
tic.poke(0x3fc2, b);
}
@peterhellberg
Copy link
Author

Peek.2023-11-11.17-17.webm
Peek.2023-11-11.17-19.webm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment