Adding Sprite Animation (untested {no sprite sheet}) [running]
This commit is contained in:
parent
23a40216de
commit
b7ddc3f292
6 changed files with 160 additions and 33 deletions
38
alyson/includes/animation/sprite.h
Normal file
38
alyson/includes/animation/sprite.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
#ifndef ANIMATION_SPRITE_H
|
||||
#define ANIMATION_SPRITE_H
|
||||
|
||||
#include <raylib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
Texture2D texture;
|
||||
Vector2 dimentions;
|
||||
|
||||
Rectangle sourceRect;
|
||||
Vector2 size;
|
||||
float rotation;
|
||||
float scale;
|
||||
|
||||
int frameCount;
|
||||
int currentFrame;
|
||||
|
||||
float speed;
|
||||
float time;
|
||||
} sprite_animation_t, *SpriteAnimation;
|
||||
|
||||
SpriteAnimation CreateSpriteAnimation(Texture2D texture, Vector2 sprite_texture_dimentions, Vector2 sprite_size, float rotation, float scale, int frameCount);
|
||||
|
||||
void UpdateSpriteAnimation(SpriteAnimation spriteAnimation, float dt);
|
||||
|
||||
void DrawSpriteAnimation(SpriteAnimation spriteAnimation, Vector2 position);
|
||||
|
||||
void DestroySpriteAnimation(SpriteAnimation spriteAnimation);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // ANIMATION_SPRITE_H
|
|
@ -1,42 +1,47 @@
|
|||
#ifndef RLYSON_HPP
|
||||
#define RLYSON_HPP
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#include <raylib.h>
|
||||
|
||||
|
||||
/*
|
||||
the following functions are not part of the raylib API,
|
||||
but are used by alyson and can be used by other projects using alyson
|
||||
/*
|
||||
the following functions are not part of the raylib API,
|
||||
but are used by alyson and can be used by other projects using alyson
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
TEXT_ORIENTATION_LEFT,
|
||||
TEXT_ORIENTATION_RIGHT,
|
||||
TEXT_ORIENTATION_CENTER
|
||||
TEXT_ORIENTATION_LEFT,
|
||||
TEXT_ORIENTATION_RIGHT,
|
||||
TEXT_ORIENTATION_CENTER
|
||||
} text_orientation_t;
|
||||
|
||||
/*
|
||||
* Draws a text with all possible parameters
|
||||
* @function DrawTextFull
|
||||
* @param font Font to use
|
||||
* @param text Text to draw
|
||||
* @param origin Position to draw the text from
|
||||
* @param orientation Text orientation
|
||||
* @param fontSize Font size
|
||||
* @param spacing Spacing between letters
|
||||
* @param lineSpacing Line spacing
|
||||
* @param tint Tint of the text
|
||||
*/
|
||||
void DrawTextFull(
|
||||
Font font,
|
||||
const char *text,
|
||||
Vector2 origin,
|
||||
text_orientation_t orientation,
|
||||
float fontSize,
|
||||
float spacing,
|
||||
float lineSpacing,
|
||||
Color tint
|
||||
Font font,
|
||||
const char* text,
|
||||
Vector2 origin,
|
||||
text_orientation_t orientation,
|
||||
float rotation,
|
||||
float fontSize,
|
||||
float spacing,
|
||||
float lineSpacing,
|
||||
Color tint
|
||||
);
|
||||
|
||||
#ifndef RLAYSON_NO_ANIMATION
|
||||
#include <animation/sprite.h>
|
||||
// other animation types
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif // RLYSON_HPP
|
Loading…
Add table
Add a link
Reference in a new issue