Add backspace

This commit is contained in:
Able 2024-11-05 22:16:08 -06:00
parent aafe047b51
commit 85e63eb51c

View file

@ -39,7 +39,6 @@ example := fn(): void {
color := render.white color := render.white
prev_input := 250 prev_input := 250
loop { loop {
input := memory.inb(96) input := memory.inb(96)
if input != prev_input { if input != prev_input {
@ -59,13 +58,20 @@ example := fn(): void {
color = render.blue color = render.blue
} else if char == 0x77 { } else if char == 0x77 {
color = render.white color = render.white
} else if char == 0xE {
cursor -= 1;
*cursor = 32
continue
}; };
*cursor = char *cursor = char
cursor += 1 cursor += 1
} }
} }
render.clear(screen, render.black) render.clear(screen, render.black)
render.put_rect(screen, .(0, 0), .(screen.width - 1, screen.height - 1), render.white)
render.put_text(screen, font, .(0, 0), color, buf) render.put_text(screen, font, .(0, 0), color, buf)
render.sync(screen) render.sync(screen)
} }
@ -99,6 +105,8 @@ map_keys := fn(inp: u8): u8 {
return 0x2D return 0x2D
} else if inp == 0xD { } else if inp == 0xD {
return 0x3D return 0x3D
} else if inp == 0xE {
return 0xE
} else if inp == 0x1C { } else if inp == 0x1C {
return 0xA return 0xA
} else if inp == 0x10 { } else if inp == 0x10 {