Documentation de la bibliothèque MLV-2.0.2

MLV_animation.h
Aller à la documentation de ce fichier.
1 /*
2  * This file is part of the MLV Library.
3  *
4  * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein
5  *
6  *
7  * This Library is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This Library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this Library. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
34 #ifndef __MLV__MLV_ANIMATION_H__
35 #define __MLV__MLV_ANIMATION_H__
36 
37 #include "MLV_image.h"
38 #include "MLV_audio.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
45 // Animation data
47 
91 typedef struct _MLV_Animation MLV_Animation;
92 
122  unsigned int nb_frames, unsigned int nb_layers, unsigned int nb_channels
123 );
124 
130 void MLV_free_animation( MLV_Animation* animation );
131 
146  MLV_Image** array_of_images, MLV_Sound** array_of_sounds, unsigned int delay,
147  MLV_Animation* animation, unsigned int position
148 );
149 
161  MLV_Image* image, MLV_Animation* animation, unsigned int position,
162  unsigned int layer
163 );
164 
176  MLV_Sound* sound, MLV_Animation* animation, unsigned int position,
177  unsigned int channel
178 );
179 
188  unsigned int delay, MLV_Animation* animation, unsigned int position
189 );
190 
202  MLV_Animation* animation, unsigned int position,
203  unsigned int layer,
204  MLV_Image** image, unsigned int* delay
205 );
206 
207 
208 
219  MLV_Animation* animation, unsigned int position
220 );
221 
233  MLV_Animation* animation, unsigned int position,
234  unsigned int layer
235 );
236 
237 
238 
239 
241 // Animation engine
243 
290 typedef struct _MLV_Animation_player MLV_Animation_player;
291 
292 
302 
308 void MLV_free_animation_player( MLV_Animation_player* animation_player );
309 
315 void MLV_play_animation_player( MLV_Animation_player* animation_player );
316 
323 
329 void MLV_stop_animation_player( MLV_Animation_player* animation_player );
330 
337 void MLV_rewind_animation_player( MLV_Animation_player* animation_player );
338 
344 void MLV_next_frame( MLV_Animation_player* animation_player );
345 
351 void MLV_previous_frame( MLV_Animation_player* animation_player );
352 
364 void MLV_update_animation_player( MLV_Animation_player* animation_player );
365 
374  MLV_Animation_player* animation_player, unsigned int channel, float volume
375 );
376 
384  MLV_Animation_player* animation_player, unsigned int channel
385 );
386 
394  MLV_Animation_player* animation_player, unsigned int channel
395 );
396 
397 
399 // Drawing animation
401 
414  MLV_Animation_player* animation_player, unsigned int layer,
415  int x, int y
416 );
417 
428  MLV_Animation_player* animation_player, unsigned int layer
429 );
430 
454  MLV_Animation_player* animation_player,
455  ...
456 );
457 
468  MLV_Animation_player* animation_player, unsigned int* layers,
469  unsigned int nb_layers
470 );
471 
472 
491  MLV_Animation_player* animation_player, unsigned int layer,
492  int source_x, int source_y, int source_width, int source_height,
493  MLV_Image* image,
494  int x, int y
495 );
496 
510  MLV_Animation_player* animation_player, unsigned int layer,
511  MLV_Image* image,
512  int x, int y
513 );
514 
533  MLV_Animation_player* animation_player, unsigned int layer,
534  int source_x, int source_y, int source_width, int source_height,
535  MLV_Image* image,
536  int x, int y
537 );
538 
539 
540 
541 
543 // Loading animations from files
545 
553 typedef struct _MLV_Animation_book MLV_Animation_book;
554 
555 
571  const char* xml_file,
572  const char* image_directory,
573  const char* sound_directory
574 );
575 
582  MLV_Animation_book* animation_book
583 );
584 
592  MLV_Animation_book* animation_book
593 );
594 
603  MLV_Animation_book* animation_book,
604  int id
605 );
606 
615  MLV_Animation_book* animation_book,
616  const char* name
617 );
618 
628  MLV_Animation_book* animation_book, int id_animation
629 );
630 
646  MLV_Image** array_of_images, MLV_Sound** array_of_sounds, unsigned int delay,
647  MLV_Animation* animation
648 );
649 
650 #ifdef __cplusplus
651 }
652 #endif
653 
654 #endif
655 
struct _MLV_Animation_book MLV_Animation_book
Ce type correspond à un livre contenant de nombreuses animations.
Definition: MLV_animation.h:553
void MLV_draw_partial_image_from_animation_player(MLV_Animation_player *animation_player, unsigned int layer, int source_x, int source_y, int source_width, int source_height, MLV_Image *image, int x, int y)
Dessine à l'écran à une position donnée, une portion de l'image actuellement lue par l'animateur et e...
void MLV_play_sounds_from_animation_player(MLV_Animation_player *animation_player,...)
Même chose que MLV_play_sound_from_animation_player() sauf que cette fonction permet de lancer plusie...
void MLV_turn_on_sound_of_animation_player(MLV_Animation_player *animation_player, unsigned int channel)
Active le son du canal d'un lecteur d'animation donnée.
MLV_Image * MLV_get_frame_image_from_animation(MLV_Animation *animation, unsigned int position, unsigned int layer)
Renvoie l'image présente à une position et une couche donnée d'une animation donnée.
Ce fichier définit tous les prototypes concernant les fonctions permettant d'insérer des images...
void MLV_play_sound_from_animation_player(MLV_Animation_player *animation_player, unsigned int layer)
Joue le son d'une couche sonore donnée correspondant à l'image en cours de lecture dans l'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_partial_image_from_animation_player_on_image(MLV_Animation_player *animation_player, unsigned int layer, int source_x, int source_y, int source_width, int source_height, MLV_Image *image, int x, int y)
Dessine sur une image donnée à une position donnée une portion de l'image actuellement lue par l'anim...
void MLV_draw_image_from_animation_player_on_image(MLV_Animation_player *animation_player, unsigned int layer, MLV_Image *image, int x, int y)
Dessine sur une image donnée à une position donnée l'image actuellement lue par l'animateur et située...
void MLV_free_animation_book(MLV_Animation_book *animation_book)
Libère la memoire contenue par le livre d'animation.
void MLV_change_frame_image_in_animation(MLV_Image *image, MLV_Animation *animation, unsigned int position, unsigned int layer)
Change un animation en remplacant uniquement une image. L'image concerné est repéré à l'aide de son i...
void MLV_free_animation(MLV_Animation *animation)
Cette fonction libère les données allouées pour l'animation.
void MLV_add_frame_in_animation(MLV_Image **array_of_images, MLV_Sound **array_of_sounds, unsigned int delay, MLV_Animation *animation)
Ajoute un image dans la séquence d'animation. Cette fonction ne peux pas augmenter le nombre d'image ...
void MLV_change_frame_delay_in_animation(unsigned int delay, MLV_Animation *animation, unsigned int position)
Change le temps d'affichage d'une image donnée d'une animation.
void MLV_rewind_animation_player(MLV_Animation_player *animation_player)
Demande à l'animateur de reprendre la lecture de l'animation depuis le début.
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_next_frame(MLV_Animation_player *animation_player)
Force le lecteur d'animation à passer à l'image suivante.
void MLV_get_frame_from_animation(MLV_Animation *animation, unsigned int position, unsigned int layer, MLV_Image **image, unsigned int *delay)
Recupère l'image et le temps présents à une position et une couche donnée d'une animation.
struct _MLV_Image MLV_Image
Définit le type Image dans la bibliothèque MLV.
Definition: MLV_image.h:53
void MLV_play_revert_animation_player(MLV_Animation_player *animation_player)
Demande à un lecteur d'animation donné de jouer l'animation à l'envers.
int MLV_get_frame_delay_from_animation(MLV_Animation *animation, unsigned int position)
Renvoie le temps d'affichage de l'image présente à une position donnée d'une animation donnée...
void MLV_play_animation_player(MLV_Animation_player *animation_player)
Demare la lecture de l'animation lu par le lecteur d'animation.
MLV_Animation_book * MLV_load_animation_book(const char *xml_file, const char *image_directory, const char *sound_directory)
Charge en memoire un livre contenant une multitude d'animations.
struct _MLV_Sound MLV_Sound
Ce type code un échantillon sonore.
Definition: MLV_audio.h:53
void MLV_previous_frame(MLV_Animation_player *animation_player)
Force l'animateur à revenir sur l'image précédente.
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...
MLV_Animation * MLV_get_animation_from_id(MLV_Animation_book *animation_book, int id)
Renvoie une animation donnée contenue dans le livre d'animation.
const char * MLV_get_name_from_id_animation(MLV_Animation_book *animation_book, int id_animation)
Renvoie le nom d'un animation à partir de son identifiant dans le livre d'animation.
struct _MLV_Animation MLV_Animation
Ce type code une animation.
Definition: MLV_animation.h:91
void MLV_turn_off_sound_of_animation_player(MLV_Animation_player *animation_player, unsigned int channel)
Désactive le son du canal d'une animation donnée.
void MLV_update_animation_player(MLV_Animation_player *animation_player)
Met a jour un lecteur d'animation.
void MLV_change_frame_sound_in_animation(MLV_Sound *sound, MLV_Animation *animation, unsigned int position, unsigned int channel)
Change un animation en remplacant uniquement un bruitage. Le son image concerné est repéré à l'aide d...
struct _MLV_Animation_player MLV_Animation_player
Ce type code un lecteur d'animation.
Definition: MLV_animation.h:290
void MLV_change_sound_volume_of_animation_player(MLV_Animation_player *animation_player, unsigned int channel, float volume)
Change le volume sonore d'un bruitage.
void MLV_stop_animation_player(MLV_Animation_player *animation_player)
Met en pause la lecture d'un lecteur d'animation donné.
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...
void MLV_play_list_of_sounds_from_animation_player(MLV_Animation_player *animation_player, unsigned int *layers, unsigned int nb_layers)
Même chose que MLV_play_sound_from_animation_player() sauf que cette fonction permet de lancer plusie...
Ce fichier définit les prototypes des fonctions permettant de faire jouer de la musique et des échant...
MLV_Animation * MLV_get_animation_from_name(MLV_Animation_book *animation_book, const char *name)
Renvoie une animation donnée contenue dans le livre d'animation.
void MLV_free_animation_player(MLV_Animation_player *animation_player)
Libère l'espace mémoire alloué pour un animateur donné.
int MLV_get_number_of_animations(MLV_Animation_book *animation_book)
Détermine le nombre d'animations contenus par le livre d'animation.