Skip to content

Commit 96dc296

Browse files
committed
v0.2.0
1 parent 6c292d7 commit 96dc296

File tree

8 files changed

+212
-82
lines changed

8 files changed

+212
-82
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/build
1+
/build
2+
.vscode

CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.11)
22
project (raylib-aseprite
3-
VERSION 0.1.0
3+
VERSION 0.2.0
44
DESCRIPTION "raylib-aseprite"
55
HOMEPAGE_URL "https://github.com/robloach/raylib-aseprite"
66
LANGUAGES C)
@@ -9,16 +9,15 @@ project (raylib-aseprite
99
add_subdirectory(include)
1010

1111
# Examples
12-
option(RAYLIB_ASEPRITE_BUILD_EXAMPLE "Examples" ON)
12+
option(RAYLIB_ASEPRITE_BUILD_EXAMPLE "Example" ON)
1313
if(RAYLIB_ASEPRITE_BUILD_EXAMPLE)
1414
add_subdirectory(example)
1515
endif()
1616

1717
# Testing
18-
option(RAYLIB_ASEPRITE_BUILD_TESTS "Testing" ON)
1918
include(CTest)
2019
enable_testing()
21-
if(RAYLIB_ASEPRITE_BUILD_TESTS AND RAYLIB_ASEPRITE_BUILD_EXAMPLE)
20+
if(BUILD_TESTING AND RAYLIB_ASEPRITE_BUILD_EXAMPLE)
2221
set(CTEST_CUSTOM_TESTS_IGNORE
2322
pkg-config--static
2423
)

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ int main() {
3636
// Draw the 0th frame from the backpacker sprite.
3737
DrawAseprite(backpacker, 0, 100, 100, WHITE);
3838

39-
// Draw the walkdown animation tag.
39+
// Draw the Walk Down animation.
4040
DrawAsepriteTag(walkdown, 200, 100, WHITE);
4141

4242
EndDrawing();
@@ -53,25 +53,31 @@ int main() {
5353
### Cheatsheet
5454

5555
``` c
56+
// Aseprite
5657
Aseprite LoadAseprite(const char* fileName); // Load an .aseprite file
5758
Aseprite LoadAsepriteFromMemory(unsigned char* fileData, unsigned int size); // Load an aseprite file from memory
59+
bool IsAsepriteReady(Aseprite aseprite); // Check if the given Aseprite was loaded successfully.
5860
void UnloadAseprite(Aseprite aseprite); // Unloads the aseprite file
5961
void TraceAseprite(Aseprite aseprite); // Display all information associated with the aseprite
6062
Texture GetAsepriteTexture(Aseprite aseprite); // Retrieve the raylib texture associated with the aseprite
63+
int GetAsepriteWidth(Aseprite aseprite); // Get the width of the sprite.
64+
int GetAsepriteHeight(Aseprite aseprite); // Get the height of the sprite.
65+
int GetAspriteTagCount(Aseprite aseprite); // Get the total amount of available tags
6166
void DrawAseprite(Aseprite aseprite, int frame, int posX, int posY, Color tint);
6267
void DrawAsepriteV(Aseprite aseprite, int frame, Vector2 position, Color tint);
6368
void DrawAsepriteEx(Aseprite aseprite, int frame, Vector2 position, float rotation, float scale, Color tint);
6469
void DrawAsepritePro(Aseprite aseprite, int frame, Rectangle dest, Vector2 origin, float rotation, Color tint);
6570

71+
// AsepriteTag
6672
AsepriteTag LoadAsepriteTag(Aseprite aseprite, const char* name); // Load a Aseprite tag animation sequence
67-
AsepriteTag LoadAsepriteTagFromId(Aseprite aseprite, int id); // Load a Aseprite tag animation sequence from its index
73+
AsepriteTag LoadAsepriteTagFromIndex(Aseprite aseprite, int index); // Load a Aseprite tag animation sequence from its index
74+
bool IsAsepriteTagReady(AsepriteTag tag); // Check if the given Aseprite tag was loaded successfully.
6875
void UpdateAsepriteTag(AsepriteTag* tag); // Update the tag animation frame if needed
76+
AsepriteTag GenAsepriteTagDefault(); // Generate an empty Tag with sane defaults
6977
void DrawAsepriteTag(AsepriteTag tag, int posX, int posY, Color tint);
7078
void DrawAsepriteTagV(AsepriteTag tag, Vector2 position, Color tint);
7179
void DrawAsepriteTagEx(AsepriteTag tag, Vector2 position, float rotation, float scale, Color tint);
7280
void DrawAsepriteTagPro(AsepriteTag tag, Rectangle dest, Vector2 origin, float rotation, Color tint);
73-
const char* GetAsepriteTagName(AsepriteTag tag); // Retrieve the given tag's name
74-
int GetAspriteTagCount(Aseprite aseprite); // Get the total amount of available tags from the loaded Aseprite
7581
```
7682
7783
## Development

example/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ find_package(raylib QUIET)
33
if (NOT raylib_FOUND)
44
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
55
set(BUILD_GAMES OFF CACHE BOOL "" FORCE)
6-
set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
76
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../vendor/raylib ${CMAKE_CURRENT_SOURCE_DIR}/../vendor/raylib)
87
endif()
98

example/raylib-aseprite-example.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ int main() {
2626
// Load the Aseprite file.
2727
Aseprite aseprite = LoadAseprite("resources/backpacker.aseprite");
2828

29+
if (!IsAsepriteReady(aseprite)) {
30+
TraceLog(LOG_FATAL, "Failed to load resources/backpacker.aseprite");
31+
}
32+
2933
// Display information about it.
3034
TraceAseprite(aseprite);
3135

@@ -55,6 +59,12 @@ int main() {
5559
walkdown.speed = 2;
5660
}
5761

62+
if (IsKeyPressed(KEY_P)) {
63+
walkdown.loop = false;
64+
walkdown.paused = false;
65+
walkdown.currentFrame = walkdown.tag->from_frame;
66+
}
67+
5868
// Update the active animation of the walk down tag.
5969
UpdateAsepriteTag(&walkdown);
6070

0 commit comments

Comments
 (0)