This repository has been archived by the owner on Dec 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
V5.1 done. Spritesheets, new animation system and more window features
- Loading branch information
Showing
34 changed files
with
454 additions
and
136 deletions.
There are no files selected for viewing
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,34 @@ | ||
# Version 5 Todo/Changelog | ||
|
||
## V5 | ||
- [ ] Docs cleanup | ||
- [ ] New color system | ||
- [ ] Optimised font drawing | ||
- [x] Docs cleanup | ||
- [x] New color system | ||
- [x] Optimised font drawing | ||
- [x] OpenGL rendering | ||
|
||
## V5.1 | ||
- [x] New Window features | ||
- [x] Full Screen | ||
- [x] is_fullscreen | ||
- [x] toggle_fullscreen | ||
- [x] Screen Safer | ||
- [x] get_screensafer_allowed | ||
- [x] toggle_screensafer_allowed | ||
- [x] get_vsync_enabled | ||
- [x] get_screen_refresh_rate | ||
- [x] get_display_amount | ||
- [x] get_active | ||
|
||
- [x] SpriteSheet class | ||
- [x] __init__(Image, width, height) | ||
- [x] frames (variable with all your extracted frames) | ||
|
||
- [x] Image system updates | ||
- [x] Added crop() function | ||
- [x] Support for Pillow (PIL) images | ||
|
||
- [x] Animation system | ||
- [x] Fixing Animation system | ||
- [x] Added support for SpriteSheets | ||
- [x] Draw function gets frames argument | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Animations and Spritesheets | ||
|
||
## Animation system (Early stages) | ||
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) | ||
``` | ||
|
||
### Drawing animation | ||
To draw it then, run: | ||
```python | ||
my_anim.draw(frames: int) | ||
``` | ||
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. | ||
|
||
## Spritesheets | ||
### Creating spritesheets | ||
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. | ||
|
||
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: | ||
```python | ||
spr.frame_size(60, 60) | ||
``` | ||
|
||
This will set the size of each image 60x60 pixels. | ||
Then, set the coordinates: | ||
```python | ||
spr.frame_pos(50, 50) | ||
``` | ||
This will set the X-axis and Y-axis to 50. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# Windowing | ||
|
||
## Create window | ||
|
||
To create a window were thing are draw, then you need to use this: | ||
|
||
```python | ||
your_window = fusion.Window("Example", 800, 600) | ||
``` | ||
|
||
## Start loop | ||
|
||
In a loop you can draw things and it will run with the FPS that is setup. To start a loop, you have two choices: | ||
|
||
Choice 1: | ||
|
||
```python | ||
@your_window.loop | ||
def loop(): | ||
... # Your own loop things | ||
``` | ||
|
||
Choice 2: | ||
|
||
```python | ||
while your_window.running(): | ||
... # Your own loop thing | ||
|
||
``` | ||
|
||
There is basically no difference, they all are doing the same thing, you use what you prefer. In our examples we use choice 1. | ||
|
||
|
||
## Set FPS | ||
To set the framerate of your window, you use this: | ||
|
||
```python | ||
your_window.set_fps(60) | ||
|
||
``` | ||
|
||
## Window icon | ||
So you want to change the icon of your window? Well, its easy: | ||
|
||
```python | ||
your_window.change_icon("path_to_icon.png") | ||
``` | ||
|
||
## DeltaTime | ||
|
||
if you want to access delta time, you use this: | ||
|
||
```python | ||
your_window.DELTATIME | ||
``` | ||
|
||
## Quit | ||
|
||
The quitting of the engine is done automaticly for you, so you dont have to worry about it. | ||
|
||
### Force to quit | ||
If you want to force quit due to some reason, its pretty easy: | ||
```python | ||
your_window.force_quit() | ||
``` | ||
|
||
## Full Screen | ||
If you want to know if the window is full screen then run the following command: | ||
```python | ||
your_var = your_window.is_fullscreen() | ||
``` | ||
|
||
If you want to toggle the fullscreen on your window then run the following command: | ||
```python | ||
your_window.toggle_fullscreen() | ||
``` | ||
|
||
## Screen Safer | ||
If you want to know if screen safer is allowed on the current machine then run the following command: | ||
```python | ||
your_var = your_window.get_screensafer_allowed() | ||
``` | ||
|
||
If you want to toggle the screen safer allowed on the current machine then run the following command: | ||
```python | ||
your_window.toggle_screensafer_allowed() | ||
``` | ||
|
||
## Vsync | ||
If you want to know if VSync in enabled on the current machine then run the following command: | ||
```python | ||
my_var = your_window.get_vsync_enabled() | ||
``` | ||
|
||
## Displays | ||
### Refresh rate | ||
If you want to get the display refresh rate on the current machine then run the following command: | ||
```python | ||
my_var = your_window.get_screen_refresh_rate() | ||
``` | ||
|
||
## Display amount | ||
If you want to get the display amount on the current machine then run the following command: | ||
```python | ||
my_var = your_window.get_display_amount() | ||
``` | ||
|
||
## Active | ||
If you want to get the active state on the current machine then run the following command: | ||
```python | ||
my_var = your_window.get_active() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.