{"id":15042675,"url":"https://github.com/amyreese/cpgame","last_synced_at":"2026-04-18T12:36:56.222Z","repository":{"id":57447635,"uuid":"175149841","full_name":"amyreese/cpgame","owner":"amyreese","description":"Simple game framework for CircuitPython embedded hardware","archived":false,"fork":false,"pushed_at":"2020-02-10T00:33:06.000Z","size":19,"stargazers_count":1,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-14T00:26:13.818Z","etag":null,"topics":["circuit-playground-express","circuitpython","framework","game-engine"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/amyreese.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-12T06:34:38.000Z","updated_at":"2024-07-01T19:15:49.000Z","dependencies_parsed_at":"2022-09-15T22:12:22.281Z","dependency_job_id":null,"html_url":"https://github.com/amyreese/cpgame","commit_stats":null,"previous_names":["jreese/cpgame"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/amyreese/cpgame","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amyreese%2Fcpgame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amyreese%2Fcpgame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amyreese%2Fcpgame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amyreese%2Fcpgame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amyreese","download_url":"https://codeload.github.com/amyreese/cpgame/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amyreese%2Fcpgame/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31969769,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["circuit-playground-express","circuitpython","framework","game-engine"],"created_at":"2024-09-24T20:47:43.562Z","updated_at":"2026-04-18T12:36:56.197Z","avatar_url":"https://github.com/amyreese.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"cpgame\n======\n\nSimple \"game\" framework for [CircuitPython][] embedded hardware.\n\n[![build status](https://travis-ci.org/jreese/cpgame.svg?branch=master)](https://travis-ci.org/jreese/cpgame)\n[![version](https://img.shields.io/pypi/v/cpgame.svg)](https://pypi.org/project/cpgame)\n[![license](https://img.shields.io/pypi/l/cpgame.svg)](https://github.com/jreese/cpgame/blob/master/LICENSE)\n[![code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\n\nInstall\n-------\n\nDownload the [compiled library][cpgame.mpy] and copy it to your device's directory:\n\n```bash\n$ cp -X cpgame.mpy /Volumes/CIRCUITPY/\n```\n\n[cpgame.mpy]: https://github.com/jreese/cpgame/releases/download/v0.5/cpgame.mpy\n\n\nOverview\n--------\n\ncpgame provides a number of decorators and a simple event loop to provide a responsive\nframework for building applications and games on embedded hardware using CircuitPython.\n\nRun a function on every \"tick\" of the event loop:\n\n```python\nfrom cpgame import start, tick\n\n@tick\ndef loop(now):\n    ...\n\nstart()\n```\n\nBlink a Neopixel every second:\n\n```python\n@every(1)\ndef periodic(now):\n    pixel[0] = RED if int(now) % 2 else OFF\n```\n\nTurn a Neopixel on and off with a button press:\n\n```python\n@on(board.BUTTON_A, DOWN)\ndef pressed(now):\n    pixel[0] = RED\n\n@on(board.BUTTON_A, UP)\ndef released(now):\n    pixel[0] = OFF\n```\n\nCreate or reset timers:\n\n```python\n@on(board.BUTTON_A)\ndef flood(now):\n    pixels.fill(random.choice(COLORS))\n    delay = random.randint(20, 100) / 10  # between 2 and 10 seconds\n    after(delay, flood)\n\n@on(board.BUTTON_B)\ndef halt(now):\n    cancel(flood)\n```\n\nPlay sound:\n\n```python\nenable_speaker()\nmiddle_a = sample(440)\n\n@on(board.BUTTON_A)\ndef noise(now):\n    play_sound(middle_a, 1)\n```\n\n\nRoadmap\n-------\n\n* Support more boards than Circuit Playground Express.\n* Add helper functions for animating NeoPixels, raw audio clips, and LCD displays.\n\n\nLicense\n-------\n\naiosqlite is copyright [John Reese](https://jreese.sh), and licensed under the\nMIT license.  I am providing code in this repository to you under an open source\nlicense.  This is my personal repository; the license you receive to my code\nis from me and not from my employer. See the `LICENSE` file for details.\n\n[CircuitPython]: https://circuitpython.org","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famyreese%2Fcpgame","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famyreese%2Fcpgame","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famyreese%2Fcpgame/lists"}