You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Load [Aseprite](https://www.aseprite.org/) files directly for use in raylib
10
+
- Draw individual frames
11
+
- Load and draw [Aseprite tags](https://www.aseprite.org/docs/tags/) as sprite animations
12
+
- Support for Forwards, Backwards, and Ping-Pong animations
13
+
- Adjust tag animation speed by using `tag.speed`
14
+
- Pause tag animations by using `tag.pause`
15
+
- Toggle whether animations will continue when they finish with `tag.loop`
16
+
7
17
## Usage
8
18
9
-
This is a header-only library. To use it, define `RAYLIB_ASEPRITE_IMPLEMENTATION` in one .c source file before including *raylib-aseprite.h*. You will also have to link the raylib dependency.
19
+
This is a header-only library. To use it, define `RAYLIB_ASEPRITE_IMPLEMENTATION` in one .c source file before including [*raylib-aseprite.h*](include). You will also have to link the raylib dependency.
10
20
11
21
### Example
12
22
@@ -19,37 +29,40 @@ This is a header-only library. To use it, define `RAYLIB_ASEPRITE_IMPLEMENTATION
walkdown.speed = 2; // Double the animation speed.
28
38
29
39
while(!WindowShouldClose()) {
30
-
// Update the animation frame for walk down.
40
+
// Update the animation frame.
31
41
UpdateAsperiteTag(&walkdown);
32
42
33
43
BeginDrawing();
34
-
ClearBackground(RAYWHITE);
44
+
{
45
+
ClearBackground(RAYWHITE);
35
46
36
-
// Draw the 0th frame from the backpacker sprite.
37
-
DrawAseprite(backpacker, 0, 100, 100, WHITE);
38
-
39
-
// Draw the Walk Down animation.
40
-
DrawAsepriteTag(walkdown, 200, 100, WHITE);
47
+
// Draw the 0th frame from the George sprite.
48
+
DrawAseprite(george, 0, 100, 100, WHITE);
41
49
50
+
// Draw the Walk Down animation.
51
+
DrawAsepriteTag(walkdown, 200, 100, WHITE);
52
+
}
42
53
EndDrawing();
43
54
}
44
55
45
-
// Clean up the backpacker aseprite.
46
-
UnloadAseprite(backpacker);
56
+
// Clean up the George aseprite.
57
+
UnloadAseprite(george);
47
58
48
59
CloseWindow();
49
60
return 0;
50
61
}
51
62
```
52
63
64
+
See the [examples](examples directory) for more demonstrations of how to use *raylib-aseprite*.
65
+
53
66
### API
54
67
55
68
```c
@@ -62,15 +75,15 @@ void TraceAseprite(Aseprite aseprite); // Display a
62
75
Texture GetAsepriteTexture(Aseprite aseprite); // Retrieve the raylib texture associated with the aseprite
63
76
int GetAsepriteWidth(Aseprite aseprite); // Get the width of the sprite
64
77
int GetAsepriteHeight(Aseprite aseprite); // Get the height of the sprite
65
-
int GetAspriteTagCount(Aseprite aseprite); // Get the total amount of available tags
78
+
int GetAsepriteTagCount(Aseprite aseprite); // Get the total amount of available tags
66
79
void DrawAseprite(Aseprite aseprite, int frame, int posX, int posY, Color tint);
67
80
void DrawAsepriteV(Aseprite aseprite, int frame, Vector2 position, Color tint);
68
81
void DrawAsepriteEx(Aseprite aseprite, int frame, Vector2 position, float rotation, float scale, Color tint);
69
82
void DrawAsepritePro(Aseprite aseprite, int frame, Rectangle dest, Vector2 origin, float rotation, Color tint);
70
83
71
84
// Aseprite Tag functions
72
-
AsepriteTag LoadAsepriteTag(Aseprite aseprite, const char* name); // Load a Aseprite tag animation sequence
73
-
AsepriteTag LoadAsepriteTagFromIndex(Aseprite aseprite, int index); // Load a Aseprite tag animation sequence from its index
85
+
AsepriteTag LoadAsepriteTag(Aseprite aseprite, const char* name); // Load an Aseprite tag animation sequence
86
+
AsepriteTag LoadAsepriteTagFromIndex(Aseprite aseprite, int index); // Load an Aseprite tag animation sequence from its index
74
87
bool IsAsepriteTagReady(AsepriteTag tag); // Check if the given Aseprite tag was loaded successfully
75
88
void UpdateAsepriteTag(AsepriteTag* tag); // Update the tag animation frame
76
89
AsepriteTag GenAsepriteTagDefault(); // Generate an empty Tag with sane defaults
@@ -98,4 +111,4 @@ This uses [cute_asesprite.h](https://github.com/RandyGaul/cute_headers/blob/mast
98
111
99
112
## License
100
113
101
-
raylib-aseprite is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details.
114
+
*raylib-aseprite* is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details.
0 commit comments