◆ MLV_Animation_player
Ce type code un lecteur d'animation. Un lecteur d'animation est une structure qui permet d'animer une animation. Cette structure contient :
L'aiguille de l'horologe interne d'une animation avance d'une unité à chaque appel de la fonction MLV_update_animation_player(). Les animations sont alors jouée en fonction de l'évolution du temps de chaque animateur. Ainsi, deux lecteurs différents peuvent avoir une courbe du temps différente. La bonne façon d'utiliser des lecteurs est de mettre a jour tous les lecteurs en même temps à un intervalle de temps régulier. Pour cela vous pouvez utiliser la fonction framerate qui endort le programme de façon a assurer l'execution d'un tour de boucle à une fréquence donnée Voici un exemple d'utilisation du lecteur : int time_per_image = 1;
MLV_Animation* animation;
animation = MLV_create_animation( 2 );
MLV_change_frame_in_animation( creature1, time_per_image, animation, 0 );
MLV_change_frame_in_animation( creature2, time_per_image, animation, 0 );
MLV_Animation_player* animation_player;
animation_player = MLV_create_animation_player( animation );
int frequence = 24; // nombre d'images par secondes
MLV_change_frame_rate( frequence );
while( 1 ){
MLV_update_animation_player( animation_player );
MLV_draw_image_from_animation_player(0, 0, 0, animation_player);
MLV_frame_rate_delay();
}
struct _MLV_Animation MLV_Animation Ce type code une animation. Definition: MLV_animation.h:91 struct _MLV_Animation_player MLV_Animation_player Ce type code un lecteur d'animation. Definition: MLV_animation.h:290 MLV_Animation * MLV_create_animation(unsigned int nb_frames, unsigned int nb_layers, unsigned int nb_channels) Créé une animation comportant un nombre d'image donné void MLV_change_frame_in_animation(MLV_Image **array_of_images, MLV_Sound **array_of_sounds, unsigned int delay, MLV_Animation *animation, unsigned int position) Change un animation en remplacant une image et son temps d'affichage associé. L'image concerné est re... void MLV_update_animation_player(MLV_Animation_player *animation_player) Met a jour un lecteur d'animation. MLV_Animation_player * MLV_create_animation_player(MLV_Animation *animation) Cree un lecteur d'animation et l'initialise avec une animation donnée en paramètre. void MLV_draw_image_from_animation_player(MLV_Animation_player *animation_player, unsigned int layer, int x, int y) Dessine à une position donnée l'image actuellement lue par l'animateur. Cette image est situè à une c... struct _MLV_Image MLV_Image Définit le type Image dans la bibliothèque MLV. Definition: MLV_image.h:53 MLV_Image * MLV_load_image(const char *file_image) Charge en mémoire une image contenue dans un fichier. void MLV_change_frame_rate(int rate) Configure la fréquence de rafraichissement en Hz. |