# Documentation de la bibliothèque MLV-0.6.705

- Presentation
- Téléchargement
- Installation
- Compilation
- Exemples
- API
- Liste des fonctions
- bogues
- contacts

# MLV_animation.h

Aller à la documentation de ce fichier.

    00001 /*
    00002  *   This file is part of the MLV Library.
    00003  *
    00004  *   Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein
    00005  *
    00006  *
    00007  *    This Library is free software: you can redistribute it and/or modify
    00008  *    it under the terms of the GNU General Public License as published by
    00009  *    the Free Software Foundation, either version 3 of the License, or
    00010  *    (at your option) any later version.
    00011  *
    00012  *    This Library is distributed in the hope that it will be useful,
    00013  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00015  *    GNU General Public License for more details.
    00016  *
    00017  *    You should have received a copy of the GNU General Public License
    00018  *    along with this Library.  If not, see <http://www.gnu.org/licenses/>.
    00019  */
    00020
    00034 #ifndef __MLV__MLV_ANIMATION_H__
    00035 #define __MLV__MLV_ANIMATION_H__
    00036
    00037 #include "MLV_image.h"
    00038 #include "MLV_audio.h"
    00039
    00040 #ifdef __cplusplus
    00041 extern "C" {
    00042 #endif
    00043
    00045 //    Animation data
    00047
    00091 typedef struct _MLV_Animation MLV_Animation;
    00092
    00121 MLV_Animation* MLV_create_animation(
    00122         unsigned int nb_frames, unsigned int nb_layers, unsigned int nb_channels
    00123 );
    00124
    00130 void MLV_free_animation( MLV_Animation* animation );
    00131
    00145 void MLV_change_frame_in_animation(
    00146         MLV_Image** array_of_images, MLV_Sound** array_of_sounds, unsigned int delay,
    00147         MLV_Animation* animation, unsigned int position
    00148 );
    00149
    00160 void MLV_change_frame_image_in_animation(
    00161         MLV_Image* image, MLV_Animation* animation, unsigned int position,
    00162         unsigned int layer
    00163 );
    00164
    00175 void MLV_change_frame_sound_in_animation(
    00176         MLV_Sound* sound, MLV_Animation* animation, unsigned int position,
    00177         unsigned int channel
    00178 );
    00179
    00187 void MLV_change_frame_delay_in_animation(
    00188         unsigned int delay, MLV_Animation* animation, unsigned int position
    00189 );
    00190
    00201 void MLV_get_frame_from_animation(
    00202         MLV_Animation* animation, unsigned int position,
    00203         unsigned int layer,
    00204         MLV_Image** image, unsigned int* delay
    00205 );
    00206
    00207
    00208
    00218 int MLV_get_frame_delay_from_animation(
    00219         MLV_Animation* animation, unsigned int position
    00220 );
    00221
    00232 MLV_Image* MLV_get_frame_image_from_animation(
    00233         MLV_Animation* animation, unsigned int position,
    00234         unsigned int layer
    00235 );
    00236
    00237
    00238
    00239
    00241 //    Animation engine
    00243
    00290 typedef struct _MLV_Animation_player MLV_Animation_player;
    00291
    00292
    00301 MLV_Animation_player* MLV_create_animation_player( MLV_Animation* animation );
    00302
    00308 void MLV_free_animation_player( MLV_Animation_player* animation_player );
    00309
    00315 void MLV_play_animation_player( MLV_Animation_player* animation_player );
    00316
    00322 void MLV_play_revert_animation_player( MLV_Animation_player* animation_player );
    00323
    00329 void MLV_stop_animation_player( MLV_Animation_player* animation_player );
    00330
    00337 void MLV_rewind_animation_player( MLV_Animation_player* animation_player );
    00338
    00344 void MLV_next_frame( MLV_Animation_player* animation_player );
    00345
    00351 void MLV_previous_frame( MLV_Animation_player* animation_player );
    00352
    00364 void MLV_update_animation_player( MLV_Animation_player* animation_player );
    00365
    00373 void MLV_change_sound_volume_of_animation_player(
    00374         MLV_Animation_player* animation_player, unsigned int channel, float volume
    00375 );
    00376
    00383 void MLV_turn_on_sound_of_animation_player(
    00384         MLV_Animation_player* animation_player, unsigned int channel
    00385 );
    00386
    00393 void MLV_turn_off_sound_of_animation_player(
    00394         MLV_Animation_player* animation_player, unsigned int channel
    00395 );
    00396
    00397
    00399 //    Drawing animation
    00401
    00413 void MLV_draw_image_from_animation_player(
    00414         MLV_Animation_player* animation_player, unsigned int layer,
    00415         int x, int y
    00416 );
    00417
    00427 void MLV_play_sound_from_animation_player(
    00428         MLV_Animation_player* animation_player, unsigned int layer
    00429 );
    00430
    00453 void MLV_play_sounds_from_animation_player(
    00454         MLV_Animation_player* animation_player,
    00455         ...
    00456 );
    00457
    00467 void MLV_play_list_of_sounds_from_animation_player(
    00468         MLV_Animation_player* animation_player, unsigned int* layers,
    00469         unsigned int nb_layers
    00470 );
    00471
    00472
    00490 void MLV_draw_partial_image_from_animation_player(
    00491         MLV_Animation_player* animation_player, unsigned int layer,
    00492         int source_x, int source_y, int source_width, int source_height,
    00493         MLV_Image* image,
    00494         int x, int y
    00495 );
    00496
    00509 void MLV_draw_image_from_animation_player_on_image(
    00510         MLV_Animation_player* animation_player, unsigned int layer,
    00511         MLV_Image* image,
    00512         int x, int y
    00513 );
    00514
    00532 void MLV_draw_partial_image_from_animation_player_on_image(
    00533         MLV_Animation_player* animation_player, unsigned int layer,
    00534         int source_x, int source_y, int source_width, int source_height,
    00535         MLV_Image* image,
    00536         int x, int y
    00537 );
    00538
    00539
    00540
    00541
    00543 //    Loading animations from files
    00545
    00553 typedef struct _MLV_Animation_book MLV_Animation_book;
    00554
    00555
    00570 MLV_Animation_book* MLV_load_animation_book(
    00571         const char* xml_file,
    00572         const char* image_directory,
    00573         const char* sound_directory
    00574 );
    00575
    00581 void MLV_free_animation_book(
    00582         MLV_Animation_book* animation_book
    00583 );
    00584
    00591 int MLV_get_number_of_animations(
    00592         MLV_Animation_book* animation_book
    00593 );
    00594
    00602 MLV_Animation* MLV_get_animation_from_id(
    00603         MLV_Animation_book* animation_book,
    00604         int id
    00605 );
    00606
    00614 MLV_Animation* MLV_get_animation_from_name(
    00615         MLV_Animation_book* animation_book,
    00616         const char* name
    00617 );
    00618
    00627 const char* MLV_get_name_from_id_animation(
    00628         MLV_Animation_book* animation_book, int id_animation
    00629 );
    00630
    00645 void MLV_add_frame_in_animation(
    00646         MLV_Image** array_of_images, MLV_Sound** array_of_sounds,  unsigned int delay,
    00647         MLV_Animation* animation
    00648 );
    00649
    00650 #ifdef __cplusplus
    00651 }
    00652 #endif
    00653
    00654 #endif
    00655