1
0
Fork 0
forked from AbleOS/ableos

adit docs + cleanup

This commit is contained in:
Able 2025-02-17 17:08:59 -06:00
parent dac9e4d3f8
commit a30802d1a3
3 changed files with 24 additions and 8 deletions
sysdata/programs/adit/src

View file

@ -2,6 +2,8 @@ theme := @use("theme.hb")
render := @use("lib:render")
sunset := @use("lib:sunset_proto")
assets := @use("assets.hb")
stn := @use("stn")
Editor := struct {
msg: ?^u8,
@ -22,7 +24,7 @@ Editor := struct {
window_height := 400
window := sunset.client.new(.(.(60, 40), .(window_width, window_height), "Adit"))
if window == null {
// log.error("got no window")
stn.log.error("got no window")
die
}
return Self.(null, assets.Assets.new() true, .(.(0x88, 0xF4, 0xFC, 0x0), render.YELLOW, render.BLACK, 10), window)
@ -52,8 +54,16 @@ Editor := struct {
}
}
frame_render := fn(self: Self): void {
// TODO: Render text here with a loop to iterate through Ropes.
if self.line_lines self.theme_render()
}
handle_input := fn(self: Self): void {
// input := memory.inb(96)
}
map_keys := fn(scancode: u8): u8 {
// if is_shift_pressed {

View file

@ -56,16 +56,15 @@ main := fn(): void {
loop {
// +++ Clear +++
editor.clear()
// editor.clear()
// +++ Input +++
input := memory.inb(96)
editor.handle_input()
// +++ RENDER +++
if editor.line_lines editor.theme_render()
// window.surface.clear(bg_color)
editor.frame_render()
// if editor.line_lines editor.theme_render()
editor.frame_sync()
}
}

View file

@ -1,3 +1,10 @@
/*! A Rope is a very special data structure
that can quickly append split and represent a single editors line worth of text.
Inspo:
- https://github.com/kavirajk/rope
*/
Node := struct {
weight: uint,
left: ?^Leaf,