{"id":16282034,"url":"https://github.com/martinrenou/pysfml11","last_synced_at":"2025-11-13T23:04:04.132Z","repository":{"id":43604291,"uuid":"239089013","full_name":"martinRenou/pysfml11","owner":"martinRenou","description":"Python binding for the SFML library, using pybind11","archived":false,"fork":false,"pushed_at":"2023-09-27T07:09:21.000Z","size":483,"stargazers_count":13,"open_issues_count":6,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-17T13:22:48.222Z","etag":null,"topics":["python","python-binding","sfml"],"latest_commit_sha":null,"homepage":"","language":"C++","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/martinRenou.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":"2020-02-08T07:47:53.000Z","updated_at":"2025-02-13T20:02:16.000Z","dependencies_parsed_at":"2024-06-11T17:40:53.576Z","dependency_job_id":"8a36c951-ce8f-4a13-accd-0ef20fd415ab","html_url":"https://github.com/martinRenou/pysfml11","commit_stats":{"total_commits":99,"total_committers":1,"mean_commits":99.0,"dds":0.0,"last_synced_commit":"b4f7f45255b06382aa91991d3d98bc53cfdefe99"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinRenou%2Fpysfml11","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinRenou%2Fpysfml11/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinRenou%2Fpysfml11/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinRenou%2Fpysfml11/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinRenou","download_url":"https://codeload.github.com/martinRenou/pysfml11/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244538509,"owners_count":20468728,"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":["python","python-binding","sfml"],"created_at":"2024-10-10T19:09:35.148Z","updated_at":"2025-11-13T23:03:59.085Z","avatar_url":"https://github.com/martinRenou.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pysfml11\n\n\nA Python binding for the [SFML](https://www.sfml-dev.org) library, based on [pybind11](https://github.com/pybind/pybind11).\n\n## Installation\n\nThis requires that you install SFML on your machine.\n\n```bash\ngit clone https://github.com/martinRenou/pysfml11\ncd pysfml11\npip install .\n```\n\n## Usage\n\n```python\nimport pysfml11 as sf\n\n\nwidth = 800\nheight = 600\n\n# Create your window\nwindow = sf.RenderWindow(sf.VideoMode(width, height), 'My awesome SFML application!')\n\nclock = sf.Clock()\n\nrectangle = sf.RectangleShape(sf.Vector2f(200, 300))\nrectangle.fill_color = sf.Color.Blue\nrectangle.position = sf.Vector2f(width / 2., height / 2.)\n\n# Simple rendering loop: poll events/clear/draw/display\nwhile (window.is_open()):\n    event = sf.Event()\n\n    while window.poll_event(event):\n        if event.type == sf.Event.Closed:\n            window.close()\n        # Do something with the event (mouse event/keyboard event/resize event...)\n\n    window.clear(sf.Color.White)\n\n    elapsed = clock.elapsed_time.as_seconds() * 40\n    rectangle.rotation = elapsed\n\n    window.draw(rectangle)\n\n    window.display()\n```\n\n## API differences with SFML\n\nMost of the C++ API has been ported to Python using [pybind11](https://github.com/pybind/pybind11), except features that did not make sense to implement because already available in Python (Threading features are available through the built-in [threading](https://docs.python.org/3/library/threading.html) module. String features are already supported by Python).\n\nThere are some API differences:\n\n### camelCase to snake_case\n\nAll method/function names are renamed using snake_case.\n\n### Setters/Getters\n\nThose are replaced by properties (read-only properties if there is not getter available). So for example with the RectangleShape, this C++ code:\n\n```cpp\nsf::RectangleShape rectangle;\n\nrectangle.setPosition(10, 20);\nsf::Vector2f position = rectangle.getPosition();\n```\n\nBecomes the following in Python:\n```python\nrectangle = RectangleShape()\n\nrectangle.position = Vector2f(10, 20)\nposition = rectangle.position\n```\n\n### C-like functions\n\nC-like functions are made simpler. For example with the InputSoundFile's read method, the samples buffer is the returned value (no need to allocate it before calling the method), and the samples counts actually read can be computed getting the length of the returned value.\n\nThis C++ code:\n```cpp\nsf::InputSoundFile file;\nfile.openFromFile(\"music.ogg\");\n\nsf::Int16 samples[1024];\nsf::Uint64 count = file.read(samples, 1024);\n```\n\nBecomes the following in Python:\n```python\nfile = InputSoundFile()\nfile.open_from_file(\"music.ogg\")\n\nsamples = file.read(1024)\ncount = len(samples)\n```\n\n## Status\n\n`pysfml11` is under development and not yet finished. Basic operations are implemented, but the full API is not there yet. Contributions are very welcome!\n\n## License\n\n`pysfml11` is provided under a BSD-style license that can be found in the LICENSE\nfile. By using, distributing, or contributing to this project, you agree to the\nterms and conditions of this license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinrenou%2Fpysfml11","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinrenou%2Fpysfml11","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinrenou%2Fpysfml11/lists"}