From 9e128eaad2e1d0643a7a5b58648f057c4ce88ab6 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Mon, 30 Jan 2023 16:06:27 +0100 Subject: [PATCH] added simple list renderer --- src/lib/ui/rendere/List.hx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/lib/ui/rendere/List.hx diff --git a/src/lib/ui/rendere/List.hx b/src/lib/ui/rendere/List.hx new file mode 100644 index 0000000..f0d15be --- /dev/null +++ b/src/lib/ui/rendere/List.hx @@ -0,0 +1,20 @@ +package lib.ui.rendere; + +class List { + public function new() {} + + public function render(list:Array): Canvas { + var canvas = new Canvas(); + for (line in 0...list.length) { + for (char in 0...list[line].length) { + var c = list[line].charAt(char); + canvas.set({x: char, y: line}, { + char: c, + textColor: Color.White, + bg: Color.Black, + }); + } + } + return canvas; + } +}