diff options
author | nathansmith117 <thenathansmithsmith@gmail.com> | 2024-02-15 00:06:35 +0000 |
---|---|---|
committer | nathansmith117 <thenathansmithsmith@gmail.com> | 2024-02-15 00:06:35 +0000 |
commit | 64bb931e18825b285dd93d0b9987ef72ece15ab4 (patch) | |
tree | 78cee060cf5f4f2bcc99254c99cead6f2d77578e | |
parent | adf3b7635326af20e0e77d37c080ef08c64e9e91 (diff) | |
download | PenguinYippies-64bb931e18825b285dd93d0b9987ef72ece15ab4.tar.gz PenguinYippies-64bb931e18825b285dd93d0b9987ef72ece15ab4.tar.bz2 PenguinYippies-64bb931e18825b285dd93d0b9987ef72ece15ab4.zip |
Working on animation stuff
-rw-r--r-- | assets/buttonBox.gif (renamed from assets/button_box.gif) | bin | 80166 -> 80166 bytes | |||
-rw-r--r-- | assets/mainScreenBackground.png | bin | 0 -> 412228 bytes | |||
-rw-r--r-- | assets/penguinBackground.png | bin | 0 -> 29040 bytes | |||
-rw-r--r-- | assets/penguinLol.gif (renamed from assets/penguin_lol.gif) | bin | 58532 -> 58532 bytes | |||
-rw-r--r-- | assets/toEmperorsEmporiumIcon.png | bin | 0 -> 933704 bytes | |||
-rw-r--r-- | assets/toGameIcon.png | bin | 0 -> 800908 bytes | |||
-rw-r--r-- | src/animation.c | 25 | ||||
-rw-r--r-- | src/animation.h | 25 | ||||
-rw-r--r-- | src/assets.c | 1 | ||||
-rw-r--r-- | src/assets.h | 10 |
10 files changed, 61 insertions, 0 deletions
diff --git a/assets/button_box.gif b/assets/buttonBox.gif Binary files differindex 495a785..495a785 100644 --- a/assets/button_box.gif +++ b/assets/buttonBox.gif diff --git a/assets/mainScreenBackground.png b/assets/mainScreenBackground.png Binary files differnew file mode 100644 index 0000000..13b0310 --- /dev/null +++ b/assets/mainScreenBackground.png diff --git a/assets/penguinBackground.png b/assets/penguinBackground.png Binary files differnew file mode 100644 index 0000000..5528250 --- /dev/null +++ b/assets/penguinBackground.png diff --git a/assets/penguin_lol.gif b/assets/penguinLol.gif Binary files differindex 0e64e92..0e64e92 100644 --- a/assets/penguin_lol.gif +++ b/assets/penguinLol.gif diff --git a/assets/toEmperorsEmporiumIcon.png b/assets/toEmperorsEmporiumIcon.png Binary files differnew file mode 100644 index 0000000..beacd09 --- /dev/null +++ b/assets/toEmperorsEmporiumIcon.png diff --git a/assets/toGameIcon.png b/assets/toGameIcon.png Binary files differnew file mode 100644 index 0000000..a3f1eff --- /dev/null +++ b/assets/toGameIcon.png diff --git a/src/animation.c b/src/animation.c new file mode 100644 index 0000000..f173401 --- /dev/null +++ b/src/animation.c @@ -0,0 +1,25 @@ +#include "animation.h" +#include "game.h" +#include <raylib.h> + +Animation loadAnimationFromFile(const char* fileName) +{ + Animation animation; + + // Load image in. + animation.image = LoadImageAnim(fileName, &animation.frameCount); + animation.texture = LoadTextureFromImage(animation.image); + + // Set options. + animation.currentFrame = 0; + animation.delay = ANIMATION_DEFAULT_DELAY; + animation.lastTime = -1.0; // -1.0 means there wasn't a last time. + + return animation; +} + +void freeAnimation(Animation* animation) +{ + UnloadImage(animation->image); + UnloadTexture(animation->texture); +} diff --git a/src/animation.h b/src/animation.h new file mode 100644 index 0000000..8ec918f --- /dev/null +++ b/src/animation.h @@ -0,0 +1,25 @@ +#include "gameCommon.h" + +#define ANIMATION_DEFAULT_DELAY 0.1 + +#ifndef ANIMATION_H +#define ANIMATION_H + +typedef struct Animation { + // Frame stuff. + int frameCount; + int currentFrame; + + // The animation is stored in a image and the texture is used for fast rendering. + Image image; + Texture texture; + + // Timing the frames. + double delay; + double lastTime; +} Animation; + +Animation loadAnimationFromFile(const char* fileName); +void freeAnimation(Animation* animation); + +#endif diff --git a/src/assets.c b/src/assets.c new file mode 100644 index 0000000..4ed3d53 --- /dev/null +++ b/src/assets.c @@ -0,0 +1 @@ +#include "assets.h" diff --git a/src/assets.h b/src/assets.h new file mode 100644 index 0000000..9846f3b --- /dev/null +++ b/src/assets.h @@ -0,0 +1,10 @@ +#include "gameCommon.h" + +#define ASSETS_NAME_MAX 100 +#define IMAGE_ASSET_COUNT 4 +#define ANIMATION_ASSET_COUNT 2 + +#ifndef ASSETS_H +#define ASSETS_H + +#endif |