TCG - terminal cell graphics library

Overview

Go Reference GitHub Action Coverage Status Go Report Card

TCG - terminal cell graphics

Go Graphics library for use in a text terminal. Only 1bit graphics can be used with two colors. Used unicode block symbols for drawing. 2x3 mode is supported by the latest versions of the Iosevka font.

Features

Install

go get -u github.com/msoap/tcg

Usage

package main

import (
	"log"

	"github.com/gdamore/tcell/v2"
	"github.com/msoap/tcg"
)

func main() {
	tg, err := tcg.New(tcg.Mode2x3) // each terminal symbol contains a 2x3 pixels grid, also you can use 1x1, 1x2, and 2x2 modes
	if err != nil {
		log.Fatalf("create tg: %s", err)
	}

	i := 0
	for {
		pixColor := tg.Buf.At(10, 10)       // get color of pixel
		tg.Buf.Set(11, 11, pixColor)        // draw one pixel with color from 10,10
		tg.Buf.Line(0, 0, 50, i, tcg.Black) // draw a diagonal line
		tg.Show()                           // synchronize buffer with screen

		if ev, ok := tg.TCellScreen.PollEvent().(*tcell.EventKey); ok && ev.Rune() == 'q' {
			break // exit by 'q' key
		}
		i++
	}

	tg.Finish() // finish application and restore screen
}

See more examples in examples folder.

Screenshot

Game of Life example in iTerm2 terminal with Iosevka font:

TCG example screenshot for Game of Life

TODO

  • fonts support
  • sprites, maybe with animation

See also

Unicode symbols:

Supported fonts:

Issues
  • Added support for custom pixel to rune mapping

    Added support for custom pixel to rune mapping

    I have added the support for the pixel to rune mapping. I should have covered all the cases but, please, have a look if I missed anything and let me know so I will cover it.

    opened by ganglio 2
  • Allow user customisation of the the Box Chars

    Allow user customisation of the the Box Chars

    It would be brilliant to allow custom modes where the user can specify the Box Chars. It could allow weird/creative behaviours with minimal change in the final code. I might follow up with a pull request. Stay tuned :D

    (Thanks for the brilliant work, BTW).

    enhancement 
    opened by ganglio 5
Releases(v0.0.2)
Owner
Serhii Mudryk
Serhii Mudryk
Battleblips - Work in progress multiplayer terminal base battleship game written in Go (with mouse support!) using tcell library

battleblips Work in progress multiplayer terminal base battleship game written in Go (with mouse support!) using tcell library (see https://github.com

null 1 Apr 26, 2022
Terminal-based game engine for Go, built on top of Termbox

Termloop Termloop is a pure Go game engine for the terminal, built on top of the excellent Termbox. It provides a simple render loop for building game

Joel Auterson 1.3k Jun 17, 2022
♛♔ Play chess against UCI engines in your terminal.

uchess ♛♔ Play chess in your terminal. Introduction uchess is an interactive terminal chess client designed to allow gameplay and move analysis in con

Travis Whitton 44 Jun 12, 2022
🕹️ A basic gameboy emulator with terminal "Cloud Gaming" support

Gameboy.Live ??️ Gameboy.Live is a Gameboy emulator written in go for learning purposes. You can simply play Gameboy games on your desktop: Or, "Cloud

AaronLiu 4.3k Jun 20, 2022
Play chess in your terminal

Gambit Chess board in your terminal. Warning gambit does not have many features at the moment. I plan on adding a chess engine, mouse support, timers,

Maas Lalani 388 Jun 24, 2022
A simple terminal game lol

sc a shitty game lol if you want to play it run: git clone https://github.com/pa

pai 5 Mar 18, 2022
MagicSummon - A Terminal Game about Mixing Stuff to summon a MONSTER. Currently The Biggest Project I have worked on.

MagicSummon A Terminal Game about Mixing Stuff to summon a MONSTER that the warriors ALMOST defeated, but the MONSTER fled. Getting Started Clone the

Boat 1 Jan 6, 2022
A terminal Snake game that supports multiple players to play together online.

GoSnake A Snake game that supports multiple players to play together online. The game is written in go language and does not use other third-party lib

StevE Zhang 2 Jun 25, 2022
A dead simple 2D game library for Go

Ebiten (v2) A dead simple 2D game library for Go Ebiten is an open source game library for the Go programming language. Ebiten's simple API allows you

Hajime Hoshi 6.6k Jun 21, 2022
A hand-crafted 2D game library in Go

Pixel A hand-crafted 2D game library in Go. Take a look into the features to see what it can do. go get github.com/faiface/pixel If you are using Mod

Michal Štrba 4k Jun 28, 2022
Go bindings for raylib, a simple and easy-to-use library to enjoy videogames programming.

raylib-go Golang bindings for raylib, a simple and easy-to-use library to enjoy videogames programming. Requirements Ubuntu X11 apt-get install libgl1

Milan Nikolic 810 Jun 22, 2022
Helper library to transform TMX tile maps into a simpler format for Ebiten

Ebitmx Ebitmx is a super simple parser to help render TMX maps when using Ebiten for your games. Right now is super limited to XML and CSV data struct

Raúl 19 Jun 16, 2022
A simple Go library for 3D ray-tracing rendering, implementing the book Ray Tracing in One Weekend.

Ray Tracing in Go A Go implementation of the book Ray Tracing in One Weekend. The repository provides a library to describe and render your own scenes

Yuto Takahashi 55 Feb 2, 2022
build and animate objects according to verlet physics. pure golang library

verlet build and animate objects according to verlet physics. pure golang library Examples depend on pixel library, see requirements to build them: wo

Paolo Calao 23 Jun 1, 2022
Rock-paper-scissors game library

jankensheep Rock-paper-scissors game library Examples Play with two players:

Genta Kamitani 6 May 13, 2022
Golang writen 3D render library and some game-relative concepts

Golang writen 3D render library and some game-relative concepts.

null 2 Jun 6, 2022
A simple game that I created with Ebiten game library as a way to teach myself Go. Enjoy!

galactic-asteroid-belt Overview A simple game that I created with Ebiten game library as a way to teach myself Go. Enjoy! Run To run, you will need Go

null 0 Dec 2, 2021
Golang library for connecting to EOSIO SHIP

go-eosio-ship go-eosio-ship is a golang library built on top of go-eosio for con

null 0 Jan 3, 2022
Donburi is just another Entity Component System library for Ebiten inspired by legion.

Donburi Donburi is just another Entity Component System library for Ebiten inspired by legion. It aims to be a feature rich and high performance ECS L

yohamta 19 Jun 18, 2022