{"id":17209186,"url":"https://github.com/rswinkle/inventwithpython_pysdl2","last_synced_at":"2025-03-25T11:41:50.820Z","repository":{"id":146964844,"uuid":"50959527","full_name":"rswinkle/inventwithpython_pysdl2","owner":"rswinkle","description":"Porting all the code/games from Al Sweigart's pygame book to use PySDL2","archived":false,"fork":false,"pushed_at":"2020-07-13T21:49:08.000Z","size":11143,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T22:19:32.266Z","etag":null,"topics":["game-development","games","pygame","pysdl2"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rswinkle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"liberapay":"rswinkle","custom":"http://www.robertwinkler.com/donations.html"}},"created_at":"2016-02-02T23:29:56.000Z","updated_at":"2020-11-19T09:58:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"a7c068d5-b0be-4e8f-ab1e-79333c482be2","html_url":"https://github.com/rswinkle/inventwithpython_pysdl2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rswinkle%2Finventwithpython_pysdl2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rswinkle%2Finventwithpython_pysdl2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rswinkle%2Finventwithpython_pysdl2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rswinkle%2Finventwithpython_pysdl2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rswinkle","download_url":"https://codeload.github.com/rswinkle/inventwithpython_pysdl2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245458048,"owners_count":20618693,"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":["game-development","games","pygame","pysdl2"],"created_at":"2024-10-15T02:50:59.589Z","updated_at":"2025-03-25T11:41:50.789Z","avatar_url":"https://github.com/rswinkle.png","language":"Python","readme":"Invent With Python ported to PySDL2\n===================================\n\n[Download](https://github.com/rswinkle/inventwithpython_pysdl2)\n\n\nThis is a project aiming to port all the code/games from the book\n[\"Making Games with Python \u0026 Pygame\"](http://inventwithpython.com/pygame/chapters/) by Al Sweigart\nfrom pygame to PySDL2.\n\n## Why?\n\nWell, I'm mostly a C/C++ programmer and I use SDL2 for my games/demos and\nI wanted to be able to prototype in python with a library that'd make\nit very easy to go from that to C.  PySDL2 does have some\ngreat convenience classes/API's in the sdl2.ext, but it's not hard to look\ninto the source and see what they're actually doing.  In addition it has\nthe sdl2 module, which is a straight 1:1 wrapper of SDL2, as well as\n1:1 wrappers of SDL2 libraries like SDL2_mixer, SDL2_gfx and SDL2_ttf.\nThis design also makes using PySDL2 a great way to learn the SDL2\nAPI and related libraries in general.\n\nAnother advantage of PySDL2 is that it's public domain/CC0/zlib instead of LGPL.\n\nLook [here](https://pysdl2.readthedocs.org/en/latest/tutorial/pygamers.html)\nfor more details on the differences between Pygame and PySDL2\n\n\n## Status\nI've ported 10 of the projects, though the first 4 hardly count being so simple, or\nin the case of tetromino for idiots, only a few lines different from tetromino.\nThey all (should) work with python 2.7 and python 3.x though I think I may drop\npython 2 in the future.  They're mostly straight ports not redesigns/reimplementations,\nso it's easy to compare/learn (I've left all the pygame versions in the repo).  In other\nwords, I keep as much of his functions/code structure as possible.  I have\nabout 7 more games to go and various improvements in the first half and general maintenance.\n\nOne other thing to note.  I am using a local copy of PySDL2 with 1 change, modifying\nSpriteRenderer.render() behavior.  I've changed it so that it does *not* call\nSDL_RenderPresent/SDL_UpdateWindowSurface. I've created an [issue](https://bitbucket.org/marcusva/py-sdl2/issues/91/spriterenderer-render-behavior-change) to\ndiscuss the design/behavior of that function and why it should change,\nbut even if the change is merged I'll keep a local copy in the repo for\nconvenience and because I'll change/add other minor things.\n\n## License\nAll original content/code is copyrighted by Al Sweigart and as you can see\nat the top of his py files, is BSD licensed.  All my code is public domain,\nfallback to MIT/BSD.  I may change/expand/formalize the fallback later but\ntake it, do whatever you want with it, is the gist if public domain doesn't\nwork obviously.\n\n### References/Sources\n[http://inventwithpython.com/pygame/chapters/](http://inventwithpython.com/pygame/chapters/)\n\n[https://bitbucket.org/marcusva/py-sdl2/overview](https://bitbucket.org/marcusva/py-sdl2/overview)\n\n[https://pysdl2.readthedocs.org/en/latest/#](https://pysdl2.readthedocs.org/en/latest/#)\n","funding_links":["https://liberapay.com/rswinkle","http://www.robertwinkler.com/donations.html"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frswinkle%2Finventwithpython_pysdl2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frswinkle%2Finventwithpython_pysdl2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frswinkle%2Finventwithpython_pysdl2/lists"}