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.
Revert "Added spritesheets, fixed animation system and added spritesh…
…eet support to animation system" This reverts commit d33b30d.
- Loading branch information
Showing
7 changed files
with
25 additions
and
178 deletions.
There are no files selected for viewing
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,28 +1,6 @@ | ||
# Version 5 Todo/Changelog | ||
|
||
## V5 | ||
- [x] Docs cleanup | ||
- [x] New color system | ||
- [x] Optimised font drawing | ||
- [x] OpenGL rendering | ||
|
||
## V5 | ||
- [ ] New Window features | ||
- [ ] Full Screen | ||
- [ ] is_fullscreen | ||
- [ ] toggle_fullscreen | ||
- [ ] Screen Safer | ||
- [ ] get_screensafer_allowed | ||
- [ ] set_screensafer_allowed | ||
- [ ] get_vsync_enabled | ||
- [ ] get_screen_refresh_rate | ||
- [ ] get_display_amount | ||
- [ ] get_active | ||
|
||
- [ ] SpriteSheet class | ||
- [ ] __init__(Image, width, height) | ||
- [ ] frames (variable with all your extracted frames) | ||
- [ ] draw(speed) (gets a argument speed that specifies the speed of drawing in frames) | ||
|
||
- Image system updates | ||
- [ ] Added crop() function | ||
- [ ] Docs cleanup | ||
- [ ] New color system | ||
- [ ] Optimised font drawing |
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
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,38 +1,33 @@ | ||
from fusionengine.engine.window import Window | ||
from fusionengine.engine.spritesheets import SpriteSheet | ||
|
||
|
||
class Animation: | ||
def __init__(self, window: Window, images: tuple | SpriteSheet) -> None: | ||
def __init__(self, window: Window, images: tuple, speed: int) -> None: | ||
""" | ||
The class to create a Animation. | ||
Args: | ||
window: Window | ||
image (Tuple | Spritesheets): Tuple of Images or a SpriteSheet | ||
image: tuple of Images | ||
Speed: Int (FPS) | ||
""" | ||
self.frame = 0 | ||
if isinstance(images, SpriteSheet): | ||
self.frames = images.frames | ||
elif isinstance(images, tuple): | ||
self.frames = images | ||
else: | ||
ValueError("Images must be a tuple of Images or a SpriteSheet") | ||
self.anim = images | ||
|
||
self.speed = speed | ||
self.window = window | ||
|
||
def play(self, speed: float) -> None: | ||
def draw(self) -> None: | ||
""" | ||
Draw the animation you made before | ||
""" | ||
if isinstance(self.frame, int) or ( | ||
isinstance(self.frame, float) and self.frame.is_integer() | ||
): | ||
if 0 <= int(self.frame) < len(self.frames): | ||
self.frames[int(self.frame)].draw() | ||
self.window.set_fps(self.speed) | ||
|
||
self.frame += speed | ||
|
||
if self.frame >= len(self.frames): | ||
if self.frame >= len(self.anim): | ||
self.frame = 0 | ||
|
||
image = self.anim[self.frame] | ||
|
||
image.draw() | ||
|
||
self.frame += 1 |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.