GitXplorerGitXplorer
m

griddle

public
24 stars
6 forks
1 issues

Commits

List of commits on branch main.
Verified
6f2a8da96770899cf632489fe835836836e35f4e

Add support for show/hideCursor (#15)

mmatanlurey committed 2 years ago
Unverified
42d2509faa48ec06f3bf1328edd97d55696a81d7

Prepare to publish v0.4.

mmatanlurey committed 2 years ago
Unverified
e3099a4d0fc2b1f13a31729fdb5a56fbe6281abf

Fix top-line display in Display.fromAnsiTerminal.

mmatanlurey committed 2 years ago
Verified
c951252c859f1c82d0af369cbac685b779d3c7c8

Add WritableBuffer.fillFrom. (#14)

mmatanlurey committed 2 years ago
Verified
16760382af207c7601cdc3755757f89596ae8a2b

Split buffer interface into readonly/writable. (#13)

mmatanlurey committed 2 years ago
Verified
8a5be1cc63e3bca80b51ff24f56c64d7db6b9f20

Avoid creating unnecessary ANSI escape codes. (#10)

mmatanlurey committed 2 years ago

README

The README file for this repository.

griddle

Griddle simplifies the concept of creating 2D games or UI applications within a 2D-matrix, or grid, which in turn makes it a suitable cross-platform graphics framework for lower fidelity games or apps.

On pub.dev Code coverage Github action status Dartdocs Style guide

It is inspired by:

Purpose

Creating simple 2D programs that run inside a terminal (or terminal emulator) is complicated. The goal of griddle is to abstract a terminal-like screen into a 2D grid of character cells.

Like termpixels, this project makes the terminal more accessible and more fun, but in Dart!

To learn more about griddle, read our design philosophy.

Usage

Example app running

import 'dart:io' show stdout;
import 'dart:math' as math;

import 'package:griddle/griddle.dart';

void main() {
  final screen = Screen.display(Display.fromAnsiTerminal(
    stdout,
    width: () => stdout.terminalColumns,
    height: () => stdout.terminalLines,
  ));

  const string = 'Hello World, from Griddle for Dart!';

  Stream<void>.periodic.listen((_) {
    screen.clear();

    for (var i = 0; i < string.length; i++) {
      final t = DateTime.now().millisecondsSinceEpoch / 1000;
      final f = i / string.length;
      final c = Color.fromHSL(f * 300 + t, 1, 0.5);
      final x = screen.width ~/ 2 - string.length ~/ 2;
      final o = math.sin(t * 3 + f * 5) * 2;
      final y = (screen.height / 2 + o).round();

      screen.print(string[i], x + i, y, foreground: c);
    }

    screen.update();
  });
}

(For the full example, see example/example.dart)

Contributing

This package welcomes new issues and pull requests.

Changes or requests that do not match the following criteria will be rejected:

  1. Common decency as described by the Contributor Covenant.
  2. Making this library brittle.
  3. Adding platform-specific functionality.
  4. A somewhat arbitrary bar of "complexity", everything should be easy to use.