Creating terminal-based UIs and games in Dart should be accessible and fun!

Overview

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.
You might also like...

💙🔥 FlutterFire commons repository, makes FlutterFire app development faster, easier, and more fun!

💙🔥 FlutterFire commons repository, makes FlutterFire app development faster, easier, and more fun!

Dec 1, 2022

The Health==Wealth app aims to make leading a healthy lifestyle simple, fun and rewarding for students.

The Health==Wealth app aims to make leading a healthy lifestyle simple, fun and rewarding for students. Students can also track and see their progress through the app.

Jun 25, 2022

Wordle It's fun, simple and, like a crossword.

Wordle  It's fun, simple and, like a crossword.

Wordle It's fun, simple and, like a crossword. Getting Started Wordle gives players six chances to guess a randomly selected five-letter word. As show

Nov 28, 2022

Tinder-like class that allows dogs to pair with other dogs as play buddies and have fun(:

Paw-Tindr Tinder-like class that allows dogs to pair with other dogs as play buddies and have fun(: Setting Up Firebase Follow steps mentioned (here)[

Dec 15, 2022

Wired Elements is a series of basic UI Elements that have a hand drawn look. These can be used for wireframes, mockups, or just the fun hand-drawn look.

Wired Elements is a series of basic UI Elements that have a hand drawn look. These can be used for wireframes, mockups, or just the fun hand-drawn look.

wired_elements Wired Elements is a series of basic UI Elements that have a hand drawn look. These can be used for wireframes, mockups, or just the fun

Dec 1, 2022

Make localizing hard-coded strings fun!

Make localizing hard-coded strings fun!

Flutter Localizer IntelliJ Plugin IntelliJ Plugin to ease the process of localizing hard coded strings in Flutter projects Installation The plugin is

Feb 25, 2022

Flutter UI Challenges for fun

Flutter UI Challenges for fun

flutter_fun Just small ui challenges for Fun. Glitch effect experiment IoT Humidity App Slider Design: https://dribbble.com/shots/6315218-IoT-Humidity

Dec 19, 2022

A Random Anime Quotes app I made for fun.

Random Anime Quotes An random anime quote app I made for fun. Powered by Airi Preview ranimequotes.mp4 Features ✅ Like and save locally your favorite

Aug 24, 2022

A fun Snowfall/Rainfall Project with Interactions

snowfall Snowfall Project Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this is yo

Oct 31, 2022
Comments
  • Cells drawn at Y = 0 don't appear on the terminal

    Cells drawn at Y = 0 don't appear on the terminal

    // Doesn't show up without scrolling back:
    screen.print('${DateTime.now().millisecondsSinceEpoch}', 0, 0);
    
    // Does:
    screen.print('${DateTime.now().millisecondsSinceEpoch}', 0, 1);
    
    bug 
    opened by matanlurey 1
  • Optimize <_Screen.update> to minimize ANSI escape code usage

    Optimize <_Screen.update> to minimize ANSI escape code usage

    screen.print('GREEN', 0, 2, foreground: green, background: blue);
    screen.update();
    

    ... leaves output such as:

    \x1B[2J\n
    \x1B[0m \x1B[0m \x1B[0m \x1B[0m \x1B[0m\n
    \x1B[0mH\x1B[0mE\x1B[0mL\x1B[0mL\x1B[0mO\n
          \x1B[38;2;0;255;0m\x1B[48;2;0;0;255mG\x1B[38;2;0;255;0m\x1B[48;2;0;0;255mR\x1B[38;2;0;255;0m\x1B[48;2;0;0;255mE\x1B[38;2;0;255;0m\x1B[48;2;0;0;255mE\x1B[38;2;0;255;0m\x1B[48;2;0;0;255mN\n
    

    This is technically correct (the best kind of correct), but it should be possible to do this in only a tiny handful of escapes.

    enhancement 
    opened by matanlurey 0
Owner
Matan Lurey
Staff Software Engineer / TLM. I only contribute to fun/personal projects on GitHub and not anything related to my work 😎
Matan Lurey
A simple set of terminal-based arcade games written in pure Dart.

dartcade A simple set of terminal-based arcade games written in pure Dart. Purpose I was developing some simple 2D UI libraries (such as package:gridd

Matan Lurey 7 Dec 7, 2022
Socket library for creating real-time multiplayer games. Based on TCP, with the ability to send messages over UDP (planned).

Game socket The library was published in early access and is not stable, as it is being developed in parallel with other solutions. English is not a n

Stanislav 10 Aug 10, 2022
Terminal styling done right - now for Dart!

vscode debug console windows terminal Console/Terminal text coloring and styling library for Dart 'Terminal string styling done right' I created this

Tim Maffett 4 Dec 10, 2022
Beautiful and accessible math in all browsers

MathJax Beautiful math in all browsers MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all

MathJax 9.2k Jan 9, 2023
Speed Share is a highly available file sharing terminal on LAN(local area network) developed by flutter framework.

速享 Language: 中文简体 | English 这是一款完全基于局域网的文件互传终端,速享不使用任何服务器,不使用您的移动流量,不收集任何用户数据,完全的点对点传输。 可以快速共享文本消息,图片或其他文件,文件夹。 适用于局域网中的文件互传,解决 QQ,微信等上传文件会经过服务器的问题,或者

null 477 Dec 31, 2022
Flutter Client for the stability.ai GRPC protocol, should be compatible with grpc.stability.ai and hafriedlander/stable-diffusion-grpcserver

idea2art This is idea2.art, a Flutter client for the stability.ai GRPC API for Stable Diffusion. It's usable both with the cloud-based grpc.stability.

Hamish Friedlander 9 Dec 5, 2022
My flutter (android, ios) UI design examples 🎈 - user profile UIs, food order ui, splashscreen, mask widget usage, settings page ui

Flutter UI Design Examples ?? This repository contains the flutter ui designs I designed while learning. Doctor Appointment App UI Packages in use: fl

Aleyna Eser 23 Nov 14, 2022
Build different UIs for Android, iOS, Web, Desktop, Wear, TV etc without the if/else checks in your widgets.

platform_widget_mixin Plugin to decouple widgets based on various platform properties. Features Build different UIs for Android, iOS, Web, Desktop, We

Rahul Kumar 6 Nov 17, 2022
We created Flappy Bird, a straightforward game based on flutter animation, from scratch using only Dart & Flutter and no third-party games or animation components.

Flappy-Bird Description A ridiculous game created by Flutter, all you have to do is touch the screen to make the bird leap as long as you avoid the ba

hab 15 Dec 25, 2022
Deepak Sharma 149 Dec 10, 2022