arepy


Namearepy JSON
Version 0.2.3 PyPI version JSON
download
home_pageNone
SummaryAn ECS python game engine with Raylib
upload_time2025-02-01 05:25:57
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT License Copyright (c) 2024 Abrahan Gil Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords ecs game-engine python-game-engine
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Arepy 🎮
[![Upload Python Package](https://github.com/Scr44gr/arepy/actions/workflows/python-publish.yml/badge.svg)](https://github.com/Scr44gr/arepy/actions/workflows/python-publish.yml)

An ECS game engine created in python with raylib and imgui integration :)
## Installation 📖
```bash
pip install arepy
```

## Usage 📝

### Basic usage example 

#### Creating a simple square that moves to the right

```python
from arepy import ArepyEngine, Color, Rect, Renderer2D, SystemPipeline
from arepy.bundle.components.rigidbody_component import RigidBody2D
from arepy.bundle.components.transform_component import Transform
from arepy.ecs import Entities, Query, With
from arepy.math import Vec2

WHITE_COLOR = Color(255, 255, 255, 255)
RED_COLOR = Color(255, 0, 0, 255)


def movement_system(
    query: Query[Entities, With[Transform, RigidBody2D]], renderer: Renderer2D
):
    delta_time = renderer.get_delta_time()
    entities = query.get_entities()
    for entity in entities:
        transform = entity.get_component(Transform)
        velocity = entity.get_component(RigidBody2D).velocity

        transform.position.x += velocity.x * delta_time
        transform.position.y += velocity.y * delta_time


def render_system(
    query: Query[Entities, With[Transform, RigidBody2D]], renderer: Renderer2D
):
    renderer.start_frame()
    renderer.clear(color=WHITE_COLOR)
    for entity in query.get_entities():
        transform = entity.get_component(Transform)
        renderer.draw_rectangle(
            Rect(transform.position.x, transform.position.y, 50, 50),
            color=RED_COLOR,
        )
    renderer.end_frame()


if __name__ == "__main__":
    game = ArepyEngine()
    game.title = "Example :p"
    game.init()
    # Add world to the game engine
    world = game.create_world("example_world")
    # spawn some entities

    entity = world.create_entity()
    entity.with_component(Transform(position=Vec2(0, 0))).with_component(RigidBody2D(velocity=Vec2(50, 10))).build()

    # Add systems to the world
    world.add_system(SystemPipeline.UPDATE, movement_system)
    world.add_system(SystemPipeline.RENDER, render_system)

    # Add set the world as the current world to the game engine
    game.set_current_world("example_world")
    game.run()
```
### And you can see the result:

![window](https://github.com/user-attachments/assets/c23a6af6-14a0-4afc-b335-7702815a7777)



TODO!: create a nice README.md

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "arepy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "ecs, game-engine, python-game-engine",
    "author": null,
    "author_email": "Abrahan Gil <scr44gr@protonmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/b4/c0/dedf30888552c76574875d4fbc7815cb5d87cb9ab3eedc31a0323a534a98/arepy-0.2.3.tar.gz",
    "platform": null,
    "description": "# Arepy \ud83c\udfae\n[![Upload Python Package](https://github.com/Scr44gr/arepy/actions/workflows/python-publish.yml/badge.svg)](https://github.com/Scr44gr/arepy/actions/workflows/python-publish.yml)\n\nAn ECS game engine created in python with raylib and imgui integration :)\n## Installation \ud83d\udcd6\n```bash\npip install arepy\n```\n\n## Usage \ud83d\udcdd\n\n### Basic usage example \n\n#### Creating a simple square that moves to the right\n\n```python\nfrom arepy import ArepyEngine, Color, Rect, Renderer2D, SystemPipeline\nfrom arepy.bundle.components.rigidbody_component import RigidBody2D\nfrom arepy.bundle.components.transform_component import Transform\nfrom arepy.ecs import Entities, Query, With\nfrom arepy.math import Vec2\n\nWHITE_COLOR = Color(255, 255, 255, 255)\nRED_COLOR = Color(255, 0, 0, 255)\n\n\ndef movement_system(\n    query: Query[Entities, With[Transform, RigidBody2D]], renderer: Renderer2D\n):\n    delta_time = renderer.get_delta_time()\n    entities = query.get_entities()\n    for entity in entities:\n        transform = entity.get_component(Transform)\n        velocity = entity.get_component(RigidBody2D).velocity\n\n        transform.position.x += velocity.x * delta_time\n        transform.position.y += velocity.y * delta_time\n\n\ndef render_system(\n    query: Query[Entities, With[Transform, RigidBody2D]], renderer: Renderer2D\n):\n    renderer.start_frame()\n    renderer.clear(color=WHITE_COLOR)\n    for entity in query.get_entities():\n        transform = entity.get_component(Transform)\n        renderer.draw_rectangle(\n            Rect(transform.position.x, transform.position.y, 50, 50),\n            color=RED_COLOR,\n        )\n    renderer.end_frame()\n\n\nif __name__ == \"__main__\":\n    game = ArepyEngine()\n    game.title = \"Example :p\"\n    game.init()\n    # Add world to the game engine\n    world = game.create_world(\"example_world\")\n    # spawn some entities\n\n    entity = world.create_entity()\n    entity.with_component(Transform(position=Vec2(0, 0))).with_component(RigidBody2D(velocity=Vec2(50, 10))).build()\n\n    # Add systems to the world\n    world.add_system(SystemPipeline.UPDATE, movement_system)\n    world.add_system(SystemPipeline.RENDER, render_system)\n\n    # Add set the world as the current world to the game engine\n    game.set_current_world(\"example_world\")\n    game.run()\n```\n### And you can see the result:\n\n![window](https://github.com/user-attachments/assets/c23a6af6-14a0-4afc-b335-7702815a7777)\n\n\n\nTODO!: create a nice README.md\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2024 Abrahan Gil\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.\n        ",
    "summary": "An ECS python game engine with Raylib",
    "version": "0.2.3",
    "project_urls": null,
    "split_keywords": [
        "ecs",
        " game-engine",
        " python-game-engine"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "04af27c4944813b08233728c87b4ec0fe1acf05b823d4a30e4309351c0e3099e",
                "md5": "5e5dd272e4d74f5333cd64226395fccb",
                "sha256": "fbaacdff59d7661bd5cb93dcb3e0d8edf3795176dbb2de6a4a2a8eb1f445123e"
            },
            "downloads": -1,
            "filename": "arepy-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5e5dd272e4d74f5333cd64226395fccb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 46380,
            "upload_time": "2025-02-01T05:25:54",
            "upload_time_iso_8601": "2025-02-01T05:25:54.804054Z",
            "url": "https://files.pythonhosted.org/packages/04/af/27c4944813b08233728c87b4ec0fe1acf05b823d4a30e4309351c0e3099e/arepy-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b4c0dedf30888552c76574875d4fbc7815cb5d87cb9ab3eedc31a0323a534a98",
                "md5": "8304e4f31b319eea50b73f0f0579af43",
                "sha256": "3b04f75110f305e61f577b052c846bb4470e98fa5ba24b51b8db15a2e7cb6e34"
            },
            "downloads": -1,
            "filename": "arepy-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "8304e4f31b319eea50b73f0f0579af43",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 34843,
            "upload_time": "2025-02-01T05:25:57",
            "upload_time_iso_8601": "2025-02-01T05:25:57.149085Z",
            "url": "https://files.pythonhosted.org/packages/b4/c0/dedf30888552c76574875d4fbc7815cb5d87cb9ab3eedc31a0323a534a98/arepy-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-01 05:25:57",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "arepy"
}
        
Elapsed time: 1.06925s