{"id":21207336,"url":"https://github.com/cacilhas/kundalini","last_synced_at":"2026-05-19T10:03:49.840Z","repository":{"id":119028518,"uuid":"164507401","full_name":"cacilhas/kundalini","owner":"cacilhas","description":"Kundalini intends to offer an API similar to that of LÖVE to develop games using PyGame.","archived":false,"fork":false,"pushed_at":"2019-01-07T22:32:22.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-14T23:26:42.645Z","etag":null,"topics":["love2d","pygame","python","utils"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cacilhas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-07T22:32:00.000Z","updated_at":"2020-04-23T05:59:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"fd368633-d16b-4fe9-85c4-9e4d750345cc","html_url":"https://github.com/cacilhas/kundalini","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cacilhas/kundalini","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cacilhas%2Fkundalini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cacilhas%2Fkundalini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cacilhas%2Fkundalini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cacilhas%2Fkundalini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cacilhas","download_url":"https://codeload.github.com/cacilhas/kundalini/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cacilhas%2Fkundalini/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271900779,"owners_count":24841114,"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","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"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":["love2d","pygame","python","utils"],"created_at":"2024-11-20T20:58:28.251Z","updated_at":"2026-05-19T10:03:49.806Z","avatar_url":"https://github.com/cacilhas.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kundalini\n\n[LÖVE](http://www.love2d.org/) is an **awesome** framework you can use\nto make 2D games in [Lua](http://www.lua.org/), in a very similar way\nwith [PyGame](http://www.pygame.org/).\n\nKundalini intends to offer an API similar to that of LÖVE to develop\ngames using PyGame.\n\n\n## Usage\n\nSubclass `kundalini.FrameManager` and override the method:\n```\n    @abstractmethod\n    def build_screen(self) -\u003e Surface:\n        pass\n```\n\n\nIt must return a `pygame.surface.Surface`, like, for example, the\nobject returned by `pygame.display.set_mode()`.\n\nYou also can override:\n```\n    def load(self) -\u003e None:\n        pass\n\n\n    def draw(self) -\u003e None:\n        self.screen.fill((0, 0, 0))\n\n\n    def handle_event(self, event:Event) -\u003e None:\n        pass\n\n\n    def update(self, delta:float) -\u003e None:\n        pass\n```\n\n\nThe method `load()` is performed by `init()` call, just after\n`pygame.init()`.\n\nThe method `draw()` is performed every drawing loop.\n\nThe method `handle_event()` is performed for each occuring event. It\nreceives the event as parameter.\n\nThe method `update()` is performed about 1024 times a second, and\nreceives the time delta in seconds since last performing as parameter.\n\nThe property `screen` represents the surface returned by\n`build_screen()`.\n\n\n## Running the code\n\nCall the classmethod ``main()``.\n\n\n## Complete example\n\n```\n#!/usr/bin/env python3\n\nimport sys\nfrom os import path\nfrom collections import namedtuple\nimport pygame\nfrom pygame.locals import *\nfrom kundalini import FrameManager, Surface, Event\n\nColorTriad = namedtuple('ColorTriad', 'r g b')\n\n\n#-----------------------------------------------------------------------\nclass ColorTweaker(FrameManager):\n\n    def build_screen(self) -\u003e Surface:\n        return pygame.display.set_mode((300, 200), HWSURFACE|DOUBLEBUF, 24)\n\n\n    def load(self) -\u003e None:\n        pygame.display.set_caption('Pygame Color Test - #808080')\n        self.size = (300, 200)\n        self.scales = [0x80, 0x80, 0x80]\n\n\n    def update(self, delta:float) -\u003e None:\n        x, y = pygame.mouse.get_pos()\n        self.size = width, sheight = self.screen.get_size()\n        self.height = height = int(sheight / 6)\n        scales = self.scales\n\n        if pygame.mouse.get_pressed()[0] and 0 \u003c y \u003c height * 3:\n            for c in range(3):\n                if c * height \u003c y \u003c (c + 1) * height:\n                    scales[c] = max(min(int(x * 0x100 / width), 0xff), 0)\n            pygame.display.set_caption('Pygame Color Test - {}'.format(hexcolor(scales)))\n\n\n    def draw(self) -\u003e None:\n        screen = self.screen\n        scales = self.scales\n        width, _ = self.size\n        height = self.height\n        screen.fill((0x00, 0x00, 0x00))\n\n        for c in range(3):\n            left, right = scales[:], scales[:]\n            left[c], right[c] = 0x00, 0xff\n            ss = create_scale(ColorTriad(*left),\n                              ColorTriad(*right),\n                              (width, height))\n            pos = int(scales[c] * width / 0x100), int((c + .5) * height)\n            screen.blit(ss, (0, c * height))\n            pygame.draw.circle(screen, (0xff, 0xff, 0xff), pos, height // 3)\n\n        pygame.draw.rect(screen, tuple(scales),\n                         Rect(0, 3 * height,width, screen.get_height() - 3 * height))\n\n\n    def handle_event(self, event:Event) -\u003e None:\n        if event.type == KEYDOWN and event.key == K_q and event.mod \u0026 KMOD_META:\n            sys.exit()\n\n\n#-----------------------------------------------------------------------\ndef create_scale(left:ColorTriad, right:ColorTriad, size:tuple) -\u003e Surface:\n    width, height = size\n    s = Surface(size)\n    s.lock()\n    for x in range(width):\n        r = int(left.r + (right.r - left.r) * x / width)\n        g = int(left.g + (right.g - left.g) * x / width)\n        b = int(left.b + (right.b - left.b) * x / width)\n        r = max(min(r, 0xff), 0x00)\n        g = max(min(g, 0xff), 0x00)\n        b = max(min(b, 0xff), 0x00)\n        pygame.draw.line(s, (r, g, b), (x, 0), (x, height))\n    s.unlock()\n    return s\n\n\n#-----------------------------------------------------------------------\ndef hexcolor(color:list) -\u003e str:\n    r, g, b = color\n    return '#{:06x}'.format((r \u003c\u003c 16) | (g \u003c\u003c 8) | b)\n\n\n#-----------------------------------------------------------------------\nif __name__ == '__main__':\n    ColorTweaker.main()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcacilhas%2Fkundalini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcacilhas%2Fkundalini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcacilhas%2Fkundalini/lists"}