mirror of
https://github.com/exoticorn/microw8.git
synced 2026-01-20 19:26:43 +01:00
add graphicsText mode and finish font_palette example
This commit is contained in:
@@ -5,24 +5,38 @@ import "env.printString" fn printString(i32);
|
||||
import "env.printChar" fn printChar(i32);
|
||||
import "env.setCursorPosition" fn setCursor(i32, i32);
|
||||
import "env.setTextColor" fn setTextColor(i32);
|
||||
import "env.line" fn line(f32, f32, f32, f32, i32);
|
||||
import "env.isButtonTriggered" fn triggered(i32) -> i32;
|
||||
|
||||
global mut mode: i32 = 0;
|
||||
|
||||
export fn upd() {
|
||||
cls(0);
|
||||
|
||||
printString(0);
|
||||
if triggered(4) {
|
||||
mode = !mode;
|
||||
}
|
||||
|
||||
setTextColor(15);
|
||||
printString(mode * 0x20000);
|
||||
|
||||
let y: i32;
|
||||
loop y {
|
||||
setCursor(y + 2, 3);
|
||||
line(0 as f32, (y * 9 + 39) as f32, (14+16*9) as f32, (y * 9 + 39) as f32, 1);
|
||||
line((y * 9 + 15) as f32, 24 as f32, (y * 9 + 15) as f32, (38+16*9) as f32, 1);
|
||||
setTextColor(15);
|
||||
setCursor(y * 9 + 16, 24);
|
||||
let lazy hexChar = select(y < 10, y + 48, y + 87);
|
||||
printChar(hexChar);
|
||||
setCursor(0, y + 5);
|
||||
setCursor(0, y * 9 + 24+16);
|
||||
printChar(hexChar);
|
||||
printChar(32);
|
||||
let x = 0;
|
||||
loop x {
|
||||
// setTextColor(x + y * 16);
|
||||
printChar(x + y * 16);
|
||||
setCursor(x * 9 + 16, y * 9 + 24+16);
|
||||
setTextColor(select(mode, x + y * 16, -9));
|
||||
if y >= 2 | mode {
|
||||
printChar(select(mode, 0xa4, x + y * 16));
|
||||
}
|
||||
branch_if (x := x + 1) < 16: x;
|
||||
}
|
||||
branch_if (y := y + 1) < 16: y;
|
||||
@@ -30,5 +44,9 @@ export fn upd() {
|
||||
}
|
||||
|
||||
data 0 {
|
||||
"Default font:" i8(0)
|
||||
"Default font: (press " i8(0xcc) " for palette)" i8(5, 0)
|
||||
}
|
||||
|
||||
data 0x20000 {
|
||||
"Default palette: (press " i8(0xcc) " for font)" i8(5, 0)
|
||||
}
|
||||
Reference in New Issue
Block a user