{"id":22545193,"url":"https://github.com/pdevine/go-asciisprite","last_synced_at":"2025-05-07T21:29:21.294Z","repository":{"id":51257630,"uuid":"128996788","full_name":"pdevine/go-asciisprite","owner":"pdevine","description":"Simple ASCII/Unicode Sprite Library for Golang","archived":false,"fork":false,"pushed_at":"2022-04-10T21:00:23.000Z","size":1540,"stargazers_count":72,"open_issues_count":0,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T14:13:20.082Z","etag":null,"topics":["console-framework","game-engine","golang"],"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/pdevine.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}},"created_at":"2018-04-10T21:25:52.000Z","updated_at":"2024-11-21T09:39:40.000Z","dependencies_parsed_at":"2022-09-15T21:01:50.973Z","dependency_job_id":null,"html_url":"https://github.com/pdevine/go-asciisprite","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdevine%2Fgo-asciisprite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdevine%2Fgo-asciisprite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdevine%2Fgo-asciisprite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdevine%2Fgo-asciisprite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pdevine","download_url":"https://codeload.github.com/pdevine/go-asciisprite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252956832,"owners_count":21831386,"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":["console-framework","game-engine","golang"],"created_at":"2024-12-07T14:09:10.119Z","updated_at":"2025-05-07T21:29:21.266Z","avatar_url":"https://github.com/pdevine.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n![Go-Asciisprite Logo](./docs/logo.svg)\n\nA simple golang sprite library for animating ASCII and Unicode art\n\n***What is a sprite?*** A sprite is a two-dimensional object which you can use in videogames and animations.\n\n## Features\n\n\n * Easy to use routines for creating and manipulating text sprites\n\n * Block interpolation for creating unicode \"pixel\" graphics\n\n * Simple ascii \"fonts\" for creating block based text\n\n * Event system for triggering sprite events\n\n\n## Usage\n\n```go\npackage main\n\nimport (\n        \"time\"\n\n        sprite \"github.com/pdevine/go-asciisprite\"\n        tm \"github.com/pdevine/go-asciisprite/termbox\"\n)\n\nvar allSprites sprite.SpriteGroup\nvar Width int\nvar Height int\n\nconst cow_c0 = `\n^__^xxxxxxxxxxxx\n(oo)\\_______\n(__)\\       )\\/\\\nxxxx||----w |xxx\nxxxx||xxxxx||xxx\n`\n\ntype Cow struct {\n\tsprite.BaseSprite\n\tVX int\n\tVY int\n}\n\nfunc NewCow() *Cow {\n\tcow := \u0026Cow{BaseSprite: sprite.BaseSprite{\n\t\tX: 5,\n\t\tY: 5,\n\t\tVisible: true},\n\t\tVX: 1,\n\t\tVY: 1,\n\t}\n\tcow.AddCostume(sprite.NewCostume(cow_c0, 'x'))\n\n\treturn cow\n}\n\nfunc (cow *Cow) Update() {\n\tcow.X += cow.VX\n\tcow.Y += cow.VY\n\tif cow.X \u003c= 0 {\n\t\tcow.VX = 1\n\t} else if cow.X \u003e= (Width-cow.Width) {\n\t\tcow.VX = -1\n\t}\n\tif cow.Y \u003c= 0 {\n\t\tcow.VY = 1\n\t} else if cow.Y \u003e= (Height-cow.Height) {\n\t\tcow.VY = -1\n\t}\n}\n\n\nfunc main() {\n\terr := tm.Init()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer tm.Close()\n\n\tWidth, Height = tm.Size()\n\n\tevent_queue := make(chan tm.Event)\n\tgo func() {\n\t\tfor {\n\t\t\tevent_queue \u003c- tm.PollEvent()\n\t\t}\n\t}()\n\n\tcow := NewCow()\n\tc := sprite.NewCostume(\"Press 'ESC' to quit\", '~')\n\ttext := sprite.NewBaseSprite(Width/2-c.Width/2, Height-2, c)\n\n\tallSprites.Sprites = append(allSprites.Sprites, cow)\n\tallSprites.Sprites = append(allSprites.Sprites, text)\n\nmainloop:\n\tfor {\n\t\ttm.Clear(tm.ColorDefault, tm.ColorDefault)\n\n\t\tselect {\n\t\tcase ev := \u003c-event_queue:\n\t\t\tif ev.Type == tm.EventKey {\n\t\t\t\tif ev.Key == tm.KeyEsc {\n\t\t\t\t\tbreak mainloop\n\t\t\t\t}\n\t\t\t} else if ev.Type == tm.EventResize {\n\t\t\t\tWidth = ev.Width\n\t\t\t\tHeight = ev.Height\n\t\t\t}\n\t\tdefault:\n\t\t\tallSprites.Update()\n\t\t\tallSprites.Render()\n\t\t\ttime.Sleep(60 * time.Millisecond)\n\t\t}\n\t}\n}\n```\n\n![Bouncing Cow](./docs/cow-term.svg)\n\n## Featured Projects\n\n * [Tetromino Elektronica](https://github.com/pdevine/tetromino) A Falling Tetromino Game\n\n * [Text Invaders!](https://github.com/pdevine/textinvaders) Unicode Space Shoot 'em Up\n\n * [Docker Doodle](https://github.com/docker/doodle) ASCII doodles with Moby the Whale\n \n * [This is fine.](https://github.com/pdevine/thisisfine) A dog in a burning room\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdevine%2Fgo-asciisprite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpdevine%2Fgo-asciisprite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdevine%2Fgo-asciisprite/lists"}