old_school 0.1.0 copy "old_school: ^0.1.0" to clipboard
old_school: ^0.1.0 copied to clipboard

Add old-school terminals to your html documents.

example/example.md

Example #

Hello, world #

import 'dart:html';
import 'package:old_school/old_school.dart';

main() async {
  final terminal = Terminal(
    rows: 25,
    columns: 40,
    container: document.getElementById("hello")!,
  );
  terminal.output("Hello, world!");
  final response = await terminal.input(
    prompt: "What is your name? ",
    length: 20,
  );
  terminal.output("Hello, $response!");
}

[A terminal running hello, world!]

Smile #

import 'dart:html';
import 'package:old_school/old_school.dart';

main() async {
  final terminal = Terminal(
        rows: 20,
        columns: 20,
        container: document.getElementById("smile")!,
        rowGap: 0,
      ),
      smile = [ // In binary:
        0x07E0, // .....******.....
        0x1818, // ...**......**...
        0x2004, // ..*..........*..
        0x4002, // .*............*.
        0x4002, // .*............*.
        0x8811, // *...*......*...*
        0x8811, // *...*......*...*
        0x8001, // *..............*
        0x8001, // *..............*
        0x8FF1, // *...********...*
        0x8FF1, // *...********...*
        0x47E2, // .*...******...*.
        0x43C2, // .*....****....*.
        0x2004, // ..*..........*..
        0x1818, // ...**......**...
        0x07E0, // .....******.....
      ];
  for (var i = 0; i < 100; i += 2) {
    final color = ["pink", "skyblue", "yellow"][i % 3],
        pixelRow = (i ~/ 10) * 16,
        pixelColumn = (i % 10 + (i % 4) ~/ 2) * 16;
    terminal.screen.poke16Bit(
      position: (pixelRow, pixelColumn),
      data: smile,
      color: color,
    );
  }
}

[A bunch of smiling faces.]

Demos #

To see Old School in action, take a look at these demos.

1
likes
0
points
260
downloads

Publisher

unverified uploader

Weekly Downloads

Add old-school terminals to your html documents.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on old_school