BSB Developer Docs
Loading...
Searching...
No Matches
anim_player.h
Go to the documentation of this file.
1
5#pragma once
6
7#include <gui/widget.h>
8#include <anim_file/anim_file.h>
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14typedef enum {
15 AnimPlayerOptionNone = 0,
16 AnimPlayerOptionIntermediateInternalBuffer =
17 (1
18 << 0), //<! Allow subpixel movement of resulting images (using @c anim_player_set_offset)
19 AnimPlayerOptionMAX,
20} AnimPlayerOption;
21
22typedef struct AnimPlayer AnimPlayer;
23
32
38void anim_player_free(AnimPlayer* instance);
39
48
60bool anim_player_set_source(AnimPlayer* instance, const char* path);
61
74bool anim_player_set_source_ex(AnimPlayer* instance, const char* path, AnimPlayerOption options);
75
85bool anim_player_set_offset(AnimPlayer* instance, float x, float y);
86
96bool anim_player_set_section(AnimPlayer* instance, AnimFilePlayFlag flags, const char* name);
97
107bool anim_player_start(AnimPlayer* instance);
108
116bool anim_player_pause(AnimPlayer* instance);
117
125typedef void (
126 *AnimPlayerFrameCallback)(AnimPlayer* instance, const AnimFileFrameInfo* info, void* context);
127
138 AnimPlayer* instance,
140 void* context);
141
142#ifdef __cplusplus
143}
144#endif
bool anim_player_set_source(AnimPlayer *instance, const char *path)
Loads the animation file at the specified path.
Definition anim_player.c:189
bool anim_player_set_source_ex(AnimPlayer *instance, const char *path, AnimPlayerOption options)
Loads the animation file at the specified path.
Definition anim_player.c:139
bool anim_player_set_offset(AnimPlayer *instance, float x, float y)
Moves the animation within its widget's viewport.
Definition anim_player.c:193
AnimPlayer * anim_player_alloc(Widget *parent)
Allocates an AnimPlayer GUI element that plays an animation file.
Definition anim_player.c:117
void anim_player_set_frame_callback(AnimPlayer *instance, AnimPlayerFrameCallback callback, void *context)
Calls the specified callback every time a frame is played.
Definition anim_player.c:226
bool anim_player_set_section(AnimPlayer *instance, AnimFilePlayFlag flags, const char *name)
Sets the current section to be played back, using a section name.
Definition anim_player.c:205
bool anim_player_start(AnimPlayer *instance)
Starts or resumes playback of the animation.
Definition anim_player.c:211
void(* AnimPlayerFrameCallback)(AnimPlayer *instance, const AnimFileFrameInfo *info, void *context)
Playback frame callback.
Definition anim_player.h:126
Widget * anim_player_get_base(AnimPlayer *instance)
Base Widget class.
Definition anim_player.c:134
void anim_player_free(AnimPlayer *instance)
Frees an AnimPlayer GUI element.
Definition anim_player.c:129
bool anim_player_pause(AnimPlayer *instance)
Pauses playback of the animation.
Definition anim_player.c:219
Complete information about the just-shown frame.
Definition anim_file.h:80
Definition anim_player_i.h:4
Definition widget_i.h:35
Base widget class.