Metadata-Version: 2.2
Name: arepy
Version: 0.2.2
Summary: An ECS python game engine with Raylib
Author-email: Abrahan Gil <scr44gr@protonmail.com>
License: MIT 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
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS :: MacOS X
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: bitarray==2.9.2
Requires-Dist: raylib==5.5.0.2
Provides-Extra: imgui
Requires-Dist: imgui-bundle==1.6.0; extra == "imgui"
Requires-Dist: moderngl==5.12.0; extra == "imgui"

# 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
