[asciilib] All surface data

This commit is contained in:
2021-04-24 15:35:25 -06:00
parent 3cebeb1a70
commit 064715939a
8 changed files with 28 additions and 4 deletions

View File

@@ -1,7 +1,6 @@
package asciilib;
import haxe.io.Bytes;
import kiss.Prelude;
typedef Color = {
r:Int,

View File

@@ -6,12 +6,12 @@
:Bytes green (Bytes.alloc area)
:Bytes blue (Bytes.alloc area)]
(unless fillColor (set fillColor Black))
(fill fillColor))
(fill (or fillColor Black)))
(defmethod fill [:Color color]
(red.fill 0 area color.r)
(green.fill 0 area color.g)
(blue.fill 0 area color.b))
(defvar Black (object r 0 g 0 b 0))
(defvar Black (object r 0 g 0 b 0))
(defvar White (object r 255 g 255 b 255))

View File

@@ -0,0 +1,4 @@
package asciilib;
@:build(kiss.Kiss.build("src/asciilib/Grid.kiss"))
class Grid<T> {}

View File

@@ -0,0 +1,4 @@
(defnew [_width _height :T defaultValue]
[:Int width _width
:Int height _height
:Array<Array<T>> rows (for _ (range height) (for _ (range width) defaultValue))])

View File

@@ -0,0 +1,4 @@
package asciilib;
@:build(kiss.Kiss.build("src/asciilib/Letters.kiss"))
class Letters {}

View File

@@ -0,0 +1,4 @@
(defnew [_width _height &opt :String letter]
[:Int width _width
:Int height _height
:Array<String> rows (for _ (range height) (* (or letter " ") width))])

View File

@@ -0,0 +1,8 @@
(defnew [_width _height &opt :Color backgroundColor :String letter :Color letterColor]
[:Int width _width
:Int height _height
:Colors backgroundColors (new Colors width height (or backgroundColor Colors.Black))
:Letters letters (new Letters width height (or letter " "))
:Colors letterColors (new Colors width height (or letterColor Colors.White))
:Grid<Bool> opacity (new Grid width height true)
:Grid<String> specialInfo (new Grid width height "")])

View File

@@ -0,0 +1 @@
import kiss.Prelude;