Skip to content

Commit

Permalink
Merge pull request #74 from fusionengine-org/dev
Browse files Browse the repository at this point in the history
V5.2
  • Loading branch information
dimkauzh authored Feb 10, 2024
2 parents 4c55dea + e14c089 commit ac11b5c
Show file tree
Hide file tree
Showing 40 changed files with 820 additions and 988 deletions.
7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ So make sure that you followed [the rules](#contributing-rules)
- PDM: We are using pdm for our main interaction with the library.
- pyproject.toml: Pythons way for setting up a project. A replacement for setup.py
- pygame-ce: Used for windowing and events
- PyOpenGL: Used for rendering everything
- pillow (PIL): Used for loading images for PyOpenGL
- FusionGL (ctypes): Used for rendering everything. Its a custom wrapper around OpenGL for python
- pymunk: Will be used for physics
- black: We are using black to format code

Expand All @@ -27,11 +26,11 @@ pip install --user pdm
```
PDM will manage everything for us, like virtual enviorments, packages and scripts.

Then, fork [the repository](https://github.com/fusionengine-org/fusion-engine) to your profile.
Then, fork [the repository](https://github.com/fusionengine-org/fusion) to your profile.

Then, clone your forked github repository:
```bash
git clone https://github.com/_your_username_/fusion-engine.git
git clone https://github.com/your_username_/fusion.git
cd fusion-engine
```
Then, change the branch to the dev branch to follow rule #1:
Expand Down
23 changes: 7 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<a href="https://pypi.org/project/fusion-engine"><img alt="PyPI - License" src="https://img.shields.io/pypi/l/fusion-engine?color=blue"></a>
<a href="https://pypi.org/project/fusion-engine"><img alt="PyPI - Status" src="https://img.shields.io/pypi/status/fusion-engine?color=blue"></a>
<a href="https://pypi.org/project/fusion-engine"><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/fusion-engine?color=blue"></a>
<a href="https://github.com/fusionengine-org/fusion-engine/graphs/contributors"><img alt="GitHub contributors" src="https://img.shields.io/github/contributors/fusionengine-org/fusion-engine?color=blue"></a>
<a href="https://github.com/fusionengine-org/fusion-engine"><img alt="Lines of code" src="https://www.aschey.tech/tokei/github/fusionengine-org/fusion-engine"></a>
<a href="https://github.com/fusionengine-org/fusion/graphs/contributors"><img alt="GitHub contributors" src="https://img.shields.io/github/contributors/fusionengine-org/fusion?color=blue"></a>
<a href="https://github.com/fusionengine-org/fusion"><img alt="Lines of code" src="https://www.aschey.tech/tokei/github/fusionengine-org/fusion"></a>
</p>


Expand All @@ -29,7 +29,6 @@ rendering graphics, and handling user input. It is and engine to create games fa
## 💾 Installation

### ➡️ Using PyPi

To install our package, run this:

```bash
Expand All @@ -39,7 +38,6 @@ To install our package, run this:
Our PyPI package is at this [link](<https://pypi.org/project/fusion-engine/>)

### 🪲 Install from source/devel

if you want to install the package from source and get the latest changes then you do it like this:

```bash
Expand All @@ -49,7 +47,7 @@ if you want to install the package from source and get the latest changes then y
```

### 🏃‍♂️ Run example
The examples are located [here](https://github.com/fusionengine-org/fusion-engine/tree/main/src/fusionengine/examples)
The examples are located [here](https://github.com/fusionengine-org/fusion/tree/main/src/fusionengine/examples)
If you want to run the example, then follow these instructions:

1. First, make sure you have fusion engine installed.
Expand All @@ -60,7 +58,6 @@ If you want to run the example, then follow these instructions:
For other examples, you can modify the command to run the other example. Just change the number of the example.

## 👥 Community

We have a discord server at this [link](<https://discord.gg/Smg3CK4ZMc>).
Need to contact us? Just #dimkauzh in discord and he will try to react as fast as possible

Expand All @@ -75,35 +72,29 @@ Are you exited to start with fusion engine but you dont know where to start? The


## 📯 Coming features

We are working hard to implement very basic and complex stuff so our engine becomes more rigid. To see our changelog and todo list, please go [to our docs](<https://docs.fusion-engine.tech/>)

💡 - If you have more ideas, please tell us them in our [discord server](<https://discord.gg/Smg3CK4ZMc>) or create an issue!

## 🪪 License

See [Licence here](LICENCE.md)

## 🗄️ About

This project began May 1, 2023. The original project began in C, but it's entirely rewritten in Python for it's big userbase and ease of use (productivity). This is actually also my EuroPython 2023 project. But after some time, the community has grown, and fusion had a lot of big releases. It was becoming a big project with a giant codebase.

### ⭐ Star History

<a href="https://api.star-history.com/svg?repos=fusionengine-org/fusion-engine&Timeline">
<a href="https://api.star-history.com/svg?repos=fusionengine-org/fusion&Timeline">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=fusionengine-org/fusion-engine&type=Timeline&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=fusionengine-org/fusion-engine&type=Timeline" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=fusionengine-org/fusion-engine&type=Timeline" />
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=fusionengine-org/fusion&type=Timeline&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=fusionengine-org/fusion&type=Timeline" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=fusionengine-org/fusion&type=Timeline" />
</picture>
</a>

### 🇺🇦 Ukraine

We as fusion team support Ukraine and we hope it will win. Fusion engine is dedicated to Ukraine fighting the Russian invasion.
🇺🇦 Please support Ukraine! 🇺🇦

## 🚀 About Me

A 13-year-old game developer with much passion about game development. So I made this project to grow my programming skills and just make a tool that I can use for myself or a tool for other people to help them develop games.

28 changes: 28 additions & 0 deletions docs/changelog/v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,31 @@
- [x] Added support for SpriteSheets
- [x] Draw function gets frames argument

## V5.2
- [x] Custom OpenGL (FusionGL)
- [x] Using Ctypes
- [x] Ported all functions

- [x] Removal of PIL
- [x] Moved image system to pygame instead of PIL

- [x] Removal of 4 dependencies
- [x] PyOpenGL
- [x] PyOpenGL-Accelerate
- [x] PIllow (PIL)
- [x] Pymunk

- [x] Entities
- [x] Deprecated
- [x] New entities called Nodes

- [x] Node
- [x] Some new features
- [x] Moved features from entity system (and fixed them)

## V5.3
- [ ] State Machine
- [ ] Custom states
- [ ] Easy to use


6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ hide:
---

<p align="center">
<img src="v5/assets/logo/fusion-banner.png" alt="logo" width="1000" height="800">
<img src="assets/logo/fusion-banner.png" alt="logo" width="1000" height="800">
</p>


Expand All @@ -15,8 +15,8 @@ hide:
<a href="https://pypi.org/project/fusion-engine"><img alt="PyPI - License" src="https://img.shields.io/pypi/l/fusion-engine?color=blue"></a>
<a href="https://pypi.org/project/fusion-engine"><img alt="PyPI - Status" src="https://img.shields.io/pypi/status/fusion-engine?color=blue"></a>
<a href="https://pypi.org/project/fusion-engine"><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/fusion-engine?color=blue"></a>
<a href="https://github.com/fusionengine-org/fusion-engine/graphs/contributors"><img alt="GitHub contributors" src="https://img.shields.io/github/contributors/fusionengine-org/fusion-engine?color=blue"></a>
<a href="https://github.com/fusionengine-org/fusion-engine"><img alt="Lines of code" src="https://www.aschey.tech/tokei/github/fusionengine-org/fusion-engine"></a>
<a href="https://github.com/fusionengine-org/fusion/graphs/contributors"><img alt="GitHub contributors" src="https://img.shields.io/github/contributors/fusionengine-org/fusion?color=blue"></a>
<a href="https://github.com/fusionengine-org/fusion"><img alt="Lines of code" src="https://www.aschey.tech/tokei/github/fusionengine-org/fusion"></a>
</p>


Expand Down
36 changes: 30 additions & 6 deletions docs/tutorials/character.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
---
hide:
- navigation
---
# Basic Moving Character Tutorial
This is a tutorial how to build a basic moving character using fusion-engine. We wil be using the new Node system introduced in V5.2 to make everything easier.
We are going to make a small moving character. The character is gonna be a node with the fusion icon as image.

## Setting up
First, make sure you have the latest version of Fusion installed (V5.2 and later). Without this it won't work, as we will be using a feature introduced in that version.
If you want have fusion yet setup, then go back to [the setup tutorial](setup.md)

## Basic things
First, lets get the basic things setup, like a window and a loop.

First, we import `fusionengine` as `fusion`:
```python
import fusionengine as fusion
```

Then we create a window where all drawing will take place:
```python
window = fusion.Window("Basic Character - Fusion Engine", 800, 600)
```

After the window is done, we can create the loop:
```python
@window.loop
def loop():
... # Our code is gonna go here
```
Thats it! We have a basic window and loop setup!

## Getting the Node setup

# Platformer tutorial
This is a tutorial how to build a basic platformer using fusion-engine
8 changes: 4 additions & 4 deletions docs/wiki/animation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ If you want to draw a animation, then you can do it this way
### Loading the animations
To load the animation, run
```python
my_anim = fusion.Animation(your_window: Window, your_images: tuple | Spritesheet)
my_anim = fusion.Animation(your_window: Window, your_images: tuple | Spritesheet, frames: int)
```

### Drawing animation
To draw it then, run:
```python
my_anim.draw(frames: int)
my_anim.draw()
```
The frames specify the number of frames to draw each time. It can be as low as you like, or as high as you like, depending on the speed of the animation that you want.

Expand All @@ -22,7 +22,7 @@ First, create your spritesheet. You can do it this way:
```python
spr = fusion.SpriteSheet(fusion.DEBUGIMAGE, 100, 100)
```
This will cut down your spritesheet in 100x100 pixels images. Then it will be places inside `spr.frames` as `Image` objects. The images are cut from corner down-left to down-right. Then it goes a row higher and cuts futher.
This will cut down your spritesheet in 100x100 pixels images. Then it will be places inside `spr.frames` as `Image` objects. The images are cut from corner up-left to up-right. Then it goes a row lower and cuts futher.

Then, set the size of each image and then set the coordinates. (This is required or else they will be automatically set to 0)
Set the size:
Expand All @@ -35,4 +35,4 @@ Then, set the coordinates:
```python
spr.frame_pos(50, 50)
```
This will set the X-axis and Y-axis to 50.
This will set the X-axis and Y-axis to 50.
14 changes: 6 additions & 8 deletions docs/wiki/external.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# External tools

## Using PyOpenGL
If you cant find some function you need in this engine, the you could use PyOpenGL as the engine is build on PyOpenGL. You can import the PyOpenGL library or use the build in wrapper functions like this:
```python
import fusionengine.backend.gl as gl
```
Keep in mind that this will not have all functions you mind need as the wrapper only has functions that fusion requires. If you want, you can import PyOpenGL by yourself.
## Using OpenGL
Fusion is build on its own custom OpenGL binding using CTypes (FusionGL). If you want to use GL for yourself, you can try to use our own wrapper, but keep in mind that our own implementation only has the functions we need. Use it like this: `fusionengine.fusiongl`

If you want to use PyOpenGL, you should be able to do that without any problems.

### Where to put code
All the rendering code should be placed inside the while loop, and fusion should render it for you.
All the rendering code should be placed inside the while loop, and fusion should render it for you. Do not clear the screen as that will be automatically done for you.

### Warning
This is not tested. It may not work or work as expected. If you find any bugs, please create a issue on github. Thank you.
Expand All @@ -27,4 +25,4 @@ You need to modify our loop to support codon, so you need to change it to this:
while your_window.running():
... # Your own loop thing
```
You may reconise this type of while loop from the main wiki as your second option.
You may reconise this type of while loop from the main wiki as your second option.
17 changes: 15 additions & 2 deletions docs/wiki/extra.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,21 @@
If you tried using our engine you may have encountered this message being printed to terminal:

```bash
Fusion Engine 5.0.0 (PyOpenGL 3.1.7, Pygame-ce 2.4.0, Python 3.11.7)
Fusion Engine 5.0.0 (FusionGL 1.0.0, Pygame-ce 2.4.0, Python 3.11.7)
Welcome to Fusion Engine! Check out our website at https://fusion-engine.tech/
```

To disable this behavior, you just give the main class when initting this argument, set your "FUSION_HIDE_PROMPT" enviorment variable to "no".
To disable this behavior, you just give the main class when initting this argument, set your "FUSION_HIDE_PROMPT" enviorment variable to "no" or anything else.
Or you can set the message variable to False:
```python
import fusionengine as fusion

fusion.message = False
```

## GL support
If you are using a OS that isn't officially being supported by Fusion and it still works, you can disable this warning:
```bash
Your platform could not be resolved. Defaulting to OpenGL as GL. Rever to the documentation to learn about how to remove this warning.
```
To disable this behavior, you just give the main class when initting this argument, set your "FUSION_HIDE_GL_PROMPT" enviorment variable to "no" or anything else.
74 changes: 74 additions & 0 deletions docs/wiki/node.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Node and Scenes

## Node
If you want a player or an enemy or some moving object in your game, you can use an Node, thats an object that
helps you manage things in your game:

```python
# x y w h
your_node = fusion.Node(window, 100, 100, 50, 50)
```

### Get Cordinates
If you want to get the cordinates, then there are a few ways to do it.

#### As a tuple
If you want to get the Cordinates as a tuple, then do the following:
```python
my_cor = your_node.get_coord_tuple()
```

#### As a Vector2D
If you want to get the Cordinates as a Vector2D, then do the following:
```python
my_cor = your_node.get_coord_vec2()
```

### Loading a Rect
If you plan on having the main shape of your Node a rect, or just having a rect connected to the size and position of youe Node,
then you can load the rect using this way:
```python
your_node.load_rect(fusion.BLACK)
```

### Loading an Image
If you just want a static image on your Node or just a image on the size and position of your Node then use this.

```python
your_node.load_image("image_path")
```

### Animations with a Node
Fusion has some build-in features into Node system to make animations more easy, here are some ways to use it.

#### Animation object
If you want to load a object of Animation, then you can do it like this:
```python
your_node.load_animation(animation: Animation)
```
#### Load frames
First of all, you need to load frames, and you can do this using this way:
```python
your_node.load_animation(images: tuple)
```

#### Setting current frame
You can set the current frame with this function
```python
your_node.set_frame(frame: int)
```

#### Getting current frame
To get the current frame, run:
```python
my_frame_var = your_node.get_frame()
```

### Drawing everything
If you want to draw everything, in the same order as you loaded it, you can do that this way:
```python
my_node.update()
```

## Scene manager
See in [this example](https://github.com/dimkauzh/fusion-engine/blob/main/examples/example4.py) how to use the scene manager.
2 changes: 1 addition & 1 deletion docs/wiki/rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ You first need to create a variable with your image and image data:
your_image = fusion.Image(window, fusion.DEBUGIMAGE, 100, 100, 400, 400)
```

`fusion.DEBUGIMAGE` is an image that is included with the engine, so you can use it freely. You can pass your own image path or a Pillow (PIL) image.
`fusion.DEBUGIMAGE` is an image that is included with the engine, so you can use it freely. You can pass your own image path or a Pygame image/surface.
Then you need to render it (In the best situation this will happen in your loop):

```python
Expand Down
Loading

0 comments on commit ac11b5c

Please sign in to comment.