aboutsummaryrefslogtreecommitdiff
path: root/kscurses/ui/text_buf.jai
diff options
context:
space:
mode:
authordam <dam@gudinoff>2023-08-17 20:28:47 +0100
committerdam <dam@gudinoff>2023-08-17 20:28:47 +0100
commit709879ee56d31fe543a0ad882713bd4e3d17d2d2 (patch)
tree12a35282bdd0f1f8a2159ade147944c89254db24 /kscurses/ui/text_buf.jai
parentfa1b8ea54646f1a0f3eadef33e3a660b875cc1ff (diff)
downloadtask-time-tracker-709879ee56d31fe543a0ad882713bd4e3d17d2d2.tar.zst
task-time-tracker-709879ee56d31fe543a0ad882713bd4e3d17d2d2.zip
Added kscurses and testing program.
Diffstat (limited to 'kscurses/ui/text_buf.jai')
-rw-r--r--kscurses/ui/text_buf.jai15
1 files changed, 15 insertions, 0 deletions
diff --git a/kscurses/ui/text_buf.jai b/kscurses/ui/text_buf.jai
new file mode 100644
index 0000000..689bb98
--- /dev/null
+++ b/kscurses/ui/text_buf.jai
@@ -0,0 +1,15 @@
+UI_Text_Buf :: struct {
+ #as using base : UI_Elem = .{type = .TEXT_BUF};
+ lines : []string;
+ lines_dynamic : *[]string;
+}
+c_draw_textbuf :: (canvas : *Canvas, ui_elem : *UI_Elem, zone : Ibox2, style : *UI_Style) -> bool {
+ using cast(*UI_Text_Buf) ui_elem;
+
+ lines_to_draw := ifx lines_dynamic then <<lines_dynamic else lines;
+ for l, y : lines_to_draw {
+ if y >= zone.height break;
+ c_draw_line_ascii(canvas, l, zone, .{0, xx y}, style.text.default);
+ }
+ return true;
+}