mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2024-12-05 00:38:00 +01:00
character: Add SetSpritesheetPosition
This commit is contained in:
parent
bf1f58b308
commit
51e0a25734
2 changed files with 16 additions and 0 deletions
|
@ -109,6 +109,21 @@ SYMBOL_EXPORT void EnqueueSpritesheet(struct Game* game, struct Character* chara
|
|||
character->successor = strdup(name);
|
||||
}
|
||||
|
||||
SYMBOL_EXPORT void SetSpritesheetPosition(struct Game* game, struct Character* character, int frame) {
|
||||
struct Spritesheet* spritesheet = character->spritesheet;
|
||||
if (!spritesheet) {
|
||||
return;
|
||||
}
|
||||
if (spritesheet->stream) {
|
||||
PrintConsole(game, "%s: tried to set position of a streaming spritesheet %s!", character->name, spritesheet->name);
|
||||
return;
|
||||
}
|
||||
if (frame < spritesheet->frame_count) {
|
||||
character->pos = frame;
|
||||
character->frame = &character->spritesheet->frames[character->pos];
|
||||
}
|
||||
}
|
||||
|
||||
SYMBOL_EXPORT struct Spritesheet* GetSpritesheet(struct Game* game, struct Character* character, char* name) {
|
||||
struct Spritesheet* tmp = character->spritesheets;
|
||||
while (tmp) {
|
||||
|
|
|
@ -143,6 +143,7 @@ void RegisterSpritesheet(struct Game* game, struct Character* character, char* n
|
|||
void RegisterStreamedSpritesheet(struct Game* game, struct Character* character, char* name, SpritesheetStream* callback, SpritesheetStreamDestructor* destructor, void* data);
|
||||
void RegisterSpritesheetFromBitmap(struct Game* game, struct Character* character, char* name, ALLEGRO_BITMAP* bitmap);
|
||||
struct Spritesheet* GetSpritesheet(struct Game* game, struct Character* character, char* name);
|
||||
void SetSpritesheetPosition(struct Game* game, struct Character* character, int frame);
|
||||
|
||||
ALLEGRO_TRANSFORM GetCharacterTransform(struct Game* game, struct Character* character);
|
||||
ALLEGRO_COLOR GetCharacterTint(struct Game* game, struct Character* character);
|
||||
|
|
Loading…
Reference in a new issue