{"id":20047240,"url":"https://github.com/wojciech-graj/cydoomgeneric","last_synced_at":"2025-04-06T02:07:40.834Z","repository":{"id":143188686,"uuid":"601332483","full_name":"wojciech-graj/cydoomgeneric","owner":"wojciech-graj","description":"Easily portable DooM for Python (+ some pretty sick demos)","archived":false,"fork":false,"pushed_at":"2024-11-16T23:07:22.000Z","size":2527,"stargazers_count":65,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T01:11:12.375Z","etag":null,"topics":["cython","doom","python","python-3","python3","source-port","sourceport"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wojciech-graj.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":"2023-02-13T21:02:42.000Z","updated_at":"2025-03-25T06:41:46.000Z","dependencies_parsed_at":"2024-12-19T03:11:07.995Z","dependency_job_id":"4a407ec9-d372-450e-a481-6df14f35ee06","html_url":"https://github.com/wojciech-graj/cydoomgeneric","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/wojciech-graj%2Fcydoomgeneric","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wojciech-graj%2Fcydoomgeneric/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wojciech-graj%2Fcydoomgeneric/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wojciech-graj%2Fcydoomgeneric/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wojciech-graj","download_url":"https://codeload.github.com/wojciech-graj/cydoomgeneric/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423513,"owners_count":20936626,"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":["cython","doom","python","python-3","python3","source-port","sourceport"],"created_at":"2024-11-13T11:34:43.514Z","updated_at":"2025-04-06T02:07:40.818Z","avatar_url":"https://github.com/wojciech-graj.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cyDoomGeneric\n\nWrite doom ports in python!\n\nPython bindings for [doomgeneric](https://github.com/ozkl/doomgeneric) with ease-of-use at heart.\n\nTo try it you will need a WAD file (game data). If you don't own the game, shareware version is freely available.\n\ncyDoomGeneric should run on Linux, MacOS, and Windows.\n\n## Installation\n\nEither install the latest release from PyPI\n```sh\npip install cydoomgeneric\n```\n\nOr run the following command to build from the repository\n```sh\npip install .\n```\n\n## Porting\n\nYou must implement the `draw_frame` and `get_key` functions.\n\n```python\nimport cydoomgeneric as cdg\n\nresx = 640\nresy = 400\n\n# Required functions\ndef draw_frame(pixels: np.ndarray) -\u003e None:\ndef get_key() -\u003e Optional[tuple[int, int]]:\n\n# Optional functions\ndef sleep_ms(ms: int) -\u003e None:\ndef set_window_title(t: str) -\u003e None:\ndef get_ticks_ms() -\u003e int:\n\ncdg.init(resx,\n    resy,\n    draw_frame,\n    get_key,\n    sleep_ms=sleep_ms,\n    get_ticks_ms=get_ticks_ms,\n    set_window_title=set_window_title)\ncdg.main()  # Optional parameter argv=[...]\n```\n\n`get_key` should return `None` if all input has been processed, or a tuple `(pressed as 0 or 1, key)`. All possible keys are either members of the `Keys` enum, or the ascii value of the lowercase character `ord(c.lower())`.\n\nIf any function that was passed to `cdg.init` raises an exception during the execution of `cdg.main`, `sys.exit(1)` is called.\n\nSome additional documentation can be found in `cydoomgeneric/cydoomgeneric.pyx`.\n\n## Demo Screenshots\n\n#### Pyplot\n![pyplot](screenshots/pyplotdoom_1.png)\n\n#### Libreoffice Calc\n![calc](screenshots/calcdoom_0.png)\n\n#### Minecraft: Pi Edition\n![mcpi](screenshots/minepidoom_0.png)\n\n#### MS Paint\n![paint](screenshots/mspaintdoom_0.png)\n\n#### Pygame\n![pygame](screenshots/pygamedoom_0.png)\n\n## Running the Demo\n\n###### Before running any demo, perform the build process mentioned above\n\n#### Pyplot\n\n```sh\npip install '.[pyplot]'\npython demo/demopyplot.py\n```\n\n#### Minecraft: Pi Edition\n\nBefore running the script, launch Minecraft: Pi Edition and join a world. The `SCALE` variable in `demo/demominepi.py` can be adjusted to change the display size.\n\nTo move, step on the appropriate block on the platform that the player is standing on. To press the fire, use, enter, or escape keys, hit (`RMB`) the appropriate block with the sword:\n```\nDIAMOND_BLOCK: FIRE\nGOLD_BLOCK: USE\nNETHER_REACTOR_CORE: ENTER\nNETHER_REACTOR_CORE(active): ESCAPE\n```\n\n```sh\npip install '.[minepi]'\npython demo/demominepi.py\n```\n\n#### MS Paint\n\nEnsure that the Windows XP version of mspaint is installed, which can be done by running `winetricks mspaint`.\n\nIf you have not installed mspaint using wine, you'll have to edit the `PAINT_COMMAND` variable in `demo/demomspaint.py` to contain the command for launching paint.\n\nIf you wish to free your mouse in the middle of a frame being drawn, you should drag it to the top-left corner of the screen, which will free it, at which point you can kill the python script. Once a frame has been drawn, you will be able to send an input by flood-filling the appropriate \"key\" drawn under the frame.\n\n```sh\npip install '.[mspaint]'\npython demo/demomspaint.py\n```\n\n#### LibreOffice Calc\n\nEnsure that the libreoffice SDK (`libreoffice-dev` on Debian) is installed, and that you're using the system python installation instead of a virtual environment.\n\nThe `SCALE` variable in `demo/democalc.py` can be adjusted in the range `[0,5]` to change the display size, idealy either 1 or 2. Lower scales will exponentially increase the setup time required prior to starting the game. Expect to wait a few minutes.\n\nSometimes the window will be tiny, so maximize it if neccessary. Also, you may experience unexpected issues while attempting to run this demo, and there's not much I can do because the UNO API has virtually no documentation and the code here has been pieced together from 10 year old forum posts for the Java or C++ version of the API.\n\nOnly run the following command once, unless the libreoffice process is killed:\n```sh\nlibreoffice --nofirststartwizard --nologo --norestore --accept='socket,host=localhost,port=2002,tcpNoDelay=1;urp;StarOffice.ComponentContext' \u0026\n```\n\n```sh\npython demo/democalc.py\n```\n\n#### Pygame\n\n```sh\npip install '.[pygame]'\npython demo/demopygame.py\n```\n\n## License\n\n```\nCopyright (c) 2023-2024 Wojciech Graj\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwojciech-graj%2Fcydoomgeneric","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwojciech-graj%2Fcydoomgeneric","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwojciech-graj%2Fcydoomgeneric/lists"}