{"id":17158209,"url":"https://github.com/msoap/tcg","last_synced_at":"2025-04-06T06:08:56.006Z","repository":{"id":43710521,"uuid":"164485634","full_name":"msoap/tcg","owner":"msoap","description":"Terminal cell graphics library","archived":false,"fork":false,"pushed_at":"2025-02-23T22:07:11.000Z","size":268,"stargazers_count":113,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T04:11:09.580Z","etag":null,"topics":["1bit","ascii-art","game","golang","golang-library","graphics","pixel-art","terminal","terminal-graphics"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/msoap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-07T19:55:53.000Z","updated_at":"2025-02-23T22:07:15.000Z","dependencies_parsed_at":"2023-11-26T17:25:07.419Z","dependency_job_id":"77c37742-ee9b-4ac5-bb31-17b02813add4","html_url":"https://github.com/msoap/tcg","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msoap%2Ftcg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msoap%2Ftcg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msoap%2Ftcg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msoap%2Ftcg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msoap","download_url":"https://codeload.github.com/msoap/tcg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247441052,"owners_count":20939239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["1bit","ascii-art","game","golang","golang-library","graphics","pixel-art","terminal","terminal-graphics"],"created_at":"2024-10-14T22:10:51.074Z","updated_at":"2025-04-06T06:08:55.976Z","avatar_url":"https://github.com/msoap.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Reference](https://pkg.go.dev/badge/github.com/msoap/tcg.svg)](https://pkg.go.dev/github.com/msoap/tcg)\n[![GitHub Action](https://github.com/msoap/tcg/actions/workflows/go.yml/badge.svg)](https://github.com/msoap/tcg/actions/workflows/go.yml)\n[![Coverage Status](https://coveralls.io/repos/github/msoap/tcg/badge.svg?branch=master)](https://coveralls.io/github/msoap/tcg?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/msoap/tcg)](https://goreportcard.com/report/github.com/msoap/tcg)\n\n# TCG - terminal cell graphics\n\nGo 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 Iosevka font or some terminals (like default on Ubuntu).\n\n## Features\n\n  * Available 5 [graphics modes](https://pkg.go.dev/github.com/msoap/tcg#PixelMode), from 2x3 pixels grid for terminal symbol to 1x1, 1x2 and 2x2, or you can [create](https://pkg.go.dev/github.com/msoap/tcg#NewPixelMode) own custom mode with your graphics\n  * [Set](https://pkg.go.dev/github.com/msoap/tcg#Buffer.Set)/[get](https://pkg.go.dev/github.com/msoap/tcg#Buffer.At) one pixel\n  * Drawings: [lines](https://pkg.go.dev/github.com/msoap/tcg#Buffer.Line) (vertical, horizontal, or with any angle), [boxes](https://pkg.go.dev/github.com/msoap/tcg#Buffer.Rect), [circles](https://pkg.go.dev/github.com/msoap/tcg#Buffer.Circle), [arcs](https://pkg.go.dev/github.com/msoap/tcg#Buffer.Arc)\n  * [Fill](https://pkg.go.dev/github.com/msoap/tcg#Buffer.Fill) area with a different [options](https://pkg.go.dev/github.com/msoap/tcg#FillOpt), for example fill with [patterns](https://pkg.go.dev/github.com/msoap/tcg#WithPattern)\n  * Buffer manipulating: [cut](https://pkg.go.dev/github.com/msoap/tcg#Buffer.Cut), [clone](https://pkg.go.dev/github.com/msoap/tcg#Buffer.Clone), convert to/from stdlib [Image](https://pkg.go.dev/github.com/msoap/tcg#Buffer.ToImage) or text\n  * Buffer transform: [BitBlt](https://pkg.go.dev/github.com/msoap/tcg#Buffer.BitBlt) with [options](https://pkg.go.dev/github.com/msoap/tcg#BitBltOpt), [clear](https://pkg.go.dev/github.com/msoap/tcg#Buffer.Clear), [flip](https://pkg.go.dev/github.com/msoap/tcg#Buffer.HFlip), [invert](https://pkg.go.dev/github.com/msoap/tcg#Buffer.Invert), scroll ([vertical](https://pkg.go.dev/github.com/msoap/tcg#Buffer.VScroll), [horizontal](https://pkg.go.dev/github.com/msoap/tcg#Buffer.HScroll))\n  * Sub-package for [turtle graphics](https://pkg.go.dev/github.com/msoap/tcg/turtle), also available [drawing](https://pkg.go.dev/github.com/msoap/tcg/turtle#Turtle.DrawScript) by text script\n  * [Sprite](https://pkg.go.dev/github.com/msoap/tcg/sprite) support with [Put](https://pkg.go.dev/github.com/msoap/tcg/sprite#Sprite.Put), [Withdraw](https://pkg.go.dev/github.com/msoap/tcg/sprite#Sprite.Withdraw), [Move](https://pkg.go.dev/github.com/msoap/tcg/sprite#Sprite.Move), etc methods\n\n## Install\n\n    go get github.com/msoap/tcg\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/gdamore/tcell/v2\"\n\t\"github.com/msoap/tcg\"\n)\n\nfunc main() {\n\ttg, err := tcg.New(tcg.Mode2x3) // each terminal symbol contains a 2x3 pixels grid, also you can use 1x1, 1x2, and 2x2 modes\n\tif err != nil {\n\t\tlog.Fatalf(\"create tcg: %s\", err)\n\t}\n\n\ti := 0\n\tfor {\n\t\tpixColor := tg.Buf.At(10, 10)      // get color of pixel\n\t\ttg.Buf.Set(11, 11, pixColor)       // draw one pixel with color from 10,10\n\t\ttg.Buf.Line(0, 0, i, i, tcg.Black) // draw a diagonal line\n\t\ttg.Show()                          // synchronize buffer with screen\n\n\t\tif tg.TCellScreen.HasPendingEvent() {\n\t\t\tif ev, ok := tg.TCellScreen.PollEvent().(*tcell.EventKey); ok \u0026\u0026 ev.Rune() == 'q' {\n\t\t\t\tbreak // exit by 'q' key\n\t\t\t}\n\t\t}\n\t\ti++\n\t\ttime.Sleep(time.Second)\n\t}\n\n\ttg.Finish() // finish application and restore screen\n}\n```\n\nSee more examples in [examples](https://github.com/msoap/tcg/tree/master/examples) folder.\n\n## Screenshot\n\n[Game of Life](https://github.com/msoap/tcg/tree/master/examples/game_of_life) example in iTerm2 terminal:\n\n\u003cimg width=\"826\" alt=\"TCG library example screenshot for Game of Life\" src=\"https://user-images.githubusercontent.com/844117/226143976-4db0f377-0195-4c8d-8dea-799eee29d9ce.png\"\u003e\n\nSee more [screenshots](https://github.com/msoap/tcg/wiki/Screenshots).\n\n## TODO\n\n  * [ ] fonts support\n  * [x] sprites\n  * [ ] animation in sprite\n\n## See also\n\n  * Go terminal library - [github.com/gdamore/tcell](https://github.com/gdamore/tcell/)\n  * [Turtle graphics](https://en.wikipedia.org/wiki/Turtle_graphics)\n  * Try it in the Go [Playground](https://go.dev/play/p/uwvG0vxRtHJ)\n\nUnicode symbols:\n\n  * Block Elements - [wikipedia](https://en.wikipedia.org/wiki/Block_Elements)\n  * Block Elements - [unicode.org](https://www.unicode.org/charts/PDF/U2580.pdf)\n  * Symbols for Legacy Computing - [wikipedia](https://en.wikipedia.org/wiki/Symbols_for_Legacy_Computing)\n  * Symbols for Legacy Computing - [unicode.org](http://unicode.org/charts/PDF/U1FB00.pdf)\n\nSupported fonts (for \"2x3\" mode):\n\n  * [Iosevka font](https://github.com/be5invis/Iosevka)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsoap%2Ftcg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsoap%2Ftcg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsoap%2Ftcg/lists"}