GitXplorerGitXplorer
m

griddle

public
24 stars
6 forks
1 issues

Commits

List of commits on branch main.
Verified
c304b8cde7557dce3f1d2d6fe9cd8ef3e56e2388

Major rework for v0.3.0 that greatly simplifies the API and hits 100% test coverage (#9)

mmatanlurey committed 2 years ago
Verified
09db67160d3992c754f9bcfe917cfa528857de9d

Significant update for v0.2.0. (#7)

mmatanlurey committed 2 years ago
Unverified
c31ce40db3c7299e295318d045e548fc9ef3af9c

Upgrade dependencies.

mmatanlurey committed 2 years ago
Unverified
9e1bf6d3bb3e59179c0b5aa72c73b93c7731ab35

Tweak README again.

mmatanlurey committed 2 years ago
Unverified
fb0d893415672beb221b59039c69874ca1275eb1

Update README.

mmatanlurey committed 2 years ago
Unverified
69c5af99c49b1475dfc85a38c88f38ffa53710a5

Tweak description.

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.