add palette support (default is still greyscale for now)

This commit is contained in:
2021-11-13 22:29:20 +01:00
parent 944856b267
commit 294b9f5634
6 changed files with 49 additions and 17 deletions

View File

@@ -26,15 +26,15 @@ export fn randomSeed(s: i32) {
}
export fn fmod(a: f32, b: f32) -> f32 {
let lazy t = a / b;
(t - floor(t)) * b
a - floor(a / b) * b
}
export fn cls(col: i32) {
let i: i32;
col = (col & 255) * 0x1010101;
loop pixels {
i?120 = col;
branch_if (i := i + 1) < 320*256: pixels;
i!120 = col;
branch_if (i := i + 4) < 320*256: pixels;
}
}
@@ -106,3 +106,11 @@ export fn circle(cx: f32, cy: f32, radius: f32, col: i32) {
}
}
}
start fn setup() {
let i: i32;
loop colors {
(i*4)!(120+320*256) = i * 0x10101;
branch_if (i := i + 1) < 256: colors
}
}