Ei kuvausta

therealbluepandabear 5efc1498cd Add some `enforce` blocks for safety reasons. 1 vuosi sitten
.idea 5c9208d522 App throws exception if user inputs a hex string in the wrong format. 2 vuotta sitten
source 5efc1498cd Add some `enforce` blocks for safety reasons. 1 vuosi sitten
.gitignore e0297e15f8 Initial commit 2 vuotta sitten
DTui.iml 5c9208d522 App throws exception if user inputs a hex string in the wrong format. 2 vuotta sitten
README.md 3da66a54b0 Create README.md 1 vuosi sitten
dub.json e0297e15f8 Initial commit 2 vuotta sitten

README.md

DTui

🚧 WIP 🚧 Terminal user interface library for D language

About

DTui is a terminal user interface (TUI) library for D language that I am working on in my free time to help better understand D.

Keep in mind:

  1. The library's first version has not been released yet.

  2. Note that I am new to D so this is not a professional project.

  3. Output images are in the IntelliJ IDEA 'Run' window.

Controls

Tree

Construction:

void main() {
  Canvas canvas = new Canvas();

  Tree tree = new Tree(Node("A", Node("B1", Node("C1"), Node("C2")), Node("B2", Node("D1"), Node("D2")), Node("B3", Node("E1"), Node("E2"))));

  canvas.updateCache(tree, Coordinate(0, 0));
  canvas.drawCache();
}

Output:

image

Chart

Construction:

void main() {
  Canvas canvas = new Canvas();

  Chart chart = new Chart(ChartType.column, [1, 4, 9, 2], 3, 1, Color.Red);

  canvas.updateCache(chart, Coordinate(0, 0));
  canvas.drawCache();
}

Output:

image

Rect (with fill)

Construction

void main() {
  Canvas canvas = new Canvas();

  Rect rect = Rect.withFill(Dimensions(20, 10), Color.Orange);

  canvas.updateCache(rect, Coordinate(0, 0));
  canvas.drawCache();
}

Output:

image

Rect (with frame)

Construction

void main() {
  Canvas canvas = new Canvas();

  Rect rect = Rect.withFrame(Dimensions(20, 10), Color.Blue);

  canvas.updateCache(rect, Coordinate(0, 0));
  canvas.drawCache();
}

Output

image

Table

Construction

void main() {
  Canvas canvas = new Canvas();

  Table table = new Table(10, 5);

  canvas.updateCache(table, Coordinate(0, 0));
  canvas.drawCache();
}

Output

image

Label

Construction

void main() {
  Canvas canvas = new Canvas();

  Label label = new Label(Rect.withFill(Dimension.block(30, 11), Color.Black), "Hello World!", Color.Orange);

  canvas.updateCache(label, Coordinate(0, 0));
  canvas.drawCache();
}

Output

image

StackLayout

Construction

void main() {
  Canvas canvas = new Canvas();

  Rect rectr = Rect.withFill(Dimension(10, 10), Color.Blue);
  Rect rectb = Rect.withFill(Dimension(10, 10), Color.Red);

  StackLayout row = new StackLayout(StackLayoutType.row);

  row.add(rectr, rectb, rectr, rectb, rectr);

  canvas.updateCache(row, Coordinate(0, 0));
  canvas.drawCache();
}

Output

image