From a39fd44d3a004a407722dae2e1fbb401b2249128 Mon Sep 17 00:00:00 2001 From: Lightemerald Date: Wed, 26 Mar 2025 09:05:12 +0100 Subject: [PATCH] First commit --- MLV/MLV_all.h | 199 ++ MLV/MLV_animation.h | 655 +++++ MLV/MLV_audio.h | 187 ++ MLV/MLV_color.h | 4652 +++++++++++++++++++++++++++++++++ MLV/MLV_device_with_buttons.h | 53 + MLV/MLV_event.h | 361 +++ MLV/MLV_image.h | 623 +++++ MLV/MLV_information.h | 98 + MLV/MLV_input_box.h | 317 +++ MLV/MLV_input_box_va.h | 204 ++ MLV/MLV_keyboard.h | 545 ++++ MLV/MLV_mouse.h | 127 + MLV/MLV_path.h | 172 ++ MLV/MLV_playlist.h | 58 + MLV/MLV_random.h | 70 + MLV/MLV_shape.h | 414 +++ MLV/MLV_text.h | 489 ++++ MLV/MLV_text_va.h | 516 ++++ MLV/MLV_time.h | 119 + MLV/MLV_window.h | 306 +++ MLV/MLV_xml.h | 217 ++ MLV/MLV_xml_va.h | 155 ++ MLV/Makefile.am | 118 + MLV/Makefile.in | 1138 ++++++++ MLV/SDLMain.h | 33 + MLV/SDLMain.m | 398 +++ MLV/animation.c | 1116 ++++++++ MLV/audio.c | 149 ++ MLV/color.c | 4589 ++++++++++++++++++++++++++++++++ MLV/config.h.in | 77 + MLV/data_structure.h | 72 + MLV/event.c | 425 +++ MLV/image.c | 521 ++++ MLV/image.h | 55 + MLV/informations.c | 50 + MLV/input_box.c | 935 +++++++ MLV/input_box.h | 34 + MLV/input_box_wait.c | 187 ++ MLV/key.c | 97 + MLV/key.h | 42 + MLV/keyboard.c | 1678 ++++++++++++ MLV/list.c | 79 + MLV/list.h | 46 + MLV/mathematics.c | 26 + MLV/mathematics.h | 27 + MLV/memory_debug.c | 575 ++++ MLV/memory_debug.h | 556 ++++ MLV/memory_management.h | 38 + MLV/mouse.c | 139 + MLV/path.c | 122 + MLV/platform.h | 34 + MLV/playlist.c | 205 ++ MLV/random.c | 44 + MLV/sdlkeyboardtochar.c | 198 ++ MLV/sdlkeyboardtochar.h | 34 + MLV/shapes.c | 267 ++ MLV/text.c | 940 +++++++ MLV/text.h | 52 + MLV/time.c | 107 + MLV/tree_map.c | 182 ++ MLV/tree_map.h | 52 + MLV/tree_set.c | 527 ++++ MLV/tree_set.h | 57 + MLV/warning_error.h | 43 + MLV/window.c | 387 +++ MLV/xml.c | 376 +++ Makefile | 35 + maison.c | 212 ++ 68 files changed, 27611 insertions(+) create mode 100644 MLV/MLV_all.h create mode 100644 MLV/MLV_animation.h create mode 100644 MLV/MLV_audio.h create mode 100644 MLV/MLV_color.h create mode 100644 MLV/MLV_device_with_buttons.h create mode 100644 MLV/MLV_event.h create mode 100644 MLV/MLV_image.h create mode 100644 MLV/MLV_information.h create mode 100644 MLV/MLV_input_box.h create mode 100644 MLV/MLV_input_box_va.h create mode 100644 MLV/MLV_keyboard.h create mode 100644 MLV/MLV_mouse.h create mode 100644 MLV/MLV_path.h create mode 100644 MLV/MLV_playlist.h create mode 100755 MLV/MLV_random.h create mode 100644 MLV/MLV_shape.h create mode 100644 MLV/MLV_text.h create mode 100644 MLV/MLV_text_va.h create mode 100755 MLV/MLV_time.h create mode 100644 MLV/MLV_window.h create mode 100644 MLV/MLV_xml.h create mode 100644 MLV/MLV_xml_va.h create mode 100644 MLV/Makefile.am create mode 100644 MLV/Makefile.in create mode 100644 MLV/SDLMain.h create mode 100644 MLV/SDLMain.m create mode 100644 MLV/animation.c create mode 100644 MLV/audio.c create mode 100644 MLV/color.c create mode 100644 MLV/config.h.in create mode 100644 MLV/data_structure.h create mode 100644 MLV/event.c create mode 100644 MLV/image.c create mode 100644 MLV/image.h create mode 100644 MLV/informations.c create mode 100644 MLV/input_box.c create mode 100644 MLV/input_box.h create mode 100644 MLV/input_box_wait.c create mode 100644 MLV/key.c create mode 100644 MLV/key.h create mode 100644 MLV/keyboard.c create mode 100644 MLV/list.c create mode 100644 MLV/list.h create mode 100644 MLV/mathematics.c create mode 100644 MLV/mathematics.h create mode 100644 MLV/memory_debug.c create mode 100644 MLV/memory_debug.h create mode 100644 MLV/memory_management.h create mode 100644 MLV/mouse.c create mode 100644 MLV/path.c create mode 100644 MLV/platform.h create mode 100644 MLV/playlist.c create mode 100644 MLV/random.c create mode 100644 MLV/sdlkeyboardtochar.c create mode 100644 MLV/sdlkeyboardtochar.h create mode 100644 MLV/shapes.c create mode 100644 MLV/text.c create mode 100644 MLV/text.h create mode 100644 MLV/time.c create mode 100644 MLV/tree_map.c create mode 100644 MLV/tree_map.h create mode 100644 MLV/tree_set.c create mode 100644 MLV/tree_set.h create mode 100644 MLV/warning_error.h create mode 100644 MLV/window.c create mode 100644 MLV/xml.c create mode 100644 Makefile create mode 100644 maison.c diff --git a/MLV/MLV_all.h b/MLV/MLV_all.h new file mode 100644 index 0000000..e1f1300 --- /dev/null +++ b/MLV/MLV_all.h @@ -0,0 +1,199 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_all.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Fichier d'entête principal incluant tous les autres fichiers entêtes + * de la bibliothèque MLV. + * + * Vous trouverez tous les prototypes des fonctions proprées par la bibliothèque + * MLV dans les fichiers entêtes (.h) suivants : + * + * MLV_animation.h : permet de mettre en oeuvre des animations. + * + * + * MLV_audio.h : permet de jouer de la musique. + * + * + * MLV_color.h : definit les différentes couleurs de la bibliothèque MLV. + * + * + * MLV_event.h : propose une gestion avancée des évènements. Avec les fonctions + * proposées par MLV_evenement.h, il est possible de traiter les évènements + * sans intérrompre l'exécution du programme. + * + * + * MLV_image.h : charger, modifier et afficher des images. + * + * + * MLV_information.h : permet d'obtenir quelques informations concernant la + * bibliothèque MLV (web, auteurs, version). + * + * + * MLV_input_box.h : définit différents outils pour créer et utiliser des + * boîtes de saisies. + * + * + * MLV_keyboard.h : définit les types concerant le clavier et définit la + * fonction MLV_keyboard_wait pour récuperer des évènements + * provenant du clavier. + * + * + * MLV_mouse.h : définit les types concerant la souris ainsi que la fonction + * MLV_mouse_wait pour récuperer des évènements provenant de la + * souris. + * + * + * MLV_path.h : définit différents outils pour utiliser des chemins d'accès aux + * fichiers. + * + * + * MLV_random.h : propose des outils pour engendrer des nombres aléatoires. + * + * + * MLV_shape.h : permet de créer des figures ( cercle, ellipse, polygone, + * courbe de bezier, rectangle, ligne , point). + * + * + * MLV_text.h : définit differents outils permettant d'afficher du texte seul ou + * dans une boîte. + * + * MLV_text_va.h : définit les même outils que MLV_text.h mais en prenant une + * comme argument suplémentaire une liste d'arguments. + * + * MLV_time.h : propose des outils pour gérer le temps. + * + * MLV_xml.h : propose des outils pour lire des fichiers XML. + * + * MLV_xml_va.h : définit les même outils que MLV_xml.h mais en prenant une + * comme argument suplémentaire une liste d'arguments. + * + * MLV_window.h : propose des fonctions pour + * - initialiser, créer et fermer une fenêtre + * - actualiser l'affichage de la fenêtre + * - exécuter du code à la fermeture de la fenêtre + * + * \see MLV_animation.h MLV_audio.h MLV_color.h MLV_event.h MLV_image.h + * MLV_information.h MLV_input_box.h MLV_keyboard.h MLV_mouse.h + * MLV_path.h MLV_random.h MLV_shape.h MLV_text.h MLV_text_va.h MLV_time.h + * MLV_xml.h MLV_xml_va.h MLV_window.h + */ + +/** \~spanish + * \file MLV_all.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Archivo principal de cabecera incluyendo todos los otros archivos de + * cabecera de la biblioteca informática MLV. + * + * Puede encontrar todos los prototipos des las subrutinas propuestas para la + * biblioteca MLV en los archivos de cabecera (.h) suiquiente : + * + * MLV_animation.h : permite de añadir animaciónes. + * + * MLV_audio.h : permite de tocar música. + * + * + * MLV_color.h : défine los differentes colores de la biblioteca MLV. + * + * + * MLV_event.h : proppone una gestión advencada des los eventos. Con las + * subrutinas propuestas para MLV_evenment.h, es possible de + * tratar los eventos sin interrumpir la ejecución del programa + * informático. + * + * + * MLV_shape.h : permite de creer figuras geométricas (círculo, elipse, + * polígono, Curva de Bézier, rectángulo, linea recta, punto). + * + * + * MLV_image.h : modificar and fijara las imagenes. + * + * + * MLV_information.h : permite de obtener algunas noticias concerniendo la + * biblioteca MLV. concernant la + * + * + * MLV_keyboard.h : define los tipos de dato por el teclado y la subrutina + * MLV_keyboard_wait para obtener los eventos del teclado. + * + * + * MLV_mouse.h : define los tipos de dato por el ratón y la subrutina + * MLV_mouse_wait para obtener eventos des ratón. + * + * + * MLV_input_box.h : define algunas herramientas para creer y utilisar caja de + * texto + * + * + * MLV_text.h : define algunas herramientas para fijar textos. + * + * MLV_text_va.h : TODO + * + * MLV_time.h : propone herramientas para utilisar el tiempo. + * + * MLV_xml.h : TODO + * + * MLV_xml_va.h : TODO + * + * MLV_random.h : propone herramientas para generar números aleatorios. + * + * + * MLV_window.h : propone las subrutina para + * - creer, inicializar, cerrar ventanas + * - actualizar la visualización de una ventana + * - ejecutar código al fin del programa + * + * + * \see MLV_animation.h MLV_audio.h MLV_color.h MLV_event.h MLV_shape.h + * MLV_image.h MLV_keyboard.h MLV_mouse.h MLV_input_box.h MLV_random.h + * MLV_text.h MLV_text_va.h MLV_time.h MLV_xml.h MLV_xml_va.h MLV_window.h + */ + +#ifndef __MLV__MLV_ALL_H__ +#define __MLV__MLV_ALL_H__ + +#include "MLV_animation.h" +#include "MLV_audio.h" +#include "MLV_color.h" +#include "MLV_event.h" +#include "MLV_shape.h" +#include "MLV_image.h" +#include "MLV_information.h" +#include "MLV_keyboard.h" +#include "MLV_mouse.h" +#include "MLV_path.h" +#include "MLV_playlist.h" +#include "MLV_input_box.h" +#include "MLV_random.h" +#include "MLV_text.h" +#include "MLV_text_va.h" +#include "MLV_time.h" +#include "MLV_xml.h" +#include "MLV_xml_va.h" +#include "MLV_window.h" + +#endif diff --git a/MLV/MLV_animation.h b/MLV/MLV_animation.h new file mode 100644 index 0000000..7f81283 --- /dev/null +++ b/MLV/MLV_animation.h @@ -0,0 +1,655 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_animation.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * Cette interface est inspiré du tutoriel : + * http://www.gnurou.org/writing/linuxmag/sdl/partie3 + * + * \brief Ce fichier définit les prototypes des fonctions permettant de mettre + * en oeuvre des animations. + */ + +#ifndef __MLV__MLV_ANIMATION_H__ +#define __MLV__MLV_ANIMATION_H__ + +#include "MLV_image.h" +#include "MLV_audio.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//////////////////////////////////////////////// +// Animation data +/////////////////////////////////////////////// + +/** \~french + * \brief Ce type code une animation. + * + * Une animation est une succéssion de k+l+1 uplets. + * Chaque uplet contient : + * - k images, + * - l sons, + * - 1 temps d'affichage + * Les k images correspondent à k représentations différentes d'une + * même scène animée. + * Les l sons correspondent à l différents fonds sonores pour la + * même scène animée. + * Le temps d'affichage est le temps d'affichage des images dans + * l'animation. + * + * On appelle "couche graphique i", l'ensemble des images situées à la + * position i du k+l+1-uplet. + * On appelle "couche sonore j", l'ensemble des sons situées à la + * position k+j du k+l+1-uplet. + * + * Voici la Structure d'une animatione représentée à l'aide d'un tableau : + * + * \verbatim +|-------------------------------------------------------------| +| MLV_Animation | +|-------------------------------------------------------------| +| | +| Couche graphique 0 | Image Image Image ... | +| Couche graphique 1 | Image Image Image ... | +| ... | ... ... ... ... | +| Couche graphique k-1 | Image Image Image ... | +| ------------------------------------------------------- | +| Couche sonore 0 | Son Son Son ... | +| Couche sonore 1 | Son Son Son ... | +| ... | ... ... ... ... | +| Couche sonore k-1 | Son Son Son ... | +| ------------------------------------------------------- | +| Temps d'affichage | 1 3 1 ... | +| | +|-------------------------------------------------------------| +\endverbatim + * + */ +typedef struct _MLV_Animation MLV_Animation; + +/** \~french + * \brief Créé une animation comportant un nombre d'image donné + * + * Une animationV est une succession d'image où à chaque image est + * associé un temps. Ce temps code le temps d'affichage de chaque image, + * lors du rendu de de l'animation. + * Pour des raisons de commodité, nos séquence d'animations sont composés de + * plusieurs couches. Elles sont donc des successions de couches contenant + * chacunes une image. + * + * Une sequence d'animation (à ne pas confondre avec une animation) est une + * pure structure de donnée. Elle peut donc pas s'animer, ni s'afficher à + * l'ecran. + * Pour afficher une séquence d'animation, il faut utiliser une animation, + * qui s'aidera de la séquence d'animation pour s'afficher ou pour mettre en + * mouvement les images de la séquence d'animation. + * + * Le temps d'une s'quence d'animation n'est pas codée en secondes. Il s'agit + * d'un entier. Lorsque vous utilisez une animation, l'animateur à un temps qui + * lui est propre et qui est codé à l'aide d'un entier qui croit. Les duree que + * vous ajouterez dans l'animation sont donc définit par rapport au temps de + * l'animation qui utilise la séquence d'animation. + * + * \param nb_frames Le nombre d'image que doit contenir l'animation + * \param nb_layers Nombre de couches graphique de l'animation. + * \param nb_channels Nombre de canaux sonore de l'animation. + * \return Un pointeur vers une animation. + */ +MLV_Animation* MLV_create_animation( + unsigned int nb_frames, unsigned int nb_layers, unsigned int nb_channels +); + +/** \~french + * \brief Cette fonction libère les données allouées pour l'animation + * + * \param animation L'animation à fermer. + */ +void MLV_free_animation( MLV_Animation* animation ); + +/** \~french + * \brief Change un animation en remplacant une image et son temps d'affichage + * associé. L'image concerné est repéré à l'aide de son index et de + * l'index de la couche où elle appartient. + * + * \param array_of_images Un tableau d'adresse contenant les addresses de images + * correspondat aux différentes couches d'une animation. + * \param array_of_sounds Un tableau d'adresse contenant les addresses de sons + * correspondant aux différentes canaux d'une animation. + * \param delay temps d'affichage de l'image + * \param animation Animation à modifier + * \param position position de l'image dans l'animation + */ +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 +); + +/** \~french + * \brief Change un animation en remplacant uniquement une image. + * L'image concerné est repéré à l'aide de son index et de + * de l'index de sa couche. + * + * \param image image a ajouter dans l'animation + * \param animation Animation à modifier + * \param position position de l'image dans l'animation + * \param layer Couche de l'image. + */ +void MLV_change_frame_image_in_animation( + MLV_Image* image, MLV_Animation* animation, unsigned int position, + unsigned int layer +); + +/** \~french + * \brief Change un animation en remplacant uniquement un bruitage. + * Le son image concerné est repéré à l'aide de son index et de + * de l'index de son canaul. + * + * \param sound son a ajouter dans l'animation + * \param animation Animation à modifier + * \param position position de l'image dans l'animation + * \param channel Canal du son. + */ +void MLV_change_frame_sound_in_animation( + MLV_Sound* sound, MLV_Animation* animation, unsigned int position, + unsigned int channel +); + +/** \~french + * \brief Change le temps d'affichage d'une image donnée d'une animation. + * + * \param delay temps d'affichage de l'image + * \param animation Animation à modifier + * \param position position de l'image dans l'animation + */ +void MLV_change_frame_delay_in_animation( + unsigned int delay, MLV_Animation* animation, unsigned int position +); + +/** \~french + * \brief Recupère l'image et le temps présents à une position et une couche + * donnée d'une animation. + * + * \param animation Animation à modifier + * \param layer Couche de l'image. + * \param position position de l'image dans l'animation + * \param image image a ajouter dans l'animation + * \param delay temps d'affichage de l'image + */ +void MLV_get_frame_from_animation( + MLV_Animation* animation, unsigned int position, + unsigned int layer, + MLV_Image** image, unsigned int* delay +); + + + +/** \~french + * \brief Renvoie le temps d'affichage de l'image présente à une position + * donnée d'une animation donnée. + * + * \param animation Animation à modifier + * \param position position de l'image dans l'animation + * + * \return le temps d'affichage de l'image + */ +int MLV_get_frame_delay_from_animation( + MLV_Animation* animation, unsigned int position +); + +/** \~french + * \brief Renvoie l'image présente à une position et une couche donnée d'une + * animation donnée. + * + * \param animation Animation à modifier + * \param position position de l'image dans l'animation + * \param layer Couche de l'image. + * + * \return l'image extraite. + */ +MLV_Image* MLV_get_frame_image_from_animation( + MLV_Animation* animation, unsigned int position, + unsigned int layer +); + + + + +//////////////////////////////////////////////// +// Animation engine +/////////////////////////////////////////////// + +/** \~french + * \brief Ce type code un lecteur d'animation. + * + * Un lecteur d'animation est une structure qui permet d'animer une animation. + * Cette structure contient : + * - un pointeur vers une animation + * - la position de l'image courante de l'animation + * - une horloge interne ( dont le temps est discret et indépendant du temps courant ) + * + * + * + * 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 : + * \code + * MLV_Image* creature1 = MLV_load_image("creature1.png"); + * MLV_Image* creature2 = MLV_load_image("creature2.png"); + * 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(); + * } + * \endcode + * + */ +typedef struct _MLV_Animation_player MLV_Animation_player; + + +/** \~french + * \brief Cree un lecteur d'animation et l'initialise avec une animation donnée en + * paramètre. + * + * \param animation L'animation que devra animer l'animateur. + * + * \return L'animateur créé. + */ +MLV_Animation_player* MLV_create_animation_player( MLV_Animation* animation ); + +/** \~french + * \brief Libère l'espace mémoire alloué pour un animateur donné. + * + * \param animation_player Le lecteur d'animation à suprimer + */ +void MLV_free_animation_player( MLV_Animation_player* animation_player ); + +/** \~french + * \brief Demare la lecture de l'animation lu par le lecteur d'animation. + * + * \param animation_player Le lecteur d'animation + */ +void MLV_play_animation_player( MLV_Animation_player* animation_player ); + +/** \~french + * \brief Demande à un lecteur d'animation donné de jouer l'animation à l'envers. + * + * \param animation_player Le lecteur d'animation + */ +void MLV_play_revert_animation_player( MLV_Animation_player* animation_player ); + +/** \~french + * \brief Met en pause la lecture d'un lecteur d'animation donné. + * + * \param animation_player Le lecteur d'animation + */ +void MLV_stop_animation_player( MLV_Animation_player* animation_player ); + +/** \~french + * \brief Demande à l'animateur de reprendre la lecture de l'animation depuis le + * début. + * + * \param animation_player Le lecteur d'animation + */ +void MLV_rewind_animation_player( MLV_Animation_player* animation_player ); + +/** \~french + * \brief Force le lecteur d'animation à passer à l'image suivante. + * + * \param animation_player Le lecteur d'animation + */ +void MLV_next_frame( MLV_Animation_player* animation_player ); + +/** \~french + * \brief Force l'animateur à revenir sur l'image précédente. + * + * \param animation_player Le lecteur d'animation + */ +void MLV_previous_frame( MLV_Animation_player* animation_player ); + +/** \~french + * \brief Met a jour un lecteur d'animation. + * + * L'horloge interne du lecteur voit son temps incrémenter de 1 unité + * exactement. + * + * La position de lecture de l'animation est mis a jour en conséquence de la + * mis à jour de l'horloge interne. + * + * \param animation_player Le lecteur d'animation à mettre à jour + */ +void MLV_update_animation_player( MLV_Animation_player* animation_player ); + +/** \~french + * \brief Change le volume sonore d'un bruitage. + * + * \param animation_player L'animateur dans lequel se trouve le son. + * \param channel Le canal concerné. + * \param volume le nouveau volume sonore. + */ +void MLV_change_sound_volume_of_animation_player( + MLV_Animation_player* animation_player, unsigned int channel, float volume +); + +/** \~french + * \brief Active le son du canal d'un lecteur d'animation donnée. + * + * \param animation_player L'animateur concerné. + * \param channel Le canal concerné. + */ +void MLV_turn_on_sound_of_animation_player( + MLV_Animation_player* animation_player, unsigned int channel +); + +/** \~french + * \brief Désactive le son du canal d'une animation donnée. + * + * \param animation_player L'animateur concerné. + * \param channel Le canal concerné. + */ +void MLV_turn_off_sound_of_animation_player( + MLV_Animation_player* animation_player, unsigned int channel +); + + +//////////////////////////////////////////////// +// Drawing animation +/////////////////////////////////////////////// + +/** \~french + * \brief Dessine à une position donnée l'image actuellement lue par + * l'animateur. Cette image est situè à une couche donnée en paramètre. + * + * \param animation_player Le lecteur de l'animation à aficher + * \param layer Couche de l'image. + * \param x Coordonnée en X de la position du sommet Nord-Ouest de + * l'image à afficher. + * \param y Coordonnée en Y de la position du sommet Nord-Ouest de + * l'image à afficher. + */ +void MLV_draw_image_from_animation_player( + MLV_Animation_player* animation_player, unsigned int layer, + int x, int y +); + +/** \~french + * \brief Joue le son d'une couche sonore donnée correspondant à l'image en + * cours de lecture dans l'animation. + * + * Si le son a déjà été joué, cette fonction ne fait rien. + * + * \param animation_player Le lecteur de l'animation à aficher. + * \param layer Couche du son. + */ +void MLV_play_sound_from_animation_player( + MLV_Animation_player* animation_player, unsigned int layer +); + +/** \~french + * \brief Même chose que MLV_play_sound_from_animation_player() sauf que cette + * fonction permet de lancer plusieurs sons en même temps. + * + * La liste des couches sonores à jouer doivent être passé en paramètre + * (un paramètre par couche), et le dernier paramètre doit valoir -1 pour + * dire à la fonction quand il doit s'arrêter. + * + * Par exemple, pour jouer les couches 2, 3 et 5 d'une animation, + * il suffit d'écrire: + * + * \code + * MLV_play_sounds_from_animation_player( + * animation, + * 2, 3, 5, + * -1 + * ); + * \endcode + * + * \param animation_player Le lecteur de l'animation à aficher. + * \param ... la liste des couches sonores, dont la veleure finale doit toujours être -1. + */ +void MLV_play_sounds_from_animation_player( + MLV_Animation_player* animation_player, + ... +); + +/** \~french + * \brief Même chose que MLV_play_sound_from_animation_player() sauf que cette + * fonction permet de lancer plusieurs sons en même temps. + * + * \param animation_player Le lecteur de l'animation à aficher. + * \param layers Tableau contenant les couches du son à jouer. + * \param nb_layers Nombre de couches dans le tableau. + * \ + */ +void MLV_play_list_of_sounds_from_animation_player( + MLV_Animation_player* animation_player, unsigned int* layers, + unsigned int nb_layers +); + + +/** \~french + * \brief Dessine à l'écran à une position donnée, une portion de + * l'image actuellement lue par l'animateur et extraite de la + * couche spécifiée en paramètre. + * + * \param animation_player Le lecteur de l'animation à aficher + * \param layer Couche de l'image. + * \param image image sur laquel il faut dessiner l'animation + * \param source_x Coordonnée en X de la position de la portion à recopier + * \param source_y Coordonnée en Y de la position de la portion à recopier + * \param source_width Largeur de la portion à recopier + * \param source_height Hauteur de la portion à recopier + * \param x Coordonnée en X de la position du sommet Nord-Ouest de + * l'image à afficher. + * \param y Coordonnée en Y de la position du sommet Nord-Ouest de + * l'image à afficher. + */ +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 +); + +/** \~french + * \brief Dessine sur une image donnée à une position donnée l'image + * actuellement lue par l'animateur et située à une couche donnée. + * + * \param animation_player Le lecteur de l'animation à aficher + * \param layer Couche de l'image. + * \param image image sur laquel il faut dessiner l'animation + * \param x Coordonnée en X de la position du sommet Nord-Ouest de + * l'image à afficher. + * \param y Coordonnée en Y de la position du sommet Nord-Ouest de + * l'image à afficher. + */ +void MLV_draw_image_from_animation_player_on_image( + MLV_Animation_player* animation_player, unsigned int layer, + MLV_Image* image, + int x, int y +); + +/** \~french + * \brief Dessine sur une image donnée à une position donnée une portion de + * l'image actuellement lue par l'animateur et située à une couche + * donnée. + * + * \param animation_player Le lecteru de l'animation à aficher + * \param layer Couche de l'image. + * \param image image sur laquel il faut dessiner l'animation + * \param source_x Coordonnée en X de la position de la portion à recopier + * \param source_y Coordonnée en Y de la position de la portion à recopier + * \param source_width Largeur de la portion à recopier + * \param source_height Hauteur de la portion à recopier + * \param x Coordonnée en X de la position du sommet Nord-Ouest de + * l'image à afficher. + * \param y Coordonnée en Y de la position du sommet Nord-Ouest de + * l'image à afficher. + */ +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 +); + + + + +//////////////////////////////////////////////// +// Loading animations from files +/////////////////////////////////////////////// + +/** \~french + * \brief Ce type correspond à un livre contenant de nombreuses animations. + * + * Un livre d'animations est un fichier XML qui code des animations. + * Le type MLV_Animation_book code le contenu d'un live d'animation. + * + */ +typedef struct _MLV_Animation_book MLV_Animation_book; + + +/** \~french + * \brief Charge en memoire un livre contenant une multitude d'animations. + * + * \param xml_file Fichiers xml. + * \param image_directory Le dossier ou se trouve toutes les images du livre + * d'animation. Si NULL est passe en parametre, alors le programme + * cherche dans le repertoire du fichier de configuration du livre + * d'animation. + * \param sound_directory Le dossier ou se trouve toutes les échantillons + * sonore du livre d'animation. Si NULL est passe en parametre, + * alors le programme cherche dans le repertoire du fichier de + * configuration du livre d'animation. + * \return L'adresse de la sructure de données contenant toutes les animations. + */ +MLV_Animation_book* MLV_load_animation_book( + const char* xml_file, + const char* image_directory, + const char* sound_directory +); + +/** \~french + * \brief Libère la memoire contenue par le livre d'animation. + * + * \param animation_book Le livre d'animation. + */ +void MLV_free_animation_book( + MLV_Animation_book* animation_book +); + +/** \~french + * \brief Détermine le nombre d'animations contenus par le livre d'animation. + * + * \param animation_book Le livre d'animation. + * \return le nombre d'animations contenus par le livre d'animation. + */ +int MLV_get_number_of_animations( + MLV_Animation_book* animation_book +); + +/** \~french + * \brief Renvoie une animation donnée contenue dans le livre d'animation. + * + * \param animation_book Le livre d'animation. + * \param id L'identifiant + * \return La séquence d'animation. + */ +MLV_Animation* MLV_get_animation_from_id( + MLV_Animation_book* animation_book, + int id +); + +/** \~french + * \brief Renvoie une animation donnée contenue dans le livre d'animation. + * + * \param animation_book Le livre d'animation. + * \param name Le nom de l'animation + * \return La séquence d'animation. + */ +MLV_Animation* MLV_get_animation_from_name( + MLV_Animation_book* animation_book, + const char* name +); + +/** \~french + * \brief Renvoie le nom d'un animation à partir de son identifiant dans le + * livre d'animation. + * + * \param animation_book Le livre d'animation. + * \param id_animation L'identifiant de l'animation dans le livre. + * \return Le nom de l'animation. + */ +const char* MLV_get_name_from_id_animation( + MLV_Animation_book* animation_book, int id_animation +); + +/** \~french + * \brief Ajoute un image dans la séquence d'animation. + * Cette fonction ne peux pas augmenter le nombre d'image d'une + * animation. + * + * \param array_of_images Liste d'image à ajouter. Il s'agit de toutes les + * images assiciée à toutes les couches correspondnant de + * l'animation. + * \param array_of_sounds Liste de sons à ajouter. Il s'agit de toutes les + * sons assiciées à tous les cannaux correspondnant de + * l'animation. + * \param delay le temps d'afficahge d'une image. + * \param animation La sequence d'animation à moifier. + */ +void MLV_add_frame_in_animation( + MLV_Image** array_of_images, MLV_Sound** array_of_sounds, unsigned int delay, + MLV_Animation* animation +); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/MLV/MLV_audio.h b/MLV/MLV_audio.h new file mode 100644 index 0000000..5e86b20 --- /dev/null +++ b/MLV/MLV_audio.h @@ -0,0 +1,187 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_audio.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit les prototypes des fonctions permettant de faire + * jouer de la musique et des échantillons sonores à l'aide de la bibliothèque + * MLV. + */ + +#ifndef __MLV__MLV_AUDIO_H__ +#define __MLV__MLV_AUDIO_H__ + +#ifndef MEMORY_DEBUG +#include +#else +#include "memory_debug.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Ce type code un morceau de musique. + */ +typedef struct _MLV_Music MLV_Music; + +/** \~french + * \brief Ce type code un échantillon sonore. + */ +typedef struct _MLV_Sound MLV_Sound; + +/** \~french + * \brief Cette fonction initialise la bibliothèque MLV pour pouvoir jouer de la + * musique et des sons. + * + * \return Renvoie 0 si l'infrastructure audio a été correctement initialisé, + * renvoie -1 sinon. + */ +int MLV_init_audio(); + +/** \~french + * \brief Ferme proprement les différents périphériques audios. + */ +void MLV_free_audio(); + +/** \~french + * \brief Change la taille du buffer audio. La taille doit être une puissance + * de 2. + * + * Le porgramme rempli périodiquement un buffer audio à faire jouer par la + * carte son. Plus la taille du buffer audio est grande, plus le programme + * à le temps de remplir le buffer avant qu'il se vide. Plus le buffer est + * grand, plus le programme met du temps à le remplir. + * + * Ainsi, si il y a un temps de latence entre une action et l'execution sonore + * du son correspondant, c'est que vous devez réduire la taille du buffer audio. + * + * Si le son est coupé et crépite, c'est que le buffer est trop petit et que le + * processeur est trop lent pour remplir le buffer avant qu'il se vide. + * Vous devez donc agrandir la taille du buffer. + * + * MLV_change_buffer_size vous permet d'ajuster la taille de ce buffer. + * par default la taille du buffer est mis à 1024. + * + * Si vous utilisez le programme uniquement pour jouer de la musique, nous vous + * vous conseillons de configurer la taille du buffer à 4096. + * + * \param buffer_size Taille du buffer audio ( une puissance de 2 ) + * + * \return Renvoie 0 si l'infrastructure audio a été correctement initialisé, + * renvoie -1 sinon. + */ +int MLV_change_audio_buffer_size( int buffer_size ); + +/** \~french + * \brief Change le nombre d'écahantillons sonores qui peuvent être joués en + * même temps. + * + * \param n Le nombre d'échantillons sonores. + */ +void MLV_change_number_of_parallel_sounds( unsigned int n ); + +/** \~french + * \brief Charge un ficher contenant de la musique en mémoire. + * + * Cette fonction prends en paramètre le chemin d'accès du + * fichier contenant la musique et renvoie un pointeur vers l'espace mémoire où + * a été chargé la musique. + * + * Les formats de fichier acceptés sont les suivants .ogg, .mp3, .wav, etc ... + * + * \param file_music Chemin d'accès vers un fichier contenant de la musique + * codée en format .wav. + * \return Un pointeur vers la musique chargée en mémoire, ou NULL si la + * bibliothèque n'a pas réussi à charger la musique en mémoire. + */ +MLV_Music* MLV_load_music( const char* file_music ); + +/** \~french + * \brief Ferme un morceau de musique chargé en mémoire. + * + * \param music Le morceau de musique à fermer + */ +void MLV_free_music( MLV_Music* music ); + +/** \~french + * \brief Joue un morceau de musique qui est chargée en mémoire. + * + * \param music Le morceau de musique à jouer. + * \param volume Le volume sonore. + * \param loop Le nombre de fois que le morceau doit être joué. Si loop est + * strictement négatif, le morceau sera joué indéfiniment. + */ +void MLV_play_music( const MLV_Music* music, float volume, int loop ); + +/** \~french + * \brief Arrête toutes les musiques. + */ +void MLV_stop_music(); + + +/** \~french + * \brief Charge un ficher contenant un échantillon sonore en mémoire. + * + * Cette fonction prends en paramètre le chemin d'accès du + * fichier contenant l'échantillon sonore et renvoie un pointeur vers l'espace + * mémoire où a été chargé l'échantillon sonore. + * + * Les formats de fichier acceptés sont les suivants : WAVE, AIFF, RIFF, OGG, and + * VOC. + * + * \param file_sound Chemin d'accès vers un fichier contenant un échantillon + * sonore. + * \return Null si le fichier n'a pas pu être chargé en mémoire. Un pointeur vers + * l'échantllon sonore sinon. + */ +MLV_Sound* MLV_load_sound( const char* file_sound ); + +/** \~french + * \brief Ferme un échantillon sonore chargé en mémoire. + * + * \param sound L'échantillon sonore à fermer + */ +void MLV_free_sound( MLV_Sound* sound ); + +/** \~french + * \brief Joue un échantillon sonore chargé en mémoire. + * + * \param sound L'échantillon sonore à jouer. + * \param volume Le volume sonore. + */ +void MLV_play_sound( const MLV_Sound* sound, float volume ); + +/** \~french + * \brief Arrête tous les échantillons sonores. + */ +void MLV_stop_all_sounds(); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MLV/MLV_color.h b/MLV/MLV_color.h new file mode 100644 index 0000000..901b615 --- /dev/null +++ b/MLV/MLV_color.h @@ -0,0 +1,4652 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_color.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Définit toutes les couleurs disponibles dans la bibliothèque MLV. + * + */ + +#ifndef __MLV__MLV_COLOR_H__ +#define __MLV__MLV_COLOR_H__ + +#ifndef MEMORY_DEBUG +#include +#else +#include "memory_debug.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Définit un type couleur pour la bibliothèque MLV + * + * Les couleurs sont définies à l'aide de 4 + * entiers compris entre 0 et 256 exclu, que l'on appelle composantes : + * - la composante Rouge ( R ); + * - la composante Verte ( G ); + * - la composant Blue ( B ); + * - la composante Alpha, c'est la transparence ( A ). + */ +typedef Uint32 MLV_Color; + +/** \~french + * \brief Énumère les valeurs de transparence et d'opacité (codés sur 8 bits ) + */ +enum { + MLV_ALPHA_TRANSPARENT = SDL_ALPHA_TRANSPARENT, + MLV_ALPHA_OPAQUE = SDL_ALPHA_OPAQUE +}; + +/** \~french + * \brief Type codant la transparence dans MLV + */ +typedef Uint8 MLV_Alpha; + + +/** \~french + * \brief Raccourci vers MLV_Color MLV_get_color_from_rgba. + * + * \see MLV_get_color_from_rgba + * + * \param red La composante rouge de la couleur + * \param green La composante verte de la couleur + * \param blue La composante bleue de la couleur + * \param alpha La composante alpha (transparence) de la couleur + * \return La couleur codée sur 32 bits. + */ +MLV_Color MLV_rgba( Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha ); + +/** \~french + * \brief Convertit une couleur codée sur 4 entier de 8 bits représentant les + * composantes rouge, bleue et verte en un entier 32 bits. + * + * \param red La composante rouge de la couleur + * \param green La composante verte de la couleur + * \param blue La composante bleue de la couleur + * \param alpha La composante alpha (transparence) de la couleur + * \return La couleur codée sur 32 bits. + */ +MLV_Color MLV_convert_rgba_to_color( + Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha +); + +/** \~french + * \brief Convertit une couleur MLV en une couleur codée sur 4 entier de 8 bits + * représentant les composantes rouge, bleue et verte en un entier 32 + * bits. + * + * \param color La couleur à convertir + * \param red La composante rouge de la couleur + * \param green La composante verte de la couleur + * \param blue La composante bleue de la couleur + * \param alpha La composante alpha (transparence) de la couleur + */ +void MLV_convert_color_to_rgba( + MLV_Color color, Uint8* red, Uint8* green, Uint8* blue, Uint8* alpha +); + +/** \~french + * \brief Convertit une couleur en un chaine de caractères. + * + * Cette fonction est de complexité lineaire par rapport au nombre de couleurs. + * ( environ 700 ) + * + * \param color Le code de la couleur + * \return La chaîne associée au code de la couleur + * + */ +const char* MLV_convert_color_to_string( MLV_Color color ); + +/** \~french + * \brief Convertit un nom de couleur en son code couleur. + * + * Cette fonction est de complexité lineaire par rapport au nombre de couleurs. + * ( environ 700 ) + * + * \param color_name Le nom de la couleur + * \return Le code couleur associée au nom passé en paramètre. + */ +MLV_Color MLV_convert_string_to_color( const char* color_name ); + +/** \~french + * Define the SNOW color. + * + */ +#define MLV_COLOR_SNOW MLV_rgba(255,250,250,255) + +/** \~french + * Define the GHOST_WHITE color. + * + */ +#define MLV_COLOR_GHOST_WHITE MLV_rgba(248,248,255,255) + +/** \~french + * Define the GHOSTWHITE color. + * + */ +#define MLV_COLOR_GHOSTWHITE MLV_rgba(248,248,255,255) + +/** \~french + * Define the WHITE_SMOKE color. + * + */ +#define MLV_COLOR_WHITE_SMOKE MLV_rgba(245,245,245,255) + +/** \~french + * Define the WHITESMOKE color. + * + */ +#define MLV_COLOR_WHITESMOKE MLV_rgba(245,245,245,255) + +/** \~french + * Define the GAINSBORO color. + * + */ +#define MLV_COLOR_GAINSBORO MLV_rgba(220,220,220,255) + +/** \~french + * Define the FLORAL_WHITE color. + * + */ +#define MLV_COLOR_FLORAL_WHITE MLV_rgba(255,250,240,255) + +/** \~french + * Define the FLORALWHITE color. + * + */ +#define MLV_COLOR_FLORALWHITE MLV_rgba(255,250,240,255) + +/** \~french + * Define the OLD_LACE color. + * + */ +#define MLV_COLOR_OLD_LACE MLV_rgba(253,245,230,255) + +/** \~french + * Define the OLDLACE color. + * + */ +#define MLV_COLOR_OLDLACE MLV_rgba(253,245,230,255) + +/** \~french + * Define the LINEN color. + * + */ +#define MLV_COLOR_LINEN MLV_rgba(250,240,230,255) + +/** \~french + * Define the ANTIQUE_WHITE color. + * + */ +#define MLV_COLOR_ANTIQUE_WHITE MLV_rgba(250,235,215,255) + +/** \~french + * Define the ANTIQUEWHITE color. + * + */ +#define MLV_COLOR_ANTIQUEWHITE MLV_rgba(250,235,215,255) + +/** \~french + * Define the PAPAYA_WHIP color. + * + */ +#define MLV_COLOR_PAPAYA_WHIP MLV_rgba(255,239,213,255) + +/** \~french + * Define the PAPAYAWHIP color. + * + */ +#define MLV_COLOR_PAPAYAWHIP MLV_rgba(255,239,213,255) + +/** \~french + * Define the BLANCHED_ALMOND color. + * + */ +#define MLV_COLOR_BLANCHED_ALMOND MLV_rgba(255,235,205,255) + +/** \~french + * Define the BLANCHEDALMOND color. + * + */ +#define MLV_COLOR_BLANCHEDALMOND MLV_rgba(255,235,205,255) + +/** \~french + * Define the BISQUE color. + * + */ +#define MLV_COLOR_BISQUE MLV_rgba(255,228,196,255) + +/** \~french + * Define the PEACH_PUFF color. + * + */ +#define MLV_COLOR_PEACH_PUFF MLV_rgba(255,218,185,255) + +/** \~french + * Define the PEACHPUFF color. + * + */ +#define MLV_COLOR_PEACHPUFF MLV_rgba(255,218,185,255) + +/** \~french + * Define the NAVAJO_WHITE color. + * + */ +#define MLV_COLOR_NAVAJO_WHITE MLV_rgba(255,222,173,255) + +/** \~french + * Define the NAVAJOWHITE color. + * + */ +#define MLV_COLOR_NAVAJOWHITE MLV_rgba(255,222,173,255) + +/** \~french + * Define the MOCCASIN color. + * + */ +#define MLV_COLOR_MOCCASIN MLV_rgba(255,228,181,255) + +/** \~french + * Define the CORNSILK color. + * + */ +#define MLV_COLOR_CORNSILK MLV_rgba(255,248,220,255) + +/** \~french + * Define the IVORY color. + * + */ +#define MLV_COLOR_IVORY MLV_rgba(255,255,240,255) + +/** \~french + * Define the LEMON_CHIFFON color. + * + */ +#define MLV_COLOR_LEMON_CHIFFON MLV_rgba(255,250,205,255) + +/** \~french + * Define the LEMONCHIFFON color. + * + */ +#define MLV_COLOR_LEMONCHIFFON MLV_rgba(255,250,205,255) + +/** \~french + * Define the SEASHELL color. + * + */ +#define MLV_COLOR_SEASHELL MLV_rgba(255,245,238,255) + +/** \~french + * Define the HONEYDEW color. + * + */ +#define MLV_COLOR_HONEYDEW MLV_rgba(240,255,240,255) + +/** \~french + * Define the MINT_CREAM color. + * + */ +#define MLV_COLOR_MINT_CREAM MLV_rgba(245,255,250,255) + +/** \~french + * Define the MINTCREAM color. + * + */ +#define MLV_COLOR_MINTCREAM MLV_rgba(245,255,250,255) + +/** \~french + * Define the AZURE color. + * + */ +#define MLV_COLOR_AZURE MLV_rgba(240,255,255,255) + +/** \~french + * Define the ALICE_BLUE color. + * + */ +#define MLV_COLOR_ALICE_BLUE MLV_rgba(240,248,255,255) + +/** \~french + * Define the ALICEBLUE color. + * + */ +#define MLV_COLOR_ALICEBLUE MLV_rgba(240,248,255,255) + +/** \~french + * Define the LAVENDER color. + * + */ +#define MLV_COLOR_LAVENDER MLV_rgba(230,230,250,255) + +/** \~french + * Define the LAVENDER_BLUSH color. + * + */ +#define MLV_COLOR_LAVENDER_BLUSH MLV_rgba(255,240,245,255) + +/** \~french + * Define the LAVENDERBLUSH color. + * + */ +#define MLV_COLOR_LAVENDERBLUSH MLV_rgba(255,240,245,255) + +/** \~french + * Define the MISTY_ROSE color. + * + */ +#define MLV_COLOR_MISTY_ROSE MLV_rgba(255,228,225,255) + +/** \~french + * Define the MISTYROSE color. + * + */ +#define MLV_COLOR_MISTYROSE MLV_rgba(255,228,225,255) + +/** \~french + * Define the WHITE color. + * + */ +#define MLV_COLOR_WHITE MLV_rgba(255,255,255,255) + +/** \~french + * Define the BLACK color. + * + */ +#define MLV_COLOR_BLACK MLV_rgba(0,0,0,255) + +/** \~french + * Define the DARK_SLATE_GRAY color. + * + */ +#define MLV_COLOR_DARK_SLATE_GRAY MLV_rgba(47,79,79,255) + +/** \~french + * Define the DARKSLATEGRAY color. + * + */ +#define MLV_COLOR_DARKSLATEGRAY MLV_rgba(47,79,79,255) + +/** \~french + * Define the DARK_SLATE_GREY color. + * + */ +#define MLV_COLOR_DARK_SLATE_GREY MLV_rgba(47,79,79,255) + +/** \~french + * Define the DARKSLATEGREY color. + * + */ +#define MLV_COLOR_DARKSLATEGREY MLV_rgba(47,79,79,255) + +/** \~french + * Define the DIM_GRAY color. + * + */ +#define MLV_COLOR_DIM_GRAY MLV_rgba(105,105,105,255) + +/** \~french + * Define the DIMGRAY color. + * + */ +#define MLV_COLOR_DIMGRAY MLV_rgba(105,105,105,255) + +/** \~french + * Define the DIM_GREY color. + * + */ +#define MLV_COLOR_DIM_GREY MLV_rgba(105,105,105,255) + +/** \~french + * Define the DIMGREY color. + * + */ +#define MLV_COLOR_DIMGREY MLV_rgba(105,105,105,255) + +/** \~french + * Define the SLATE_GRAY color. + * + */ +#define MLV_COLOR_SLATE_GRAY MLV_rgba(112,128,144,255) + +/** \~french + * Define the SLATEGRAY color. + * + */ +#define MLV_COLOR_SLATEGRAY MLV_rgba(112,128,144,255) + +/** \~french + * Define the SLATE_GREY color. + * + */ +#define MLV_COLOR_SLATE_GREY MLV_rgba(112,128,144,255) + +/** \~french + * Define the SLATEGREY color. + * + */ +#define MLV_COLOR_SLATEGREY MLV_rgba(112,128,144,255) + +/** \~french + * Define the LIGHT_SLATE_GRAY color. + * + */ +#define MLV_COLOR_LIGHT_SLATE_GRAY MLV_rgba(119,136,153,255) + +/** \~french + * Define the LIGHTSLATEGRAY color. + * + */ +#define MLV_COLOR_LIGHTSLATEGRAY MLV_rgba(119,136,153,255) + +/** \~french + * Define the LIGHT_SLATE_GREY color. + * + */ +#define MLV_COLOR_LIGHT_SLATE_GREY MLV_rgba(119,136,153,255) + +/** \~french + * Define the LIGHTSLATEGREY color. + * + */ +#define MLV_COLOR_LIGHTSLATEGREY MLV_rgba(119,136,153,255) + +/** \~french + * Define the GRAY color. + * + */ +#define MLV_COLOR_GRAY MLV_rgba(190,190,190,255) + +/** \~french + * Define the GREY color. + * + */ +#define MLV_COLOR_GREY MLV_rgba(190,190,190,255) + +/** \~french + * Define the LIGHT_GREY color. + * + */ +#define MLV_COLOR_LIGHT_GREY MLV_rgba(211,211,211,255) + +/** \~french + * Define the LIGHTGREY color. + * + */ +#define MLV_COLOR_LIGHTGREY MLV_rgba(211,211,211,255) + +/** \~french + * Define the LIGHT_GRAY color. + * + */ +#define MLV_COLOR_LIGHT_GRAY MLV_rgba(211,211,211,255) + +/** \~french + * Define the LIGHTGRAY color. + * + */ +#define MLV_COLOR_LIGHTGRAY MLV_rgba(211,211,211,255) + +/** \~french + * Define the MIDNIGHT_BLUE color. + * + */ +#define MLV_COLOR_MIDNIGHT_BLUE MLV_rgba(25,25,112,255) + +/** \~french + * Define the MIDNIGHTBLUE color. + * + */ +#define MLV_COLOR_MIDNIGHTBLUE MLV_rgba(25,25,112,255) + +/** \~french + * Define the NAVY color. + * + */ +#define MLV_COLOR_NAVY MLV_rgba(0,0,128,255) + +/** \~french + * Define the NAVY_BLUE color. + * + */ +#define MLV_COLOR_NAVY_BLUE MLV_rgba(0,0,128,255) + +/** \~french + * Define the NAVYBLUE color. + * + */ +#define MLV_COLOR_NAVYBLUE MLV_rgba(0,0,128,255) + +/** \~french + * Define the CORNFLOWER_BLUE color. + * + */ +#define MLV_COLOR_CORNFLOWER_BLUE MLV_rgba(100,149,237,255) + +/** \~french + * Define the CORNFLOWERBLUE color. + * + */ +#define MLV_COLOR_CORNFLOWERBLUE MLV_rgba(100,149,237,255) + +/** \~french + * Define the DARK_SLATE_BLUE color. + * + */ +#define MLV_COLOR_DARK_SLATE_BLUE MLV_rgba(72,61,139,255) + +/** \~french + * Define the DARKSLATEBLUE color. + * + */ +#define MLV_COLOR_DARKSLATEBLUE MLV_rgba(72,61,139,255) + +/** \~french + * Define the SLATE_BLUE color. + * + */ +#define MLV_COLOR_SLATE_BLUE MLV_rgba(106,90,205,255) + +/** \~french + * Define the SLATEBLUE color. + * + */ +#define MLV_COLOR_SLATEBLUE MLV_rgba(106,90,205,255) + +/** \~french + * Define the MEDIUM_SLATE_BLUE color. + * + */ +#define MLV_COLOR_MEDIUM_SLATE_BLUE MLV_rgba(123,104,238,255) + +/** \~french + * Define the MEDIUMSLATEBLUE color. + * + */ +#define MLV_COLOR_MEDIUMSLATEBLUE MLV_rgba(123,104,238,255) + +/** \~french + * Define the LIGHT_SLATE_BLUE color. + * + */ +#define MLV_COLOR_LIGHT_SLATE_BLUE MLV_rgba(132,112,255,255) + +/** \~french + * Define the LIGHTSLATEBLUE color. + * + */ +#define MLV_COLOR_LIGHTSLATEBLUE MLV_rgba(132,112,255,255) + +/** \~french + * Define the MEDIUM_BLUE color. + * + */ +#define MLV_COLOR_MEDIUM_BLUE MLV_rgba(0,0,205,255) + +/** \~french + * Define the MEDIUMBLUE color. + * + */ +#define MLV_COLOR_MEDIUMBLUE MLV_rgba(0,0,205,255) + +/** \~french + * Define the ROYAL_BLUE color. + * + */ +#define MLV_COLOR_ROYAL_BLUE MLV_rgba(65,105,225,255) + +/** \~french + * Define the ROYALBLUE color. + * + */ +#define MLV_COLOR_ROYALBLUE MLV_rgba(65,105,225,255) + +/** \~french + * Define the BLUE color. + * + */ +#define MLV_COLOR_BLUE MLV_rgba(0,0,255,255) + +/** \~french + * Define the DODGER_BLUE color. + * + */ +#define MLV_COLOR_DODGER_BLUE MLV_rgba(30,144,255,255) + +/** \~french + * Define the DODGERBLUE color. + * + */ +#define MLV_COLOR_DODGERBLUE MLV_rgba(30,144,255,255) + +/** \~french + * Define the DEEP_SKY_BLUE color. + * + */ +#define MLV_COLOR_DEEP_SKY_BLUE MLV_rgba(0,191,255,255) + +/** \~french + * Define the DEEPSKYBLUE color. + * + */ +#define MLV_COLOR_DEEPSKYBLUE MLV_rgba(0,191,255,255) + +/** \~french + * Define the SKY_BLUE color. + * + */ +#define MLV_COLOR_SKY_BLUE MLV_rgba(135,206,235,255) + +/** \~french + * Define the SKYBLUE color. + * + */ +#define MLV_COLOR_SKYBLUE MLV_rgba(135,206,235,255) + +/** \~french + * Define the LIGHT_SKY_BLUE color. + * + */ +#define MLV_COLOR_LIGHT_SKY_BLUE MLV_rgba(135,206,250,255) + +/** \~french + * Define the LIGHTSKYBLUE color. + * + */ +#define MLV_COLOR_LIGHTSKYBLUE MLV_rgba(135,206,250,255) + +/** \~french + * Define the STEEL_BLUE color. + * + */ +#define MLV_COLOR_STEEL_BLUE MLV_rgba(70,130,180,255) + +/** \~french + * Define the STEELBLUE color. + * + */ +#define MLV_COLOR_STEELBLUE MLV_rgba(70,130,180,255) + +/** \~french + * Define the LIGHT_STEEL_BLUE color. + * + */ +#define MLV_COLOR_LIGHT_STEEL_BLUE MLV_rgba(176,196,222,255) + +/** \~french + * Define the LIGHTSTEELBLUE color. + * + */ +#define MLV_COLOR_LIGHTSTEELBLUE MLV_rgba(176,196,222,255) + +/** \~french + * Define the LIGHT_BLUE color. + * + */ +#define MLV_COLOR_LIGHT_BLUE MLV_rgba(173,216,230,255) + +/** \~french + * Define the LIGHTBLUE color. + * + */ +#define MLV_COLOR_LIGHTBLUE MLV_rgba(173,216,230,255) + +/** \~french + * Define the POWDER_BLUE color. + * + */ +#define MLV_COLOR_POWDER_BLUE MLV_rgba(176,224,230,255) + +/** \~french + * Define the POWDERBLUE color. + * + */ +#define MLV_COLOR_POWDERBLUE MLV_rgba(176,224,230,255) + +/** \~french + * Define the PALE_TURQUOISE color. + * + */ +#define MLV_COLOR_PALE_TURQUOISE MLV_rgba(175,238,238,255) + +/** \~french + * Define the PALETURQUOISE color. + * + */ +#define MLV_COLOR_PALETURQUOISE MLV_rgba(175,238,238,255) + +/** \~french + * Define the DARK_TURQUOISE color. + * + */ +#define MLV_COLOR_DARK_TURQUOISE MLV_rgba(0,206,209,255) + +/** \~french + * Define the DARKTURQUOISE color. + * + */ +#define MLV_COLOR_DARKTURQUOISE MLV_rgba(0,206,209,255) + +/** \~french + * Define the MEDIUM_TURQUOISE color. + * + */ +#define MLV_COLOR_MEDIUM_TURQUOISE MLV_rgba(72,209,204,255) + +/** \~french + * Define the MEDIUMTURQUOISE color. + * + */ +#define MLV_COLOR_MEDIUMTURQUOISE MLV_rgba(72,209,204,255) + +/** \~french + * Define the TURQUOISE color. + * + */ +#define MLV_COLOR_TURQUOISE MLV_rgba(64,224,208,255) + +/** \~french + * Define the CYAN color. + * + */ +#define MLV_COLOR_CYAN MLV_rgba(0,255,255,255) + +/** \~french + * Define the LIGHT_CYAN color. + * + */ +#define MLV_COLOR_LIGHT_CYAN MLV_rgba(224,255,255,255) + +/** \~french + * Define the LIGHTCYAN color. + * + */ +#define MLV_COLOR_LIGHTCYAN MLV_rgba(224,255,255,255) + +/** \~french + * Define the CADET_BLUE color. + * + */ +#define MLV_COLOR_CADET_BLUE MLV_rgba(95,158,160,255) + +/** \~french + * Define the CADETBLUE color. + * + */ +#define MLV_COLOR_CADETBLUE MLV_rgba(95,158,160,255) + +/** \~french + * Define the MEDIUM_AQUAMARINE color. + * + */ +#define MLV_COLOR_MEDIUM_AQUAMARINE MLV_rgba(102,205,170,255) + +/** \~french + * Define the MEDIUMAQUAMARINE color. + * + */ +#define MLV_COLOR_MEDIUMAQUAMARINE MLV_rgba(102,205,170,255) + +/** \~french + * Define the AQUAMARINE color. + * + */ +#define MLV_COLOR_AQUAMARINE MLV_rgba(127,255,212,255) + +/** \~french + * Define the DARK_GREEN color. + * + */ +#define MLV_COLOR_DARK_GREEN MLV_rgba(0,100,0,255) + +/** \~french + * Define the DARKGREEN color. + * + */ +#define MLV_COLOR_DARKGREEN MLV_rgba(0,100,0,255) + +/** \~french + * Define the DARK_OLIVE_GREEN color. + * + */ +#define MLV_COLOR_DARK_OLIVE_GREEN MLV_rgba(85,107,47,255) + +/** \~french + * Define the DARKOLIVEGREEN color. + * + */ +#define MLV_COLOR_DARKOLIVEGREEN MLV_rgba(85,107,47,255) + +/** \~french + * Define the DARK_SEA_GREEN color. + * + */ +#define MLV_COLOR_DARK_SEA_GREEN MLV_rgba(143,188,143,255) + +/** \~french + * Define the DARKSEAGREEN color. + * + */ +#define MLV_COLOR_DARKSEAGREEN MLV_rgba(143,188,143,255) + +/** \~french + * Define the SEA_GREEN color. + * + */ +#define MLV_COLOR_SEA_GREEN MLV_rgba(46,139,87,255) + +/** \~french + * Define the SEAGREEN color. + * + */ +#define MLV_COLOR_SEAGREEN MLV_rgba(46,139,87,255) + +/** \~french + * Define the MEDIUM_SEA_GREEN color. + * + */ +#define MLV_COLOR_MEDIUM_SEA_GREEN MLV_rgba(60,179,113,255) + +/** \~french + * Define the MEDIUMSEAGREEN color. + * + */ +#define MLV_COLOR_MEDIUMSEAGREEN MLV_rgba(60,179,113,255) + +/** \~french + * Define the LIGHT_SEA_GREEN color. + * + */ +#define MLV_COLOR_LIGHT_SEA_GREEN MLV_rgba(32,178,170,255) + +/** \~french + * Define the LIGHTSEAGREEN color. + * + */ +#define MLV_COLOR_LIGHTSEAGREEN MLV_rgba(32,178,170,255) + +/** \~french + * Define the PALE_GREEN color. + * + */ +#define MLV_COLOR_PALE_GREEN MLV_rgba(152,251,152,255) + +/** \~french + * Define the PALEGREEN color. + * + */ +#define MLV_COLOR_PALEGREEN MLV_rgba(152,251,152,255) + +/** \~french + * Define the SPRING_GREEN color. + * + */ +#define MLV_COLOR_SPRING_GREEN MLV_rgba(0,255,127,255) + +/** \~french + * Define the SPRINGGREEN color. + * + */ +#define MLV_COLOR_SPRINGGREEN MLV_rgba(0,255,127,255) + +/** \~french + * Define the LAWN_GREEN color. + * + */ +#define MLV_COLOR_LAWN_GREEN MLV_rgba(124,252,0,255) + +/** \~french + * Define the LAWNGREEN color. + * + */ +#define MLV_COLOR_LAWNGREEN MLV_rgba(124,252,0,255) + +/** \~french + * Define the GREEN color. + * + */ +#define MLV_COLOR_GREEN MLV_rgba(0,255,0,255) + +/** \~french + * Define the CHARTREUSE color. + * + */ +#define MLV_COLOR_CHARTREUSE MLV_rgba(127,255,0,255) + +/** \~french + * Define the MEDIUM_SPRING_GREEN color. + * + */ +#define MLV_COLOR_MEDIUM_SPRING_GREEN MLV_rgba(0,250,154,255) + +/** \~french + * Define the MEDIUMSPRINGGREEN color. + * + */ +#define MLV_COLOR_MEDIUMSPRINGGREEN MLV_rgba(0,250,154,255) + +/** \~french + * Define the GREEN_YELLOW color. + * + */ +#define MLV_COLOR_GREEN_YELLOW MLV_rgba(173,255,47,255) + +/** \~french + * Define the GREENYELLOW color. + * + */ +#define MLV_COLOR_GREENYELLOW MLV_rgba(173,255,47,255) + +/** \~french + * Define the LIME_GREEN color. + * + */ +#define MLV_COLOR_LIME_GREEN MLV_rgba(50,205,50,255) + +/** \~french + * Define the LIMEGREEN color. + * + */ +#define MLV_COLOR_LIMEGREEN MLV_rgba(50,205,50,255) + +/** \~french + * Define the YELLOW_GREEN color. + * + */ +#define MLV_COLOR_YELLOW_GREEN MLV_rgba(154,205,50,255) + +/** \~french + * Define the YELLOWGREEN color. + * + */ +#define MLV_COLOR_YELLOWGREEN MLV_rgba(154,205,50,255) + +/** \~french + * Define the FOREST_GREEN color. + * + */ +#define MLV_COLOR_FOREST_GREEN MLV_rgba(34,139,34,255) + +/** \~french + * Define the FORESTGREEN color. + * + */ +#define MLV_COLOR_FORESTGREEN MLV_rgba(34,139,34,255) + +/** \~french + * Define the OLIVE_DRAB color. + * + */ +#define MLV_COLOR_OLIVE_DRAB MLV_rgba(107,142,35,255) + +/** \~french + * Define the OLIVEDRAB color. + * + */ +#define MLV_COLOR_OLIVEDRAB MLV_rgba(107,142,35,255) + +/** \~french + * Define the DARK_KHAKI color. + * + */ +#define MLV_COLOR_DARK_KHAKI MLV_rgba(189,183,107,255) + +/** \~french + * Define the DARKKHAKI color. + * + */ +#define MLV_COLOR_DARKKHAKI MLV_rgba(189,183,107,255) + +/** \~french + * Define the KHAKI color. + * + */ +#define MLV_COLOR_KHAKI MLV_rgba(240,230,140,255) + +/** \~french + * Define the PALE_GOLDENROD color. + * + */ +#define MLV_COLOR_PALE_GOLDENROD MLV_rgba(238,232,170,255) + +/** \~french + * Define the PALEGOLDENROD color. + * + */ +#define MLV_COLOR_PALEGOLDENROD MLV_rgba(238,232,170,255) + +/** \~french + * Define the LIGHT_GOLDENROD_YELLOW color. + * + */ +#define MLV_COLOR_LIGHT_GOLDENROD_YELLOW MLV_rgba(250,250,210,255) + +/** \~french + * Define the LIGHTGOLDENRODYELLOW color. + * + */ +#define MLV_COLOR_LIGHTGOLDENRODYELLOW MLV_rgba(250,250,210,255) + +/** \~french + * Define the LIGHT_YELLOW color. + * + */ +#define MLV_COLOR_LIGHT_YELLOW MLV_rgba(255,255,224,255) + +/** \~french + * Define the LIGHTYELLOW color. + * + */ +#define MLV_COLOR_LIGHTYELLOW MLV_rgba(255,255,224,255) + +/** \~french + * Define the YELLOW color. + * + */ +#define MLV_COLOR_YELLOW MLV_rgba(255,255,0,255) + +/** \~french + * Define the GOLD color. + * + */ +#define MLV_COLOR_GOLD MLV_rgba(255,215,0,255) + +/** \~french + * Define the LIGHT_GOLDENROD color. + * + */ +#define MLV_COLOR_LIGHT_GOLDENROD MLV_rgba(238,221,130,255) + +/** \~french + * Define the LIGHTGOLDENROD color. + * + */ +#define MLV_COLOR_LIGHTGOLDENROD MLV_rgba(238,221,130,255) + +/** \~french + * Define the GOLDENROD color. + * + */ +#define MLV_COLOR_GOLDENROD MLV_rgba(218,165,32,255) + +/** \~french + * Define the DARK_GOLDENROD color. + * + */ +#define MLV_COLOR_DARK_GOLDENROD MLV_rgba(184,134,11,255) + +/** \~french + * Define the DARKGOLDENROD color. + * + */ +#define MLV_COLOR_DARKGOLDENROD MLV_rgba(184,134,11,255) + +/** \~french + * Define the ROSY_BROWN color. + * + */ +#define MLV_COLOR_ROSY_BROWN MLV_rgba(188,143,143,255) + +/** \~french + * Define the ROSYBROWN color. + * + */ +#define MLV_COLOR_ROSYBROWN MLV_rgba(188,143,143,255) + +/** \~french + * Define the INDIAN_RED color. + * + */ +#define MLV_COLOR_INDIAN_RED MLV_rgba(205,92,92,255) + +/** \~french + * Define the INDIANRED color. + * + */ +#define MLV_COLOR_INDIANRED MLV_rgba(205,92,92,255) + +/** \~french + * Define the SADDLE_BROWN color. + * + */ +#define MLV_COLOR_SADDLE_BROWN MLV_rgba(139,69,19,255) + +/** \~french + * Define the SADDLEBROWN color. + * + */ +#define MLV_COLOR_SADDLEBROWN MLV_rgba(139,69,19,255) + +/** \~french + * Define the SIENNA color. + * + */ +#define MLV_COLOR_SIENNA MLV_rgba(160,82,45,255) + +/** \~french + * Define the PERU color. + * + */ +#define MLV_COLOR_PERU MLV_rgba(205,133,63,255) + +/** \~french + * Define the BURLYWOOD color. + * + */ +#define MLV_COLOR_BURLYWOOD MLV_rgba(222,184,135,255) + +/** \~french + * Define the BEIGE color. + * + */ +#define MLV_COLOR_BEIGE MLV_rgba(245,245,220,255) + +/** \~french + * Define the WHEAT color. + * + */ +#define MLV_COLOR_WHEAT MLV_rgba(245,222,179,255) + +/** \~french + * Define the SANDY_BROWN color. + * + */ +#define MLV_COLOR_SANDY_BROWN MLV_rgba(244,164,96,255) + +/** \~french + * Define the SANDYBROWN color. + * + */ +#define MLV_COLOR_SANDYBROWN MLV_rgba(244,164,96,255) + +/** \~french + * Define the TAN color. + * + */ +#define MLV_COLOR_TAN MLV_rgba(210,180,140,255) + +/** \~french + * Define the CHOCOLATE color. + * + */ +#define MLV_COLOR_CHOCOLATE MLV_rgba(210,105,30,255) + +/** \~french + * Define the FIREBRICK color. + * + */ +#define MLV_COLOR_FIREBRICK MLV_rgba(178,34,34,255) + +/** \~french + * Define the BROWN color. + * + */ +#define MLV_COLOR_BROWN MLV_rgba(165,42,42,255) + +/** \~french + * Define the DARK_SALMON color. + * + */ +#define MLV_COLOR_DARK_SALMON MLV_rgba(233,150,122,255) + +/** \~french + * Define the DARKSALMON color. + * + */ +#define MLV_COLOR_DARKSALMON MLV_rgba(233,150,122,255) + +/** \~french + * Define the SALMON color. + * + */ +#define MLV_COLOR_SALMON MLV_rgba(250,128,114,255) + +/** \~french + * Define the LIGHT_SALMON color. + * + */ +#define MLV_COLOR_LIGHT_SALMON MLV_rgba(255,160,122,255) + +/** \~french + * Define the LIGHTSALMON color. + * + */ +#define MLV_COLOR_LIGHTSALMON MLV_rgba(255,160,122,255) + +/** \~french + * Define the ORANGE color. + * + */ +#define MLV_COLOR_ORANGE MLV_rgba(255,165,0,255) + +/** \~french + * Define the DARK_ORANGE color. + * + */ +#define MLV_COLOR_DARK_ORANGE MLV_rgba(255,140,0,255) + +/** \~french + * Define the DARKORANGE color. + * + */ +#define MLV_COLOR_DARKORANGE MLV_rgba(255,140,0,255) + +/** \~french + * Define the CORAL color. + * + */ +#define MLV_COLOR_CORAL MLV_rgba(255,127,80,255) + +/** \~french + * Define the LIGHT_CORAL color. + * + */ +#define MLV_COLOR_LIGHT_CORAL MLV_rgba(240,128,128,255) + +/** \~french + * Define the LIGHTCORAL color. + * + */ +#define MLV_COLOR_LIGHTCORAL MLV_rgba(240,128,128,255) + +/** \~french + * Define the TOMATO color. + * + */ +#define MLV_COLOR_TOMATO MLV_rgba(255,99,71,255) + +/** \~french + * Define the ORANGE_RED color. + * + */ +#define MLV_COLOR_ORANGE_RED MLV_rgba(255,69,0,255) + +/** \~french + * Define the ORANGERED color. + * + */ +#define MLV_COLOR_ORANGERED MLV_rgba(255,69,0,255) + +/** \~french + * Define the RED color. + * + */ +#define MLV_COLOR_RED MLV_rgba(255,0,0,255) + +/** \~french + * Define the HOT_PINK color. + * + */ +#define MLV_COLOR_HOT_PINK MLV_rgba(255,105,180,255) + +/** \~french + * Define the HOTPINK color. + * + */ +#define MLV_COLOR_HOTPINK MLV_rgba(255,105,180,255) + +/** \~french + * Define the DEEP_PINK color. + * + */ +#define MLV_COLOR_DEEP_PINK MLV_rgba(255,20,147,255) + +/** \~french + * Define the DEEPPINK color. + * + */ +#define MLV_COLOR_DEEPPINK MLV_rgba(255,20,147,255) + +/** \~french + * Define the PINK color. + * + */ +#define MLV_COLOR_PINK MLV_rgba(255,192,203,255) + +/** \~french + * Define the LIGHT_PINK color. + * + */ +#define MLV_COLOR_LIGHT_PINK MLV_rgba(255,182,193,255) + +/** \~french + * Define the LIGHTPINK color. + * + */ +#define MLV_COLOR_LIGHTPINK MLV_rgba(255,182,193,255) + +/** \~french + * Define the PALE_VIOLET_RED color. + * + */ +#define MLV_COLOR_PALE_VIOLET_RED MLV_rgba(219,112,147,255) + +/** \~french + * Define the PALEVIOLETRED color. + * + */ +#define MLV_COLOR_PALEVIOLETRED MLV_rgba(219,112,147,255) + +/** \~french + * Define the MAROON color. + * + */ +#define MLV_COLOR_MAROON MLV_rgba(176,48,96,255) + +/** \~french + * Define the MEDIUM_VIOLET_RED color. + * + */ +#define MLV_COLOR_MEDIUM_VIOLET_RED MLV_rgba(199,21,133,255) + +/** \~french + * Define the MEDIUMVIOLETRED color. + * + */ +#define MLV_COLOR_MEDIUMVIOLETRED MLV_rgba(199,21,133,255) + +/** \~french + * Define the VIOLET_RED color. + * + */ +#define MLV_COLOR_VIOLET_RED MLV_rgba(208,32,144,255) + +/** \~french + * Define the VIOLETRED color. + * + */ +#define MLV_COLOR_VIOLETRED MLV_rgba(208,32,144,255) + +/** \~french + * Define the MAGENTA color. + * + */ +#define MLV_COLOR_MAGENTA MLV_rgba(255,0,255,255) + +/** \~french + * Define the VIOLET color. + * + */ +#define MLV_COLOR_VIOLET MLV_rgba(238,130,238,255) + +/** \~french + * Define the PLUM color. + * + */ +#define MLV_COLOR_PLUM MLV_rgba(221,160,221,255) + +/** \~french + * Define the ORCHID color. + * + */ +#define MLV_COLOR_ORCHID MLV_rgba(218,112,214,255) + +/** \~french + * Define the MEDIUM_ORCHID color. + * + */ +#define MLV_COLOR_MEDIUM_ORCHID MLV_rgba(186,85,211,255) + +/** \~french + * Define the MEDIUMORCHID color. + * + */ +#define MLV_COLOR_MEDIUMORCHID MLV_rgba(186,85,211,255) + +/** \~french + * Define the DARK_ORCHID color. + * + */ +#define MLV_COLOR_DARK_ORCHID MLV_rgba(153,50,204,255) + +/** \~french + * Define the DARKORCHID color. + * + */ +#define MLV_COLOR_DARKORCHID MLV_rgba(153,50,204,255) + +/** \~french + * Define the DARK_VIOLET color. + * + */ +#define MLV_COLOR_DARK_VIOLET MLV_rgba(148,0,211,255) + +/** \~french + * Define the DARKVIOLET color. + * + */ +#define MLV_COLOR_DARKVIOLET MLV_rgba(148,0,211,255) + +/** \~french + * Define the BLUE_VIOLET color. + * + */ +#define MLV_COLOR_BLUE_VIOLET MLV_rgba(138,43,226,255) + +/** \~french + * Define the BLUEVIOLET color. + * + */ +#define MLV_COLOR_BLUEVIOLET MLV_rgba(138,43,226,255) + +/** \~french + * Define the PURPLE color. + * + */ +#define MLV_COLOR_PURPLE MLV_rgba(160,32,240,255) + +/** \~french + * Define the MEDIUM_PURPLE color. + * + */ +#define MLV_COLOR_MEDIUM_PURPLE MLV_rgba(147,112,219,255) + +/** \~french + * Define the MEDIUMPURPLE color. + * + */ +#define MLV_COLOR_MEDIUMPURPLE MLV_rgba(147,112,219,255) + +/** \~french + * Define the THISTLE color. + * + */ +#define MLV_COLOR_THISTLE MLV_rgba(216,191,216,255) + +/** \~french + * Define the SNOW1 color. + * + */ +#define MLV_COLOR_SNOW1 MLV_rgba(255,250,250,255) + +/** \~french + * Define the SNOW2 color. + * + */ +#define MLV_COLOR_SNOW2 MLV_rgba(238,233,233,255) + +/** \~french + * Define the SNOW3 color. + * + */ +#define MLV_COLOR_SNOW3 MLV_rgba(205,201,201,255) + +/** \~french + * Define the SNOW4 color. + * + */ +#define MLV_COLOR_SNOW4 MLV_rgba(139,137,137,255) + +/** \~french + * Define the SEASHELL1 color. + * + */ +#define MLV_COLOR_SEASHELL1 MLV_rgba(255,245,238,255) + +/** \~french + * Define the SEASHELL2 color. + * + */ +#define MLV_COLOR_SEASHELL2 MLV_rgba(238,229,222,255) + +/** \~french + * Define the SEASHELL3 color. + * + */ +#define MLV_COLOR_SEASHELL3 MLV_rgba(205,197,191,255) + +/** \~french + * Define the SEASHELL4 color. + * + */ +#define MLV_COLOR_SEASHELL4 MLV_rgba(139,134,130,255) + +/** \~french + * Define the ANTIQUEWHITE1 color. + * + */ +#define MLV_COLOR_ANTIQUEWHITE1 MLV_rgba(255,239,219,255) + +/** \~french + * Define the ANTIQUEWHITE2 color. + * + */ +#define MLV_COLOR_ANTIQUEWHITE2 MLV_rgba(238,223,204,255) + +/** \~french + * Define the ANTIQUEWHITE3 color. + * + */ +#define MLV_COLOR_ANTIQUEWHITE3 MLV_rgba(205,192,176,255) + +/** \~french + * Define the ANTIQUEWHITE4 color. + * + */ +#define MLV_COLOR_ANTIQUEWHITE4 MLV_rgba(139,131,120,255) + +/** \~french + * Define the BISQUE1 color. + * + */ +#define MLV_COLOR_BISQUE1 MLV_rgba(255,228,196,255) + +/** \~french + * Define the BISQUE2 color. + * + */ +#define MLV_COLOR_BISQUE2 MLV_rgba(238,213,183,255) + +/** \~french + * Define the BISQUE3 color. + * + */ +#define MLV_COLOR_BISQUE3 MLV_rgba(205,183,158,255) + +/** \~french + * Define the BISQUE4 color. + * + */ +#define MLV_COLOR_BISQUE4 MLV_rgba(139,125,107,255) + +/** \~french + * Define the PEACHPUFF1 color. + * + */ +#define MLV_COLOR_PEACHPUFF1 MLV_rgba(255,218,185,255) + +/** \~french + * Define the PEACHPUFF2 color. + * + */ +#define MLV_COLOR_PEACHPUFF2 MLV_rgba(238,203,173,255) + +/** \~french + * Define the PEACHPUFF3 color. + * + */ +#define MLV_COLOR_PEACHPUFF3 MLV_rgba(205,175,149,255) + +/** \~french + * Define the PEACHPUFF4 color. + * + */ +#define MLV_COLOR_PEACHPUFF4 MLV_rgba(139,119,101,255) + +/** \~french + * Define the NAVAJOWHITE1 color. + * + */ +#define MLV_COLOR_NAVAJOWHITE1 MLV_rgba(255,222,173,255) + +/** \~french + * Define the NAVAJOWHITE2 color. + * + */ +#define MLV_COLOR_NAVAJOWHITE2 MLV_rgba(238,207,161,255) + +/** \~french + * Define the NAVAJOWHITE3 color. + * + */ +#define MLV_COLOR_NAVAJOWHITE3 MLV_rgba(205,179,139,255) + +/** \~french + * Define the NAVAJOWHITE4 color. + * + */ +#define MLV_COLOR_NAVAJOWHITE4 MLV_rgba(139,121,94,255) + +/** \~french + * Define the LEMONCHIFFON1 color. + * + */ +#define MLV_COLOR_LEMONCHIFFON1 MLV_rgba(255,250,205,255) + +/** \~french + * Define the LEMONCHIFFON2 color. + * + */ +#define MLV_COLOR_LEMONCHIFFON2 MLV_rgba(238,233,191,255) + +/** \~french + * Define the LEMONCHIFFON3 color. + * + */ +#define MLV_COLOR_LEMONCHIFFON3 MLV_rgba(205,201,165,255) + +/** \~french + * Define the LEMONCHIFFON4 color. + * + */ +#define MLV_COLOR_LEMONCHIFFON4 MLV_rgba(139,137,112,255) + +/** \~french + * Define the CORNSILK1 color. + * + */ +#define MLV_COLOR_CORNSILK1 MLV_rgba(255,248,220,255) + +/** \~french + * Define the CORNSILK2 color. + * + */ +#define MLV_COLOR_CORNSILK2 MLV_rgba(238,232,205,255) + +/** \~french + * Define the CORNSILK3 color. + * + */ +#define MLV_COLOR_CORNSILK3 MLV_rgba(205,200,177,255) + +/** \~french + * Define the CORNSILK4 color. + * + */ +#define MLV_COLOR_CORNSILK4 MLV_rgba(139,136,120,255) + +/** \~french + * Define the IVORY1 color. + * + */ +#define MLV_COLOR_IVORY1 MLV_rgba(255,255,240,255) + +/** \~french + * Define the IVORY2 color. + * + */ +#define MLV_COLOR_IVORY2 MLV_rgba(238,238,224,255) + +/** \~french + * Define the IVORY3 color. + * + */ +#define MLV_COLOR_IVORY3 MLV_rgba(205,205,193,255) + +/** \~french + * Define the IVORY4 color. + * + */ +#define MLV_COLOR_IVORY4 MLV_rgba(139,139,131,255) + +/** \~french + * Define the HONEYDEW1 color. + * + */ +#define MLV_COLOR_HONEYDEW1 MLV_rgba(240,255,240,255) + +/** \~french + * Define the HONEYDEW2 color. + * + */ +#define MLV_COLOR_HONEYDEW2 MLV_rgba(224,238,224,255) + +/** \~french + * Define the HONEYDEW3 color. + * + */ +#define MLV_COLOR_HONEYDEW3 MLV_rgba(193,205,193,255) + +/** \~french + * Define the HONEYDEW4 color. + * + */ +#define MLV_COLOR_HONEYDEW4 MLV_rgba(131,139,131,255) + +/** \~french + * Define the LAVENDERBLUSH1 color. + * + */ +#define MLV_COLOR_LAVENDERBLUSH1 MLV_rgba(255,240,245,255) + +/** \~french + * Define the LAVENDERBLUSH2 color. + * + */ +#define MLV_COLOR_LAVENDERBLUSH2 MLV_rgba(238,224,229,255) + +/** \~french + * Define the LAVENDERBLUSH3 color. + * + */ +#define MLV_COLOR_LAVENDERBLUSH3 MLV_rgba(205,193,197,255) + +/** \~french + * Define the LAVENDERBLUSH4 color. + * + */ +#define MLV_COLOR_LAVENDERBLUSH4 MLV_rgba(139,131,134,255) + +/** \~french + * Define the MISTYROSE1 color. + * + */ +#define MLV_COLOR_MISTYROSE1 MLV_rgba(255,228,225,255) + +/** \~french + * Define the MISTYROSE2 color. + * + */ +#define MLV_COLOR_MISTYROSE2 MLV_rgba(238,213,210,255) + +/** \~french + * Define the MISTYROSE3 color. + * + */ +#define MLV_COLOR_MISTYROSE3 MLV_rgba(205,183,181,255) + +/** \~french + * Define the MISTYROSE4 color. + * + */ +#define MLV_COLOR_MISTYROSE4 MLV_rgba(139,125,123,255) + +/** \~french + * Define the AZURE1 color. + * + */ +#define MLV_COLOR_AZURE1 MLV_rgba(240,255,255,255) + +/** \~french + * Define the AZURE2 color. + * + */ +#define MLV_COLOR_AZURE2 MLV_rgba(224,238,238,255) + +/** \~french + * Define the AZURE3 color. + * + */ +#define MLV_COLOR_AZURE3 MLV_rgba(193,205,205,255) + +/** \~french + * Define the AZURE4 color. + * + */ +#define MLV_COLOR_AZURE4 MLV_rgba(131,139,139,255) + +/** \~french + * Define the SLATEBLUE1 color. + * + */ +#define MLV_COLOR_SLATEBLUE1 MLV_rgba(131,111,255,255) + +/** \~french + * Define the SLATEBLUE2 color. + * + */ +#define MLV_COLOR_SLATEBLUE2 MLV_rgba(122,103,238,255) + +/** \~french + * Define the SLATEBLUE3 color. + * + */ +#define MLV_COLOR_SLATEBLUE3 MLV_rgba(105,89,205,255) + +/** \~french + * Define the SLATEBLUE4 color. + * + */ +#define MLV_COLOR_SLATEBLUE4 MLV_rgba(71,60,139,255) + +/** \~french + * Define the ROYALBLUE1 color. + * + */ +#define MLV_COLOR_ROYALBLUE1 MLV_rgba(72,118,255,255) + +/** \~french + * Define the ROYALBLUE2 color. + * + */ +#define MLV_COLOR_ROYALBLUE2 MLV_rgba(67,110,238,255) + +/** \~french + * Define the ROYALBLUE3 color. + * + */ +#define MLV_COLOR_ROYALBLUE3 MLV_rgba(58,95,205,255) + +/** \~french + * Define the ROYALBLUE4 color. + * + */ +#define MLV_COLOR_ROYALBLUE4 MLV_rgba(39,64,139,255) + +/** \~french + * Define the BLUE1 color. + * + */ +#define MLV_COLOR_BLUE1 MLV_rgba(0,0,255,255) + +/** \~french + * Define the BLUE2 color. + * + */ +#define MLV_COLOR_BLUE2 MLV_rgba(0,0,238,255) + +/** \~french + * Define the BLUE3 color. + * + */ +#define MLV_COLOR_BLUE3 MLV_rgba(0,0,205,255) + +/** \~french + * Define the BLUE4 color. + * + */ +#define MLV_COLOR_BLUE4 MLV_rgba(0,0,139,255) + +/** \~french + * Define the DODGERBLUE1 color. + * + */ +#define MLV_COLOR_DODGERBLUE1 MLV_rgba(30,144,255,255) + +/** \~french + * Define the DODGERBLUE2 color. + * + */ +#define MLV_COLOR_DODGERBLUE2 MLV_rgba(28,134,238,255) + +/** \~french + * Define the DODGERBLUE3 color. + * + */ +#define MLV_COLOR_DODGERBLUE3 MLV_rgba(24,116,205,255) + +/** \~french + * Define the DODGERBLUE4 color. + * + */ +#define MLV_COLOR_DODGERBLUE4 MLV_rgba(16,78,139,255) + +/** \~french + * Define the STEELBLUE1 color. + * + */ +#define MLV_COLOR_STEELBLUE1 MLV_rgba(99,184,255,255) + +/** \~french + * Define the STEELBLUE2 color. + * + */ +#define MLV_COLOR_STEELBLUE2 MLV_rgba(92,172,238,255) + +/** \~french + * Define the STEELBLUE3 color. + * + */ +#define MLV_COLOR_STEELBLUE3 MLV_rgba(79,148,205,255) + +/** \~french + * Define the STEELBLUE4 color. + * + */ +#define MLV_COLOR_STEELBLUE4 MLV_rgba(54,100,139,255) + +/** \~french + * Define the DEEPSKYBLUE1 color. + * + */ +#define MLV_COLOR_DEEPSKYBLUE1 MLV_rgba(0,191,255,255) + +/** \~french + * Define the DEEPSKYBLUE2 color. + * + */ +#define MLV_COLOR_DEEPSKYBLUE2 MLV_rgba(0,178,238,255) + +/** \~french + * Define the DEEPSKYBLUE3 color. + * + */ +#define MLV_COLOR_DEEPSKYBLUE3 MLV_rgba(0,154,205,255) + +/** \~french + * Define the DEEPSKYBLUE4 color. + * + */ +#define MLV_COLOR_DEEPSKYBLUE4 MLV_rgba(0,104,139,255) + +/** \~french + * Define the SKYBLUE1 color. + * + */ +#define MLV_COLOR_SKYBLUE1 MLV_rgba(135,206,255,255) + +/** \~french + * Define the SKYBLUE2 color. + * + */ +#define MLV_COLOR_SKYBLUE2 MLV_rgba(126,192,238,255) + +/** \~french + * Define the SKYBLUE3 color. + * + */ +#define MLV_COLOR_SKYBLUE3 MLV_rgba(108,166,205,255) + +/** \~french + * Define the SKYBLUE4 color. + * + */ +#define MLV_COLOR_SKYBLUE4 MLV_rgba(74,112,139,255) + +/** \~french + * Define the LIGHTSKYBLUE1 color. + * + */ +#define MLV_COLOR_LIGHTSKYBLUE1 MLV_rgba(176,226,255,255) + +/** \~french + * Define the LIGHTSKYBLUE2 color. + * + */ +#define MLV_COLOR_LIGHTSKYBLUE2 MLV_rgba(164,211,238,255) + +/** \~french + * Define the LIGHTSKYBLUE3 color. + * + */ +#define MLV_COLOR_LIGHTSKYBLUE3 MLV_rgba(141,182,205,255) + +/** \~french + * Define the LIGHTSKYBLUE4 color. + * + */ +#define MLV_COLOR_LIGHTSKYBLUE4 MLV_rgba(96,123,139,255) + +/** \~french + * Define the SLATEGRAY1 color. + * + */ +#define MLV_COLOR_SLATEGRAY1 MLV_rgba(198,226,255,255) + +/** \~french + * Define the SLATEGRAY2 color. + * + */ +#define MLV_COLOR_SLATEGRAY2 MLV_rgba(185,211,238,255) + +/** \~french + * Define the SLATEGRAY3 color. + * + */ +#define MLV_COLOR_SLATEGRAY3 MLV_rgba(159,182,205,255) + +/** \~french + * Define the SLATEGRAY4 color. + * + */ +#define MLV_COLOR_SLATEGRAY4 MLV_rgba(108,123,139,255) + +/** \~french + * Define the LIGHTSTEELBLUE1 color. + * + */ +#define MLV_COLOR_LIGHTSTEELBLUE1 MLV_rgba(202,225,255,255) + +/** \~french + * Define the LIGHTSTEELBLUE2 color. + * + */ +#define MLV_COLOR_LIGHTSTEELBLUE2 MLV_rgba(188,210,238,255) + +/** \~french + * Define the LIGHTSTEELBLUE3 color. + * + */ +#define MLV_COLOR_LIGHTSTEELBLUE3 MLV_rgba(162,181,205,255) + +/** \~french + * Define the LIGHTSTEELBLUE4 color. + * + */ +#define MLV_COLOR_LIGHTSTEELBLUE4 MLV_rgba(110,123,139,255) + +/** \~french + * Define the LIGHTBLUE1 color. + * + */ +#define MLV_COLOR_LIGHTBLUE1 MLV_rgba(191,239,255,255) + +/** \~french + * Define the LIGHTBLUE2 color. + * + */ +#define MLV_COLOR_LIGHTBLUE2 MLV_rgba(178,223,238,255) + +/** \~french + * Define the LIGHTBLUE3 color. + * + */ +#define MLV_COLOR_LIGHTBLUE3 MLV_rgba(154,192,205,255) + +/** \~french + * Define the LIGHTBLUE4 color. + * + */ +#define MLV_COLOR_LIGHTBLUE4 MLV_rgba(104,131,139,255) + +/** \~french + * Define the LIGHTCYAN1 color. + * + */ +#define MLV_COLOR_LIGHTCYAN1 MLV_rgba(224,255,255,255) + +/** \~french + * Define the LIGHTCYAN2 color. + * + */ +#define MLV_COLOR_LIGHTCYAN2 MLV_rgba(209,238,238,255) + +/** \~french + * Define the LIGHTCYAN3 color. + * + */ +#define MLV_COLOR_LIGHTCYAN3 MLV_rgba(180,205,205,255) + +/** \~french + * Define the LIGHTCYAN4 color. + * + */ +#define MLV_COLOR_LIGHTCYAN4 MLV_rgba(122,139,139,255) + +/** \~french + * Define the PALETURQUOISE1 color. + * + */ +#define MLV_COLOR_PALETURQUOISE1 MLV_rgba(187,255,255,255) + +/** \~french + * Define the PALETURQUOISE2 color. + * + */ +#define MLV_COLOR_PALETURQUOISE2 MLV_rgba(174,238,238,255) + +/** \~french + * Define the PALETURQUOISE3 color. + * + */ +#define MLV_COLOR_PALETURQUOISE3 MLV_rgba(150,205,205,255) + +/** \~french + * Define the PALETURQUOISE4 color. + * + */ +#define MLV_COLOR_PALETURQUOISE4 MLV_rgba(102,139,139,255) + +/** \~french + * Define the CADETBLUE1 color. + * + */ +#define MLV_COLOR_CADETBLUE1 MLV_rgba(152,245,255,255) + +/** \~french + * Define the CADETBLUE2 color. + * + */ +#define MLV_COLOR_CADETBLUE2 MLV_rgba(142,229,238,255) + +/** \~french + * Define the CADETBLUE3 color. + * + */ +#define MLV_COLOR_CADETBLUE3 MLV_rgba(122,197,205,255) + +/** \~french + * Define the CADETBLUE4 color. + * + */ +#define MLV_COLOR_CADETBLUE4 MLV_rgba(83,134,139,255) + +/** \~french + * Define the TURQUOISE1 color. + * + */ +#define MLV_COLOR_TURQUOISE1 MLV_rgba(0,245,255,255) + +/** \~french + * Define the TURQUOISE2 color. + * + */ +#define MLV_COLOR_TURQUOISE2 MLV_rgba(0,229,238,255) + +/** \~french + * Define the TURQUOISE3 color. + * + */ +#define MLV_COLOR_TURQUOISE3 MLV_rgba(0,197,205,255) + +/** \~french + * Define the TURQUOISE4 color. + * + */ +#define MLV_COLOR_TURQUOISE4 MLV_rgba(0,134,139,255) + +/** \~french + * Define the CYAN1 color. + * + */ +#define MLV_COLOR_CYAN1 MLV_rgba(0,255,255,255) + +/** \~french + * Define the CYAN2 color. + * + */ +#define MLV_COLOR_CYAN2 MLV_rgba(0,238,238,255) + +/** \~french + * Define the CYAN3 color. + * + */ +#define MLV_COLOR_CYAN3 MLV_rgba(0,205,205,255) + +/** \~french + * Define the CYAN4 color. + * + */ +#define MLV_COLOR_CYAN4 MLV_rgba(0,139,139,255) + +/** \~french + * Define the DARKSLATEGRAY1 color. + * + */ +#define MLV_COLOR_DARKSLATEGRAY1 MLV_rgba(151,255,255,255) + +/** \~french + * Define the DARKSLATEGRAY2 color. + * + */ +#define MLV_COLOR_DARKSLATEGRAY2 MLV_rgba(141,238,238,255) + +/** \~french + * Define the DARKSLATEGRAY3 color. + * + */ +#define MLV_COLOR_DARKSLATEGRAY3 MLV_rgba(121,205,205,255) + +/** \~french + * Define the DARKSLATEGRAY4 color. + * + */ +#define MLV_COLOR_DARKSLATEGRAY4 MLV_rgba(82,139,139,255) + +/** \~french + * Define the AQUAMARINE1 color. + * + */ +#define MLV_COLOR_AQUAMARINE1 MLV_rgba(127,255,212,255) + +/** \~french + * Define the AQUAMARINE2 color. + * + */ +#define MLV_COLOR_AQUAMARINE2 MLV_rgba(118,238,198,255) + +/** \~french + * Define the AQUAMARINE3 color. + * + */ +#define MLV_COLOR_AQUAMARINE3 MLV_rgba(102,205,170,255) + +/** \~french + * Define the AQUAMARINE4 color. + * + */ +#define MLV_COLOR_AQUAMARINE4 MLV_rgba(69,139,116,255) + +/** \~french + * Define the DARKSEAGREEN1 color. + * + */ +#define MLV_COLOR_DARKSEAGREEN1 MLV_rgba(193,255,193,255) + +/** \~french + * Define the DARKSEAGREEN2 color. + * + */ +#define MLV_COLOR_DARKSEAGREEN2 MLV_rgba(180,238,180,255) + +/** \~french + * Define the DARKSEAGREEN3 color. + * + */ +#define MLV_COLOR_DARKSEAGREEN3 MLV_rgba(155,205,155,255) + +/** \~french + * Define the DARKSEAGREEN4 color. + * + */ +#define MLV_COLOR_DARKSEAGREEN4 MLV_rgba(105,139,105,255) + +/** \~french + * Define the SEAGREEN1 color. + * + */ +#define MLV_COLOR_SEAGREEN1 MLV_rgba(84,255,159,255) + +/** \~french + * Define the SEAGREEN2 color. + * + */ +#define MLV_COLOR_SEAGREEN2 MLV_rgba(78,238,148,255) + +/** \~french + * Define the SEAGREEN3 color. + * + */ +#define MLV_COLOR_SEAGREEN3 MLV_rgba(67,205,128,255) + +/** \~french + * Define the SEAGREEN4 color. + * + */ +#define MLV_COLOR_SEAGREEN4 MLV_rgba(46,139,87,255) + +/** \~french + * Define the PALEGREEN1 color. + * + */ +#define MLV_COLOR_PALEGREEN1 MLV_rgba(154,255,154,255) + +/** \~french + * Define the PALEGREEN2 color. + * + */ +#define MLV_COLOR_PALEGREEN2 MLV_rgba(144,238,144,255) + +/** \~french + * Define the PALEGREEN3 color. + * + */ +#define MLV_COLOR_PALEGREEN3 MLV_rgba(124,205,124,255) + +/** \~french + * Define the PALEGREEN4 color. + * + */ +#define MLV_COLOR_PALEGREEN4 MLV_rgba(84,139,84,255) + +/** \~french + * Define the SPRINGGREEN1 color. + * + */ +#define MLV_COLOR_SPRINGGREEN1 MLV_rgba(0,255,127,255) + +/** \~french + * Define the SPRINGGREEN2 color. + * + */ +#define MLV_COLOR_SPRINGGREEN2 MLV_rgba(0,238,118,255) + +/** \~french + * Define the SPRINGGREEN3 color. + * + */ +#define MLV_COLOR_SPRINGGREEN3 MLV_rgba(0,205,102,255) + +/** \~french + * Define the SPRINGGREEN4 color. + * + */ +#define MLV_COLOR_SPRINGGREEN4 MLV_rgba(0,139,69,255) + +/** \~french + * Define the GREEN1 color. + * + */ +#define MLV_COLOR_GREEN1 MLV_rgba(0,255,0,255) + +/** \~french + * Define the GREEN2 color. + * + */ +#define MLV_COLOR_GREEN2 MLV_rgba(0,238,0,255) + +/** \~french + * Define the GREEN3 color. + * + */ +#define MLV_COLOR_GREEN3 MLV_rgba(0,205,0,255) + +/** \~french + * Define the GREEN4 color. + * + */ +#define MLV_COLOR_GREEN4 MLV_rgba(0,139,0,255) + +/** \~french + * Define the CHARTREUSE1 color. + * + */ +#define MLV_COLOR_CHARTREUSE1 MLV_rgba(127,255,0,255) + +/** \~french + * Define the CHARTREUSE2 color. + * + */ +#define MLV_COLOR_CHARTREUSE2 MLV_rgba(118,238,0,255) + +/** \~french + * Define the CHARTREUSE3 color. + * + */ +#define MLV_COLOR_CHARTREUSE3 MLV_rgba(102,205,0,255) + +/** \~french + * Define the CHARTREUSE4 color. + * + */ +#define MLV_COLOR_CHARTREUSE4 MLV_rgba(69,139,0,255) + +/** \~french + * Define the OLIVEDRAB1 color. + * + */ +#define MLV_COLOR_OLIVEDRAB1 MLV_rgba(192,255,62,255) + +/** \~french + * Define the OLIVEDRAB2 color. + * + */ +#define MLV_COLOR_OLIVEDRAB2 MLV_rgba(179,238,58,255) + +/** \~french + * Define the OLIVEDRAB3 color. + * + */ +#define MLV_COLOR_OLIVEDRAB3 MLV_rgba(154,205,50,255) + +/** \~french + * Define the OLIVEDRAB4 color. + * + */ +#define MLV_COLOR_OLIVEDRAB4 MLV_rgba(105,139,34,255) + +/** \~french + * Define the DARKOLIVEGREEN1 color. + * + */ +#define MLV_COLOR_DARKOLIVEGREEN1 MLV_rgba(202,255,112,255) + +/** \~french + * Define the DARKOLIVEGREEN2 color. + * + */ +#define MLV_COLOR_DARKOLIVEGREEN2 MLV_rgba(188,238,104,255) + +/** \~french + * Define the DARKOLIVEGREEN3 color. + * + */ +#define MLV_COLOR_DARKOLIVEGREEN3 MLV_rgba(162,205,90,255) + +/** \~french + * Define the DARKOLIVEGREEN4 color. + * + */ +#define MLV_COLOR_DARKOLIVEGREEN4 MLV_rgba(110,139,61,255) + +/** \~french + * Define the KHAKI1 color. + * + */ +#define MLV_COLOR_KHAKI1 MLV_rgba(255,246,143,255) + +/** \~french + * Define the KHAKI2 color. + * + */ +#define MLV_COLOR_KHAKI2 MLV_rgba(238,230,133,255) + +/** \~french + * Define the KHAKI3 color. + * + */ +#define MLV_COLOR_KHAKI3 MLV_rgba(205,198,115,255) + +/** \~french + * Define the KHAKI4 color. + * + */ +#define MLV_COLOR_KHAKI4 MLV_rgba(139,134,78,255) + +/** \~french + * Define the LIGHTGOLDENROD1 color. + * + */ +#define MLV_COLOR_LIGHTGOLDENROD1 MLV_rgba(255,236,139,255) + +/** \~french + * Define the LIGHTGOLDENROD2 color. + * + */ +#define MLV_COLOR_LIGHTGOLDENROD2 MLV_rgba(238,220,130,255) + +/** \~french + * Define the LIGHTGOLDENROD3 color. + * + */ +#define MLV_COLOR_LIGHTGOLDENROD3 MLV_rgba(205,190,112,255) + +/** \~french + * Define the LIGHTGOLDENROD4 color. + * + */ +#define MLV_COLOR_LIGHTGOLDENROD4 MLV_rgba(139,129,76,255) + +/** \~french + * Define the LIGHTYELLOW1 color. + * + */ +#define MLV_COLOR_LIGHTYELLOW1 MLV_rgba(255,255,224,255) + +/** \~french + * Define the LIGHTYELLOW2 color. + * + */ +#define MLV_COLOR_LIGHTYELLOW2 MLV_rgba(238,238,209,255) + +/** \~french + * Define the LIGHTYELLOW3 color. + * + */ +#define MLV_COLOR_LIGHTYELLOW3 MLV_rgba(205,205,180,255) + +/** \~french + * Define the LIGHTYELLOW4 color. + * + */ +#define MLV_COLOR_LIGHTYELLOW4 MLV_rgba(139,139,122,255) + +/** \~french + * Define the YELLOW1 color. + * + */ +#define MLV_COLOR_YELLOW1 MLV_rgba(255,255,0,255) + +/** \~french + * Define the YELLOW2 color. + * + */ +#define MLV_COLOR_YELLOW2 MLV_rgba(238,238,0,255) + +/** \~french + * Define the YELLOW3 color. + * + */ +#define MLV_COLOR_YELLOW3 MLV_rgba(205,205,0,255) + +/** \~french + * Define the YELLOW4 color. + * + */ +#define MLV_COLOR_YELLOW4 MLV_rgba(139,139,0,255) + +/** \~french + * Define the GOLD1 color. + * + */ +#define MLV_COLOR_GOLD1 MLV_rgba(255,215,0,255) + +/** \~french + * Define the GOLD2 color. + * + */ +#define MLV_COLOR_GOLD2 MLV_rgba(238,201,0,255) + +/** \~french + * Define the GOLD3 color. + * + */ +#define MLV_COLOR_GOLD3 MLV_rgba(205,173,0,255) + +/** \~french + * Define the GOLD4 color. + * + */ +#define MLV_COLOR_GOLD4 MLV_rgba(139,117,0,255) + +/** \~french + * Define the GOLDENROD1 color. + * + */ +#define MLV_COLOR_GOLDENROD1 MLV_rgba(255,193,37,255) + +/** \~french + * Define the GOLDENROD2 color. + * + */ +#define MLV_COLOR_GOLDENROD2 MLV_rgba(238,180,34,255) + +/** \~french + * Define the GOLDENROD3 color. + * + */ +#define MLV_COLOR_GOLDENROD3 MLV_rgba(205,155,29,255) + +/** \~french + * Define the GOLDENROD4 color. + * + */ +#define MLV_COLOR_GOLDENROD4 MLV_rgba(139,105,20,255) + +/** \~french + * Define the DARKGOLDENROD1 color. + * + */ +#define MLV_COLOR_DARKGOLDENROD1 MLV_rgba(255,185,15,255) + +/** \~french + * Define the DARKGOLDENROD2 color. + * + */ +#define MLV_COLOR_DARKGOLDENROD2 MLV_rgba(238,173,14,255) + +/** \~french + * Define the DARKGOLDENROD3 color. + * + */ +#define MLV_COLOR_DARKGOLDENROD3 MLV_rgba(205,149,12,255) + +/** \~french + * Define the DARKGOLDENROD4 color. + * + */ +#define MLV_COLOR_DARKGOLDENROD4 MLV_rgba(139,101,8,255) + +/** \~french + * Define the ROSYBROWN1 color. + * + */ +#define MLV_COLOR_ROSYBROWN1 MLV_rgba(255,193,193,255) + +/** \~french + * Define the ROSYBROWN2 color. + * + */ +#define MLV_COLOR_ROSYBROWN2 MLV_rgba(238,180,180,255) + +/** \~french + * Define the ROSYBROWN3 color. + * + */ +#define MLV_COLOR_ROSYBROWN3 MLV_rgba(205,155,155,255) + +/** \~french + * Define the ROSYBROWN4 color. + * + */ +#define MLV_COLOR_ROSYBROWN4 MLV_rgba(139,105,105,255) + +/** \~french + * Define the INDIANRED1 color. + * + */ +#define MLV_COLOR_INDIANRED1 MLV_rgba(255,106,106,255) + +/** \~french + * Define the INDIANRED2 color. + * + */ +#define MLV_COLOR_INDIANRED2 MLV_rgba(238,99,99,255) + +/** \~french + * Define the INDIANRED3 color. + * + */ +#define MLV_COLOR_INDIANRED3 MLV_rgba(205,85,85,255) + +/** \~french + * Define the INDIANRED4 color. + * + */ +#define MLV_COLOR_INDIANRED4 MLV_rgba(139,58,58,255) + +/** \~french + * Define the SIENNA1 color. + * + */ +#define MLV_COLOR_SIENNA1 MLV_rgba(255,130,71,255) + +/** \~french + * Define the SIENNA2 color. + * + */ +#define MLV_COLOR_SIENNA2 MLV_rgba(238,121,66,255) + +/** \~french + * Define the SIENNA3 color. + * + */ +#define MLV_COLOR_SIENNA3 MLV_rgba(205,104,57,255) + +/** \~french + * Define the SIENNA4 color. + * + */ +#define MLV_COLOR_SIENNA4 MLV_rgba(139,71,38,255) + +/** \~french + * Define the BURLYWOOD1 color. + * + */ +#define MLV_COLOR_BURLYWOOD1 MLV_rgba(255,211,155,255) + +/** \~french + * Define the BURLYWOOD2 color. + * + */ +#define MLV_COLOR_BURLYWOOD2 MLV_rgba(238,197,145,255) + +/** \~french + * Define the BURLYWOOD3 color. + * + */ +#define MLV_COLOR_BURLYWOOD3 MLV_rgba(205,170,125,255) + +/** \~french + * Define the BURLYWOOD4 color. + * + */ +#define MLV_COLOR_BURLYWOOD4 MLV_rgba(139,115,85,255) + +/** \~french + * Define the WHEAT1 color. + * + */ +#define MLV_COLOR_WHEAT1 MLV_rgba(255,231,186,255) + +/** \~french + * Define the WHEAT2 color. + * + */ +#define MLV_COLOR_WHEAT2 MLV_rgba(238,216,174,255) + +/** \~french + * Define the WHEAT3 color. + * + */ +#define MLV_COLOR_WHEAT3 MLV_rgba(205,186,150,255) + +/** \~french + * Define the WHEAT4 color. + * + */ +#define MLV_COLOR_WHEAT4 MLV_rgba(139,126,102,255) + +/** \~french + * Define the TAN1 color. + * + */ +#define MLV_COLOR_TAN1 MLV_rgba(255,165,79,255) + +/** \~french + * Define the TAN2 color. + * + */ +#define MLV_COLOR_TAN2 MLV_rgba(238,154,73,255) + +/** \~french + * Define the TAN3 color. + * + */ +#define MLV_COLOR_TAN3 MLV_rgba(205,133,63,255) + +/** \~french + * Define the TAN4 color. + * + */ +#define MLV_COLOR_TAN4 MLV_rgba(139,90,43,255) + +/** \~french + * Define the CHOCOLATE1 color. + * + */ +#define MLV_COLOR_CHOCOLATE1 MLV_rgba(255,127,36,255) + +/** \~french + * Define the CHOCOLATE2 color. + * + */ +#define MLV_COLOR_CHOCOLATE2 MLV_rgba(238,118,33,255) + +/** \~french + * Define the CHOCOLATE3 color. + * + */ +#define MLV_COLOR_CHOCOLATE3 MLV_rgba(205,102,29,255) + +/** \~french + * Define the CHOCOLATE4 color. + * + */ +#define MLV_COLOR_CHOCOLATE4 MLV_rgba(139,69,19,255) + +/** \~french + * Define the FIREBRICK1 color. + * + */ +#define MLV_COLOR_FIREBRICK1 MLV_rgba(255,48,48,255) + +/** \~french + * Define the FIREBRICK2 color. + * + */ +#define MLV_COLOR_FIREBRICK2 MLV_rgba(238,44,44,255) + +/** \~french + * Define the FIREBRICK3 color. + * + */ +#define MLV_COLOR_FIREBRICK3 MLV_rgba(205,38,38,255) + +/** \~french + * Define the FIREBRICK4 color. + * + */ +#define MLV_COLOR_FIREBRICK4 MLV_rgba(139,26,26,255) + +/** \~french + * Define the BROWN1 color. + * + */ +#define MLV_COLOR_BROWN1 MLV_rgba(255,64,64,255) + +/** \~french + * Define the BROWN2 color. + * + */ +#define MLV_COLOR_BROWN2 MLV_rgba(238,59,59,255) + +/** \~french + * Define the BROWN3 color. + * + */ +#define MLV_COLOR_BROWN3 MLV_rgba(205,51,51,255) + +/** \~french + * Define the BROWN4 color. + * + */ +#define MLV_COLOR_BROWN4 MLV_rgba(139,35,35,255) + +/** \~french + * Define the SALMON1 color. + * + */ +#define MLV_COLOR_SALMON1 MLV_rgba(255,140,105,255) + +/** \~french + * Define the SALMON2 color. + * + */ +#define MLV_COLOR_SALMON2 MLV_rgba(238,130,98,255) + +/** \~french + * Define the SALMON3 color. + * + */ +#define MLV_COLOR_SALMON3 MLV_rgba(205,112,84,255) + +/** \~french + * Define the SALMON4 color. + * + */ +#define MLV_COLOR_SALMON4 MLV_rgba(139,76,57,255) + +/** \~french + * Define the LIGHTSALMON1 color. + * + */ +#define MLV_COLOR_LIGHTSALMON1 MLV_rgba(255,160,122,255) + +/** \~french + * Define the LIGHTSALMON2 color. + * + */ +#define MLV_COLOR_LIGHTSALMON2 MLV_rgba(238,149,114,255) + +/** \~french + * Define the LIGHTSALMON3 color. + * + */ +#define MLV_COLOR_LIGHTSALMON3 MLV_rgba(205,129,98,255) + +/** \~french + * Define the LIGHTSALMON4 color. + * + */ +#define MLV_COLOR_LIGHTSALMON4 MLV_rgba(139,87,66,255) + +/** \~french + * Define the ORANGE1 color. + * + */ +#define MLV_COLOR_ORANGE1 MLV_rgba(255,165,0,255) + +/** \~french + * Define the ORANGE2 color. + * + */ +#define MLV_COLOR_ORANGE2 MLV_rgba(238,154,0,255) + +/** \~french + * Define the ORANGE3 color. + * + */ +#define MLV_COLOR_ORANGE3 MLV_rgba(205,133,0,255) + +/** \~french + * Define the ORANGE4 color. + * + */ +#define MLV_COLOR_ORANGE4 MLV_rgba(139,90,0,255) + +/** \~french + * Define the DARKORANGE1 color. + * + */ +#define MLV_COLOR_DARKORANGE1 MLV_rgba(255,127,0,255) + +/** \~french + * Define the DARKORANGE2 color. + * + */ +#define MLV_COLOR_DARKORANGE2 MLV_rgba(238,118,0,255) + +/** \~french + * Define the DARKORANGE3 color. + * + */ +#define MLV_COLOR_DARKORANGE3 MLV_rgba(205,102,0,255) + +/** \~french + * Define the DARKORANGE4 color. + * + */ +#define MLV_COLOR_DARKORANGE4 MLV_rgba(139,69,0,255) + +/** \~french + * Define the CORAL1 color. + * + */ +#define MLV_COLOR_CORAL1 MLV_rgba(255,114,86,255) + +/** \~french + * Define the CORAL2 color. + * + */ +#define MLV_COLOR_CORAL2 MLV_rgba(238,106,80,255) + +/** \~french + * Define the CORAL3 color. + * + */ +#define MLV_COLOR_CORAL3 MLV_rgba(205,91,69,255) + +/** \~french + * Define the CORAL4 color. + * + */ +#define MLV_COLOR_CORAL4 MLV_rgba(139,62,47,255) + +/** \~french + * Define the TOMATO1 color. + * + */ +#define MLV_COLOR_TOMATO1 MLV_rgba(255,99,71,255) + +/** \~french + * Define the TOMATO2 color. + * + */ +#define MLV_COLOR_TOMATO2 MLV_rgba(238,92,66,255) + +/** \~french + * Define the TOMATO3 color. + * + */ +#define MLV_COLOR_TOMATO3 MLV_rgba(205,79,57,255) + +/** \~french + * Define the TOMATO4 color. + * + */ +#define MLV_COLOR_TOMATO4 MLV_rgba(139,54,38,255) + +/** \~french + * Define the ORANGERED1 color. + * + */ +#define MLV_COLOR_ORANGERED1 MLV_rgba(255,69,0,255) + +/** \~french + * Define the ORANGERED2 color. + * + */ +#define MLV_COLOR_ORANGERED2 MLV_rgba(238,64,0,255) + +/** \~french + * Define the ORANGERED3 color. + * + */ +#define MLV_COLOR_ORANGERED3 MLV_rgba(205,55,0,255) + +/** \~french + * Define the ORANGERED4 color. + * + */ +#define MLV_COLOR_ORANGERED4 MLV_rgba(139,37,0,255) + +/** \~french + * Define the RED1 color. + * + */ +#define MLV_COLOR_RED1 MLV_rgba(255,0,0,255) + +/** \~french + * Define the RED2 color. + * + */ +#define MLV_COLOR_RED2 MLV_rgba(238,0,0,255) + +/** \~french + * Define the RED3 color. + * + */ +#define MLV_COLOR_RED3 MLV_rgba(205,0,0,255) + +/** \~french + * Define the RED4 color. + * + */ +#define MLV_COLOR_RED4 MLV_rgba(139,0,0,255) + +/** \~french + * Define the DEEPPINK1 color. + * + */ +#define MLV_COLOR_DEEPPINK1 MLV_rgba(255,20,147,255) + +/** \~french + * Define the DEEPPINK2 color. + * + */ +#define MLV_COLOR_DEEPPINK2 MLV_rgba(238,18,137,255) + +/** \~french + * Define the DEEPPINK3 color. + * + */ +#define MLV_COLOR_DEEPPINK3 MLV_rgba(205,16,118,255) + +/** \~french + * Define the DEEPPINK4 color. + * + */ +#define MLV_COLOR_DEEPPINK4 MLV_rgba(139,10,80,255) + +/** \~french + * Define the HOTPINK1 color. + * + */ +#define MLV_COLOR_HOTPINK1 MLV_rgba(255,110,180,255) + +/** \~french + * Define the HOTPINK2 color. + * + */ +#define MLV_COLOR_HOTPINK2 MLV_rgba(238,106,167,255) + +/** \~french + * Define the HOTPINK3 color. + * + */ +#define MLV_COLOR_HOTPINK3 MLV_rgba(205,96,144,255) + +/** \~french + * Define the HOTPINK4 color. + * + */ +#define MLV_COLOR_HOTPINK4 MLV_rgba(139,58,98,255) + +/** \~french + * Define the PINK1 color. + * + */ +#define MLV_COLOR_PINK1 MLV_rgba(255,181,197,255) + +/** \~french + * Define the PINK2 color. + * + */ +#define MLV_COLOR_PINK2 MLV_rgba(238,169,184,255) + +/** \~french + * Define the PINK3 color. + * + */ +#define MLV_COLOR_PINK3 MLV_rgba(205,145,158,255) + +/** \~french + * Define the PINK4 color. + * + */ +#define MLV_COLOR_PINK4 MLV_rgba(139,99,108,255) + +/** \~french + * Define the LIGHTPINK1 color. + * + */ +#define MLV_COLOR_LIGHTPINK1 MLV_rgba(255,174,185,255) + +/** \~french + * Define the LIGHTPINK2 color. + * + */ +#define MLV_COLOR_LIGHTPINK2 MLV_rgba(238,162,173,255) + +/** \~french + * Define the LIGHTPINK3 color. + * + */ +#define MLV_COLOR_LIGHTPINK3 MLV_rgba(205,140,149,255) + +/** \~french + * Define the LIGHTPINK4 color. + * + */ +#define MLV_COLOR_LIGHTPINK4 MLV_rgba(139,95,101,255) + +/** \~french + * Define the PALEVIOLETRED1 color. + * + */ +#define MLV_COLOR_PALEVIOLETRED1 MLV_rgba(255,130,171,255) + +/** \~french + * Define the PALEVIOLETRED2 color. + * + */ +#define MLV_COLOR_PALEVIOLETRED2 MLV_rgba(238,121,159,255) + +/** \~french + * Define the PALEVIOLETRED3 color. + * + */ +#define MLV_COLOR_PALEVIOLETRED3 MLV_rgba(205,104,137,255) + +/** \~french + * Define the PALEVIOLETRED4 color. + * + */ +#define MLV_COLOR_PALEVIOLETRED4 MLV_rgba(139,71,93,255) + +/** \~french + * Define the MAROON1 color. + * + */ +#define MLV_COLOR_MAROON1 MLV_rgba(255,52,179,255) + +/** \~french + * Define the MAROON2 color. + * + */ +#define MLV_COLOR_MAROON2 MLV_rgba(238,48,167,255) + +/** \~french + * Define the MAROON3 color. + * + */ +#define MLV_COLOR_MAROON3 MLV_rgba(205,41,144,255) + +/** \~french + * Define the MAROON4 color. + * + */ +#define MLV_COLOR_MAROON4 MLV_rgba(139,28,98,255) + +/** \~french + * Define the VIOLETRED1 color. + * + */ +#define MLV_COLOR_VIOLETRED1 MLV_rgba(255,62,150,255) + +/** \~french + * Define the VIOLETRED2 color. + * + */ +#define MLV_COLOR_VIOLETRED2 MLV_rgba(238,58,140,255) + +/** \~french + * Define the VIOLETRED3 color. + * + */ +#define MLV_COLOR_VIOLETRED3 MLV_rgba(205,50,120,255) + +/** \~french + * Define the VIOLETRED4 color. + * + */ +#define MLV_COLOR_VIOLETRED4 MLV_rgba(139,34,82,255) + +/** \~french + * Define the MAGENTA1 color. + * + */ +#define MLV_COLOR_MAGENTA1 MLV_rgba(255,0,255,255) + +/** \~french + * Define the MAGENTA2 color. + * + */ +#define MLV_COLOR_MAGENTA2 MLV_rgba(238,0,238,255) + +/** \~french + * Define the MAGENTA3 color. + * + */ +#define MLV_COLOR_MAGENTA3 MLV_rgba(205,0,205,255) + +/** \~french + * Define the MAGENTA4 color. + * + */ +#define MLV_COLOR_MAGENTA4 MLV_rgba(139,0,139,255) + +/** \~french + * Define the ORCHID1 color. + * + */ +#define MLV_COLOR_ORCHID1 MLV_rgba(255,131,250,255) + +/** \~french + * Define the ORCHID2 color. + * + */ +#define MLV_COLOR_ORCHID2 MLV_rgba(238,122,233,255) + +/** \~french + * Define the ORCHID3 color. + * + */ +#define MLV_COLOR_ORCHID3 MLV_rgba(205,105,201,255) + +/** \~french + * Define the ORCHID4 color. + * + */ +#define MLV_COLOR_ORCHID4 MLV_rgba(139,71,137,255) + +/** \~french + * Define the PLUM1 color. + * + */ +#define MLV_COLOR_PLUM1 MLV_rgba(255,187,255,255) + +/** \~french + * Define the PLUM2 color. + * + */ +#define MLV_COLOR_PLUM2 MLV_rgba(238,174,238,255) + +/** \~french + * Define the PLUM3 color. + * + */ +#define MLV_COLOR_PLUM3 MLV_rgba(205,150,205,255) + +/** \~french + * Define the PLUM4 color. + * + */ +#define MLV_COLOR_PLUM4 MLV_rgba(139,102,139,255) + +/** \~french + * Define the MEDIUMORCHID1 color. + * + */ +#define MLV_COLOR_MEDIUMORCHID1 MLV_rgba(224,102,255,255) + +/** \~french + * Define the MEDIUMORCHID2 color. + * + */ +#define MLV_COLOR_MEDIUMORCHID2 MLV_rgba(209,95,238,255) + +/** \~french + * Define the MEDIUMORCHID3 color. + * + */ +#define MLV_COLOR_MEDIUMORCHID3 MLV_rgba(180,82,205,255) + +/** \~french + * Define the MEDIUMORCHID4 color. + * + */ +#define MLV_COLOR_MEDIUMORCHID4 MLV_rgba(122,55,139,255) + +/** \~french + * Define the DARKORCHID1 color. + * + */ +#define MLV_COLOR_DARKORCHID1 MLV_rgba(191,62,255,255) + +/** \~french + * Define the DARKORCHID2 color. + * + */ +#define MLV_COLOR_DARKORCHID2 MLV_rgba(178,58,238,255) + +/** \~french + * Define the DARKORCHID3 color. + * + */ +#define MLV_COLOR_DARKORCHID3 MLV_rgba(154,50,205,255) + +/** \~french + * Define the DARKORCHID4 color. + * + */ +#define MLV_COLOR_DARKORCHID4 MLV_rgba(104,34,139,255) + +/** \~french + * Define the PURPLE1 color. + * + */ +#define MLV_COLOR_PURPLE1 MLV_rgba(155,48,255,255) + +/** \~french + * Define the PURPLE2 color. + * + */ +#define MLV_COLOR_PURPLE2 MLV_rgba(145,44,238,255) + +/** \~french + * Define the PURPLE3 color. + * + */ +#define MLV_COLOR_PURPLE3 MLV_rgba(125,38,205,255) + +/** \~french + * Define the PURPLE4 color. + * + */ +#define MLV_COLOR_PURPLE4 MLV_rgba(85,26,139,255) + +/** \~french + * Define the MEDIUMPURPLE1 color. + * + */ +#define MLV_COLOR_MEDIUMPURPLE1 MLV_rgba(171,130,255,255) + +/** \~french + * Define the MEDIUMPURPLE2 color. + * + */ +#define MLV_COLOR_MEDIUMPURPLE2 MLV_rgba(159,121,238,255) + +/** \~french + * Define the MEDIUMPURPLE3 color. + * + */ +#define MLV_COLOR_MEDIUMPURPLE3 MLV_rgba(137,104,205,255) + +/** \~french + * Define the MEDIUMPURPLE4 color. + * + */ +#define MLV_COLOR_MEDIUMPURPLE4 MLV_rgba(93,71,139,255) + +/** \~french + * Define the THISTLE1 color. + * + */ +#define MLV_COLOR_THISTLE1 MLV_rgba(255,225,255,255) + +/** \~french + * Define the THISTLE2 color. + * + */ +#define MLV_COLOR_THISTLE2 MLV_rgba(238,210,238,255) + +/** \~french + * Define the THISTLE3 color. + * + */ +#define MLV_COLOR_THISTLE3 MLV_rgba(205,181,205,255) + +/** \~french + * Define the THISTLE4 color. + * + */ +#define MLV_COLOR_THISTLE4 MLV_rgba(139,123,139,255) + +/** \~french + * Define the GRAY0 color. + * + */ +#define MLV_COLOR_GRAY0 MLV_rgba(0,0,0,255) + +/** \~french + * Define the GREY0 color. + * + */ +#define MLV_COLOR_GREY0 MLV_rgba(0,0,0,255) + +/** \~french + * Define the GRAY1 color. + * + */ +#define MLV_COLOR_GRAY1 MLV_rgba(3,3,3,255) + +/** \~french + * Define the GREY1 color. + * + */ +#define MLV_COLOR_GREY1 MLV_rgba(3,3,3,255) + +/** \~french + * Define the GRAY2 color. + * + */ +#define MLV_COLOR_GRAY2 MLV_rgba(5,5,5,255) + +/** \~french + * Define the GREY2 color. + * + */ +#define MLV_COLOR_GREY2 MLV_rgba(5,5,5,255) + +/** \~french + * Define the GRAY3 color. + * + */ +#define MLV_COLOR_GRAY3 MLV_rgba(8,8,8,255) + +/** \~french + * Define the GREY3 color. + * + */ +#define MLV_COLOR_GREY3 MLV_rgba(8,8,8,255) + +/** \~french + * Define the GRAY4 color. + * + */ +#define MLV_COLOR_GRAY4 MLV_rgba(10,10,10,255) + +/** \~french + * Define the GREY4 color. + * + */ +#define MLV_COLOR_GREY4 MLV_rgba(10,10,10,255) + +/** \~french + * Define the GRAY5 color. + * + */ +#define MLV_COLOR_GRAY5 MLV_rgba(13,13,13,255) + +/** \~french + * Define the GREY5 color. + * + */ +#define MLV_COLOR_GREY5 MLV_rgba(13,13,13,255) + +/** \~french + * Define the GRAY6 color. + * + */ +#define MLV_COLOR_GRAY6 MLV_rgba(15,15,15,255) + +/** \~french + * Define the GREY6 color. + * + */ +#define MLV_COLOR_GREY6 MLV_rgba(15,15,15,255) + +/** \~french + * Define the GRAY7 color. + * + */ +#define MLV_COLOR_GRAY7 MLV_rgba(18,18,18,255) + +/** \~french + * Define the GREY7 color. + * + */ +#define MLV_COLOR_GREY7 MLV_rgba(18,18,18,255) + +/** \~french + * Define the GRAY8 color. + * + */ +#define MLV_COLOR_GRAY8 MLV_rgba(20,20,20,255) + +/** \~french + * Define the GREY8 color. + * + */ +#define MLV_COLOR_GREY8 MLV_rgba(20,20,20,255) + +/** \~french + * Define the GRAY9 color. + * + */ +#define MLV_COLOR_GRAY9 MLV_rgba(23,23,23,255) + +/** \~french + * Define the GREY9 color. + * + */ +#define MLV_COLOR_GREY9 MLV_rgba(23,23,23,255) + +/** \~french + * Define the GRAY10 color. + * + */ +#define MLV_COLOR_GRAY10 MLV_rgba(26,26,26,255) + +/** \~french + * Define the GREY10 color. + * + */ +#define MLV_COLOR_GREY10 MLV_rgba(26,26,26,255) + +/** \~french + * Define the GRAY11 color. + * + */ +#define MLV_COLOR_GRAY11 MLV_rgba(28,28,28,255) + +/** \~french + * Define the GREY11 color. + * + */ +#define MLV_COLOR_GREY11 MLV_rgba(28,28,28,255) + +/** \~french + * Define the GRAY12 color. + * + */ +#define MLV_COLOR_GRAY12 MLV_rgba(31,31,31,255) + +/** \~french + * Define the GREY12 color. + * + */ +#define MLV_COLOR_GREY12 MLV_rgba(31,31,31,255) + +/** \~french + * Define the GRAY13 color. + * + */ +#define MLV_COLOR_GRAY13 MLV_rgba(33,33,33,255) + +/** \~french + * Define the GREY13 color. + * + */ +#define MLV_COLOR_GREY13 MLV_rgba(33,33,33,255) + +/** \~french + * Define the GRAY14 color. + * + */ +#define MLV_COLOR_GRAY14 MLV_rgba(36,36,36,255) + +/** \~french + * Define the GREY14 color. + * + */ +#define MLV_COLOR_GREY14 MLV_rgba(36,36,36,255) + +/** \~french + * Define the GRAY15 color. + * + */ +#define MLV_COLOR_GRAY15 MLV_rgba(38,38,38,255) + +/** \~french + * Define the GREY15 color. + * + */ +#define MLV_COLOR_GREY15 MLV_rgba(38,38,38,255) + +/** \~french + * Define the GRAY16 color. + * + */ +#define MLV_COLOR_GRAY16 MLV_rgba(41,41,41,255) + +/** \~french + * Define the GREY16 color. + * + */ +#define MLV_COLOR_GREY16 MLV_rgba(41,41,41,255) + +/** \~french + * Define the GRAY17 color. + * + */ +#define MLV_COLOR_GRAY17 MLV_rgba(43,43,43,255) + +/** \~french + * Define the GREY17 color. + * + */ +#define MLV_COLOR_GREY17 MLV_rgba(43,43,43,255) + +/** \~french + * Define the GRAY18 color. + * + */ +#define MLV_COLOR_GRAY18 MLV_rgba(46,46,46,255) + +/** \~french + * Define the GREY18 color. + * + */ +#define MLV_COLOR_GREY18 MLV_rgba(46,46,46,255) + +/** \~french + * Define the GRAY19 color. + * + */ +#define MLV_COLOR_GRAY19 MLV_rgba(48,48,48,255) + +/** \~french + * Define the GREY19 color. + * + */ +#define MLV_COLOR_GREY19 MLV_rgba(48,48,48,255) + +/** \~french + * Define the GRAY20 color. + * + */ +#define MLV_COLOR_GRAY20 MLV_rgba(51,51,51,255) + +/** \~french + * Define the GREY20 color. + * + */ +#define MLV_COLOR_GREY20 MLV_rgba(51,51,51,255) + +/** \~french + * Define the GRAY21 color. + * + */ +#define MLV_COLOR_GRAY21 MLV_rgba(54,54,54,255) + +/** \~french + * Define the GREY21 color. + * + */ +#define MLV_COLOR_GREY21 MLV_rgba(54,54,54,255) + +/** \~french + * Define the GRAY22 color. + * + */ +#define MLV_COLOR_GRAY22 MLV_rgba(56,56,56,255) + +/** \~french + * Define the GREY22 color. + * + */ +#define MLV_COLOR_GREY22 MLV_rgba(56,56,56,255) + +/** \~french + * Define the GRAY23 color. + * + */ +#define MLV_COLOR_GRAY23 MLV_rgba(59,59,59,255) + +/** \~french + * Define the GREY23 color. + * + */ +#define MLV_COLOR_GREY23 MLV_rgba(59,59,59,255) + +/** \~french + * Define the GRAY24 color. + * + */ +#define MLV_COLOR_GRAY24 MLV_rgba(61,61,61,255) + +/** \~french + * Define the GREY24 color. + * + */ +#define MLV_COLOR_GREY24 MLV_rgba(61,61,61,255) + +/** \~french + * Define the GRAY25 color. + * + */ +#define MLV_COLOR_GRAY25 MLV_rgba(64,64,64,255) + +/** \~french + * Define the GREY25 color. + * + */ +#define MLV_COLOR_GREY25 MLV_rgba(64,64,64,255) + +/** \~french + * Define the GRAY26 color. + * + */ +#define MLV_COLOR_GRAY26 MLV_rgba(66,66,66,255) + +/** \~french + * Define the GREY26 color. + * + */ +#define MLV_COLOR_GREY26 MLV_rgba(66,66,66,255) + +/** \~french + * Define the GRAY27 color. + * + */ +#define MLV_COLOR_GRAY27 MLV_rgba(69,69,69,255) + +/** \~french + * Define the GREY27 color. + * + */ +#define MLV_COLOR_GREY27 MLV_rgba(69,69,69,255) + +/** \~french + * Define the GRAY28 color. + * + */ +#define MLV_COLOR_GRAY28 MLV_rgba(71,71,71,255) + +/** \~french + * Define the GREY28 color. + * + */ +#define MLV_COLOR_GREY28 MLV_rgba(71,71,71,255) + +/** \~french + * Define the GRAY29 color. + * + */ +#define MLV_COLOR_GRAY29 MLV_rgba(74,74,74,255) + +/** \~french + * Define the GREY29 color. + * + */ +#define MLV_COLOR_GREY29 MLV_rgba(74,74,74,255) + +/** \~french + * Define the GRAY30 color. + * + */ +#define MLV_COLOR_GRAY30 MLV_rgba(77,77,77,255) + +/** \~french + * Define the GREY30 color. + * + */ +#define MLV_COLOR_GREY30 MLV_rgba(77,77,77,255) + +/** \~french + * Define the GRAY31 color. + * + */ +#define MLV_COLOR_GRAY31 MLV_rgba(79,79,79,255) + +/** \~french + * Define the GREY31 color. + * + */ +#define MLV_COLOR_GREY31 MLV_rgba(79,79,79,255) + +/** \~french + * Define the GRAY32 color. + * + */ +#define MLV_COLOR_GRAY32 MLV_rgba(82,82,82,255) + +/** \~french + * Define the GREY32 color. + * + */ +#define MLV_COLOR_GREY32 MLV_rgba(82,82,82,255) + +/** \~french + * Define the GRAY33 color. + * + */ +#define MLV_COLOR_GRAY33 MLV_rgba(84,84,84,255) + +/** \~french + * Define the GREY33 color. + * + */ +#define MLV_COLOR_GREY33 MLV_rgba(84,84,84,255) + +/** \~french + * Define the GRAY34 color. + * + */ +#define MLV_COLOR_GRAY34 MLV_rgba(87,87,87,255) + +/** \~french + * Define the GREY34 color. + * + */ +#define MLV_COLOR_GREY34 MLV_rgba(87,87,87,255) + +/** \~french + * Define the GRAY35 color. + * + */ +#define MLV_COLOR_GRAY35 MLV_rgba(89,89,89,255) + +/** \~french + * Define the GREY35 color. + * + */ +#define MLV_COLOR_GREY35 MLV_rgba(89,89,89,255) + +/** \~french + * Define the GRAY36 color. + * + */ +#define MLV_COLOR_GRAY36 MLV_rgba(92,92,92,255) + +/** \~french + * Define the GREY36 color. + * + */ +#define MLV_COLOR_GREY36 MLV_rgba(92,92,92,255) + +/** \~french + * Define the GRAY37 color. + * + */ +#define MLV_COLOR_GRAY37 MLV_rgba(94,94,94,255) + +/** \~french + * Define the GREY37 color. + * + */ +#define MLV_COLOR_GREY37 MLV_rgba(94,94,94,255) + +/** \~french + * Define the GRAY38 color. + * + */ +#define MLV_COLOR_GRAY38 MLV_rgba(97,97,97,255) + +/** \~french + * Define the GREY38 color. + * + */ +#define MLV_COLOR_GREY38 MLV_rgba(97,97,97,255) + +/** \~french + * Define the GRAY39 color. + * + */ +#define MLV_COLOR_GRAY39 MLV_rgba(99,99,99,255) + +/** \~french + * Define the GREY39 color. + * + */ +#define MLV_COLOR_GREY39 MLV_rgba(99,99,99,255) + +/** \~french + * Define the GRAY40 color. + * + */ +#define MLV_COLOR_GRAY40 MLV_rgba(102,102,102,255) + +/** \~french + * Define the GREY40 color. + * + */ +#define MLV_COLOR_GREY40 MLV_rgba(102,102,102,255) + +/** \~french + * Define the GRAY41 color. + * + */ +#define MLV_COLOR_GRAY41 MLV_rgba(105,105,105,255) + +/** \~french + * Define the GREY41 color. + * + */ +#define MLV_COLOR_GREY41 MLV_rgba(105,105,105,255) + +/** \~french + * Define the GRAY42 color. + * + */ +#define MLV_COLOR_GRAY42 MLV_rgba(107,107,107,255) + +/** \~french + * Define the GREY42 color. + * + */ +#define MLV_COLOR_GREY42 MLV_rgba(107,107,107,255) + +/** \~french + * Define the GRAY43 color. + * + */ +#define MLV_COLOR_GRAY43 MLV_rgba(110,110,110,255) + +/** \~french + * Define the GREY43 color. + * + */ +#define MLV_COLOR_GREY43 MLV_rgba(110,110,110,255) + +/** \~french + * Define the GRAY44 color. + * + */ +#define MLV_COLOR_GRAY44 MLV_rgba(112,112,112,255) + +/** \~french + * Define the GREY44 color. + * + */ +#define MLV_COLOR_GREY44 MLV_rgba(112,112,112,255) + +/** \~french + * Define the GRAY45 color. + * + */ +#define MLV_COLOR_GRAY45 MLV_rgba(115,115,115,255) + +/** \~french + * Define the GREY45 color. + * + */ +#define MLV_COLOR_GREY45 MLV_rgba(115,115,115,255) + +/** \~french + * Define the GRAY46 color. + * + */ +#define MLV_COLOR_GRAY46 MLV_rgba(117,117,117,255) + +/** \~french + * Define the GREY46 color. + * + */ +#define MLV_COLOR_GREY46 MLV_rgba(117,117,117,255) + +/** \~french + * Define the GRAY47 color. + * + */ +#define MLV_COLOR_GRAY47 MLV_rgba(120,120,120,255) + +/** \~french + * Define the GREY47 color. + * + */ +#define MLV_COLOR_GREY47 MLV_rgba(120,120,120,255) + +/** \~french + * Define the GRAY48 color. + * + */ +#define MLV_COLOR_GRAY48 MLV_rgba(122,122,122,255) + +/** \~french + * Define the GREY48 color. + * + */ +#define MLV_COLOR_GREY48 MLV_rgba(122,122,122,255) + +/** \~french + * Define the GRAY49 color. + * + */ +#define MLV_COLOR_GRAY49 MLV_rgba(125,125,125,255) + +/** \~french + * Define the GREY49 color. + * + */ +#define MLV_COLOR_GREY49 MLV_rgba(125,125,125,255) + +/** \~french + * Define the GRAY50 color. + * + */ +#define MLV_COLOR_GRAY50 MLV_rgba(127,127,127,255) + +/** \~french + * Define the GREY50 color. + * + */ +#define MLV_COLOR_GREY50 MLV_rgba(127,127,127,255) + +/** \~french + * Define the GRAY51 color. + * + */ +#define MLV_COLOR_GRAY51 MLV_rgba(130,130,130,255) + +/** \~french + * Define the GREY51 color. + * + */ +#define MLV_COLOR_GREY51 MLV_rgba(130,130,130,255) + +/** \~french + * Define the GRAY52 color. + * + */ +#define MLV_COLOR_GRAY52 MLV_rgba(133,133,133,255) + +/** \~french + * Define the GREY52 color. + * + */ +#define MLV_COLOR_GREY52 MLV_rgba(133,133,133,255) + +/** \~french + * Define the GRAY53 color. + * + */ +#define MLV_COLOR_GRAY53 MLV_rgba(135,135,135,255) + +/** \~french + * Define the GREY53 color. + * + */ +#define MLV_COLOR_GREY53 MLV_rgba(135,135,135,255) + +/** \~french + * Define the GRAY54 color. + * + */ +#define MLV_COLOR_GRAY54 MLV_rgba(138,138,138,255) + +/** \~french + * Define the GREY54 color. + * + */ +#define MLV_COLOR_GREY54 MLV_rgba(138,138,138,255) + +/** \~french + * Define the GRAY55 color. + * + */ +#define MLV_COLOR_GRAY55 MLV_rgba(140,140,140,255) + +/** \~french + * Define the GREY55 color. + * + */ +#define MLV_COLOR_GREY55 MLV_rgba(140,140,140,255) + +/** \~french + * Define the GRAY56 color. + * + */ +#define MLV_COLOR_GRAY56 MLV_rgba(143,143,143,255) + +/** \~french + * Define the GREY56 color. + * + */ +#define MLV_COLOR_GREY56 MLV_rgba(143,143,143,255) + +/** \~french + * Define the GRAY57 color. + * + */ +#define MLV_COLOR_GRAY57 MLV_rgba(145,145,145,255) + +/** \~french + * Define the GREY57 color. + * + */ +#define MLV_COLOR_GREY57 MLV_rgba(145,145,145,255) + +/** \~french + * Define the GRAY58 color. + * + */ +#define MLV_COLOR_GRAY58 MLV_rgba(148,148,148,255) + +/** \~french + * Define the GREY58 color. + * + */ +#define MLV_COLOR_GREY58 MLV_rgba(148,148,148,255) + +/** \~french + * Define the GRAY59 color. + * + */ +#define MLV_COLOR_GRAY59 MLV_rgba(150,150,150,255) + +/** \~french + * Define the GREY59 color. + * + */ +#define MLV_COLOR_GREY59 MLV_rgba(150,150,150,255) + +/** \~french + * Define the GRAY60 color. + * + */ +#define MLV_COLOR_GRAY60 MLV_rgba(153,153,153,255) + +/** \~french + * Define the GREY60 color. + * + */ +#define MLV_COLOR_GREY60 MLV_rgba(153,153,153,255) + +/** \~french + * Define the GRAY61 color. + * + */ +#define MLV_COLOR_GRAY61 MLV_rgba(156,156,156,255) + +/** \~french + * Define the GREY61 color. + * + */ +#define MLV_COLOR_GREY61 MLV_rgba(156,156,156,255) + +/** \~french + * Define the GRAY62 color. + * + */ +#define MLV_COLOR_GRAY62 MLV_rgba(158,158,158,255) + +/** \~french + * Define the GREY62 color. + * + */ +#define MLV_COLOR_GREY62 MLV_rgba(158,158,158,255) + +/** \~french + * Define the GRAY63 color. + * + */ +#define MLV_COLOR_GRAY63 MLV_rgba(161,161,161,255) + +/** \~french + * Define the GREY63 color. + * + */ +#define MLV_COLOR_GREY63 MLV_rgba(161,161,161,255) + +/** \~french + * Define the GRAY64 color. + * + */ +#define MLV_COLOR_GRAY64 MLV_rgba(163,163,163,255) + +/** \~french + * Define the GREY64 color. + * + */ +#define MLV_COLOR_GREY64 MLV_rgba(163,163,163,255) + +/** \~french + * Define the GRAY65 color. + * + */ +#define MLV_COLOR_GRAY65 MLV_rgba(166,166,166,255) + +/** \~french + * Define the GREY65 color. + * + */ +#define MLV_COLOR_GREY65 MLV_rgba(166,166,166,255) + +/** \~french + * Define the GRAY66 color. + * + */ +#define MLV_COLOR_GRAY66 MLV_rgba(168,168,168,255) + +/** \~french + * Define the GREY66 color. + * + */ +#define MLV_COLOR_GREY66 MLV_rgba(168,168,168,255) + +/** \~french + * Define the GRAY67 color. + * + */ +#define MLV_COLOR_GRAY67 MLV_rgba(171,171,171,255) + +/** \~french + * Define the GREY67 color. + * + */ +#define MLV_COLOR_GREY67 MLV_rgba(171,171,171,255) + +/** \~french + * Define the GRAY68 color. + * + */ +#define MLV_COLOR_GRAY68 MLV_rgba(173,173,173,255) + +/** \~french + * Define the GREY68 color. + * + */ +#define MLV_COLOR_GREY68 MLV_rgba(173,173,173,255) + +/** \~french + * Define the GRAY69 color. + * + */ +#define MLV_COLOR_GRAY69 MLV_rgba(176,176,176,255) + +/** \~french + * Define the GREY69 color. + * + */ +#define MLV_COLOR_GREY69 MLV_rgba(176,176,176,255) + +/** \~french + * Define the GRAY70 color. + * + */ +#define MLV_COLOR_GRAY70 MLV_rgba(179,179,179,255) + +/** \~french + * Define the GREY70 color. + * + */ +#define MLV_COLOR_GREY70 MLV_rgba(179,179,179,255) + +/** \~french + * Define the GRAY71 color. + * + */ +#define MLV_COLOR_GRAY71 MLV_rgba(181,181,181,255) + +/** \~french + * Define the GREY71 color. + * + */ +#define MLV_COLOR_GREY71 MLV_rgba(181,181,181,255) + +/** \~french + * Define the GRAY72 color. + * + */ +#define MLV_COLOR_GRAY72 MLV_rgba(184,184,184,255) + +/** \~french + * Define the GREY72 color. + * + */ +#define MLV_COLOR_GREY72 MLV_rgba(184,184,184,255) + +/** \~french + * Define the GRAY73 color. + * + */ +#define MLV_COLOR_GRAY73 MLV_rgba(186,186,186,255) + +/** \~french + * Define the GREY73 color. + * + */ +#define MLV_COLOR_GREY73 MLV_rgba(186,186,186,255) + +/** \~french + * Define the GRAY74 color. + * + */ +#define MLV_COLOR_GRAY74 MLV_rgba(189,189,189,255) + +/** \~french + * Define the GREY74 color. + * + */ +#define MLV_COLOR_GREY74 MLV_rgba(189,189,189,255) + +/** \~french + * Define the GRAY75 color. + * + */ +#define MLV_COLOR_GRAY75 MLV_rgba(191,191,191,255) + +/** \~french + * Define the GREY75 color. + * + */ +#define MLV_COLOR_GREY75 MLV_rgba(191,191,191,255) + +/** \~french + * Define the GRAY76 color. + * + */ +#define MLV_COLOR_GRAY76 MLV_rgba(194,194,194,255) + +/** \~french + * Define the GREY76 color. + * + */ +#define MLV_COLOR_GREY76 MLV_rgba(194,194,194,255) + +/** \~french + * Define the GRAY77 color. + * + */ +#define MLV_COLOR_GRAY77 MLV_rgba(196,196,196,255) + +/** \~french + * Define the GREY77 color. + * + */ +#define MLV_COLOR_GREY77 MLV_rgba(196,196,196,255) + +/** \~french + * Define the GRAY78 color. + * + */ +#define MLV_COLOR_GRAY78 MLV_rgba(199,199,199,255) + +/** \~french + * Define the GREY78 color. + * + */ +#define MLV_COLOR_GREY78 MLV_rgba(199,199,199,255) + +/** \~french + * Define the GRAY79 color. + * + */ +#define MLV_COLOR_GRAY79 MLV_rgba(201,201,201,255) + +/** \~french + * Define the GREY79 color. + * + */ +#define MLV_COLOR_GREY79 MLV_rgba(201,201,201,255) + +/** \~french + * Define the GRAY80 color. + * + */ +#define MLV_COLOR_GRAY80 MLV_rgba(204,204,204,255) + +/** \~french + * Define the GREY80 color. + * + */ +#define MLV_COLOR_GREY80 MLV_rgba(204,204,204,255) + +/** \~french + * Define the GRAY81 color. + * + */ +#define MLV_COLOR_GRAY81 MLV_rgba(207,207,207,255) + +/** \~french + * Define the GREY81 color. + * + */ +#define MLV_COLOR_GREY81 MLV_rgba(207,207,207,255) + +/** \~french + * Define the GRAY82 color. + * + */ +#define MLV_COLOR_GRAY82 MLV_rgba(209,209,209,255) + +/** \~french + * Define the GREY82 color. + * + */ +#define MLV_COLOR_GREY82 MLV_rgba(209,209,209,255) + +/** \~french + * Define the GRAY83 color. + * + */ +#define MLV_COLOR_GRAY83 MLV_rgba(212,212,212,255) + +/** \~french + * Define the GREY83 color. + * + */ +#define MLV_COLOR_GREY83 MLV_rgba(212,212,212,255) + +/** \~french + * Define the GRAY84 color. + * + */ +#define MLV_COLOR_GRAY84 MLV_rgba(214,214,214,255) + +/** \~french + * Define the GREY84 color. + * + */ +#define MLV_COLOR_GREY84 MLV_rgba(214,214,214,255) + +/** \~french + * Define the GRAY85 color. + * + */ +#define MLV_COLOR_GRAY85 MLV_rgba(217,217,217,255) + +/** \~french + * Define the GREY85 color. + * + */ +#define MLV_COLOR_GREY85 MLV_rgba(217,217,217,255) + +/** \~french + * Define the GRAY86 color. + * + */ +#define MLV_COLOR_GRAY86 MLV_rgba(219,219,219,255) + +/** \~french + * Define the GREY86 color. + * + */ +#define MLV_COLOR_GREY86 MLV_rgba(219,219,219,255) + +/** \~french + * Define the GRAY87 color. + * + */ +#define MLV_COLOR_GRAY87 MLV_rgba(222,222,222,255) + +/** \~french + * Define the GREY87 color. + * + */ +#define MLV_COLOR_GREY87 MLV_rgba(222,222,222,255) + +/** \~french + * Define the GRAY88 color. + * + */ +#define MLV_COLOR_GRAY88 MLV_rgba(224,224,224,255) + +/** \~french + * Define the GREY88 color. + * + */ +#define MLV_COLOR_GREY88 MLV_rgba(224,224,224,255) + +/** \~french + * Define the GRAY89 color. + * + */ +#define MLV_COLOR_GRAY89 MLV_rgba(227,227,227,255) + +/** \~french + * Define the GREY89 color. + * + */ +#define MLV_COLOR_GREY89 MLV_rgba(227,227,227,255) + +/** \~french + * Define the GRAY90 color. + * + */ +#define MLV_COLOR_GRAY90 MLV_rgba(229,229,229,255) + +/** \~french + * Define the GREY90 color. + * + */ +#define MLV_COLOR_GREY90 MLV_rgba(229,229,229,255) + +/** \~french + * Define the GRAY91 color. + * + */ +#define MLV_COLOR_GRAY91 MLV_rgba(232,232,232,255) + +/** \~french + * Define the GREY91 color. + * + */ +#define MLV_COLOR_GREY91 MLV_rgba(232,232,232,255) + +/** \~french + * Define the GRAY92 color. + * + */ +#define MLV_COLOR_GRAY92 MLV_rgba(235,235,235,255) + +/** \~french + * Define the GREY92 color. + * + */ +#define MLV_COLOR_GREY92 MLV_rgba(235,235,235,255) + +/** \~french + * Define the GRAY93 color. + * + */ +#define MLV_COLOR_GRAY93 MLV_rgba(237,237,237,255) + +/** \~french + * Define the GREY93 color. + * + */ +#define MLV_COLOR_GREY93 MLV_rgba(237,237,237,255) + +/** \~french + * Define the GRAY94 color. + * + */ +#define MLV_COLOR_GRAY94 MLV_rgba(240,240,240,255) + +/** \~french + * Define the GREY94 color. + * + */ +#define MLV_COLOR_GREY94 MLV_rgba(240,240,240,255) + +/** \~french + * Define the GRAY95 color. + * + */ +#define MLV_COLOR_GRAY95 MLV_rgba(242,242,242,255) + +/** \~french + * Define the GREY95 color. + * + */ +#define MLV_COLOR_GREY95 MLV_rgba(242,242,242,255) + +/** \~french + * Define the GRAY96 color. + * + */ +#define MLV_COLOR_GRAY96 MLV_rgba(245,245,245,255) + +/** \~french + * Define the GREY96 color. + * + */ +#define MLV_COLOR_GREY96 MLV_rgba(245,245,245,255) + +/** \~french + * Define the GRAY97 color. + * + */ +#define MLV_COLOR_GRAY97 MLV_rgba(247,247,247,255) + +/** \~french + * Define the GREY97 color. + * + */ +#define MLV_COLOR_GREY97 MLV_rgba(247,247,247,255) + +/** \~french + * Define the GRAY98 color. + * + */ +#define MLV_COLOR_GRAY98 MLV_rgba(250,250,250,255) + +/** \~french + * Define the GREY98 color. + * + */ +#define MLV_COLOR_GREY98 MLV_rgba(250,250,250,255) + +/** \~french + * Define the GRAY99 color. + * + */ +#define MLV_COLOR_GRAY99 MLV_rgba(252,252,252,255) + +/** \~french + * Define the GREY99 color. + * + */ +#define MLV_COLOR_GREY99 MLV_rgba(252,252,252,255) + +/** \~french + * Define the GRAY100 color. + * + */ +#define MLV_COLOR_GRAY100 MLV_rgba(255,255,255,255) + +/** \~french + * Define the GREY100 color. + * + */ +#define MLV_COLOR_GREY100 MLV_rgba(255,255,255,255) + +/** \~french + * Define the DARK_GREY color. + * + */ +#define MLV_COLOR_DARK_GREY MLV_rgba(169,169,169,255) + +/** \~french + * Define the DARKGREY color. + * + */ +#define MLV_COLOR_DARKGREY MLV_rgba(169,169,169,255) + +/** \~french + * Define the DARK_GRAY color. + * + */ +#define MLV_COLOR_DARK_GRAY MLV_rgba(169,169,169,255) + +/** \~french + * Define the DARKGRAY color. + * + */ +#define MLV_COLOR_DARKGRAY MLV_rgba(169,169,169,255) + +/** \~french + * Define the DARK_BLUE color. + * + */ +#define MLV_COLOR_DARK_BLUE MLV_rgba(0,0,139,255) + +/** \~french + * Define the DARKBLUE color. + * + */ +#define MLV_COLOR_DARKBLUE MLV_rgba(0,0,139,255) + +/** \~french + * Define the DARK_CYAN color. + * + */ +#define MLV_COLOR_DARK_CYAN MLV_rgba(0,139,139,255) + +/** \~french + * Define the DARKCYAN color. + * + */ +#define MLV_COLOR_DARKCYAN MLV_rgba(0,139,139,255) + +/** \~french + * Define the DARK_MAGENTA color. + * + */ +#define MLV_COLOR_DARK_MAGENTA MLV_rgba(139,0,139,255) + +/** \~french + * Define the DARKMAGENTA color. + * + */ +#define MLV_COLOR_DARKMAGENTA MLV_rgba(139,0,139,255) + +/** \~french + * Define the DARK_RED color. + * + */ +#define MLV_COLOR_DARK_RED MLV_rgba(139,0,0,255) + +/** \~french + * Define the DARKRED color. + * + */ +#define MLV_COLOR_DARKRED MLV_rgba(139,0,0,255) + +/** \~french + * Define the LIGHT_GREEN color. + * + */ +#define MLV_COLOR_LIGHT_GREEN MLV_rgba(144,238,144,255) + +/** \~french + * Define the LIGHTGREEN color. + * + */ +#define MLV_COLOR_LIGHTGREEN MLV_rgba(144,238,144,255) + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MLV/MLV_device_with_buttons.h b/MLV/MLV_device_with_buttons.h new file mode 100644 index 0000000..afaa46b --- /dev/null +++ b/MLV/MLV_device_with_buttons.h @@ -0,0 +1,53 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_device_with_buttons.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit des énumérations et des prototypes de fonctions pour + * manipuler des boutons de différents matériels (bouttons de souris, + * boutons de claviers, etc ...) + * + */ + +#ifndef __MLV__MLV_DEVICE_WITH_BUTTONS_H__ +#define __MLV__MLV_DEVICE_WITH_BUTTONS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Énumère les différents états possibles d'un bouton. + */ +typedef enum { + MLV_PRESSED, /**< \~french Le bouton est en position appuyée */ + MLV_RELEASED /**< \~french Le bouton est en position relachée */ +} MLV_Button_state; + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MLV/MLV_event.h b/MLV/MLV_event.h new file mode 100644 index 0000000..ba267de --- /dev/null +++ b/MLV/MLV_event.h @@ -0,0 +1,361 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_event.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit les prototypes des fonctions permettant d'utiliser + * les évènements dans la bibliothèque MLV. + */ + +#ifndef __MLV__MLV_EVENT_H__ +#define __MLV__MLV_EVENT_H__ + +#include "MLV_device_with_buttons.h" +#include "MLV_keyboard.h" +#include "MLV_mouse.h" +#include "MLV_input_box.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Énumère les différents types d'évènement de la bibliothèque MLV. + */ +typedef enum { + MLV_NONE = 0, /**< \~french Aucun évènement */ + MLV_KEY = 1, /**< \~french Evnènement provenant du clavier */ + MLV_INPUT_BOX = 2, /**< \~french Évènement provenant de la validation d'un texte dans + * une boîte de saisie. */ + MLV_MOUSE_BUTTON = 3, /**< \~french Évènement provenant d'un clique de souris. */ + MLV_MOUSE_MOTION = 4 /**< \~french Évènement provenant du déplacement de la souris.*/ +} MLV_Event; + + + /** \~french + * \brief Cette fonction récupère un évènement dans la file d'attente, remplit + * en fonction de l'évènement récupéré une partie des paramètres de la + * fonction et renvoie un entier codant le type de l'évènement qui a été + * récupéré. + * + * Le type des évènements est défini par : + * + * MLV_Event + * + * et peut valoir les valeurs suivantes: + * + * Valeur ........... Signification + * + * ---------------------------------- + * + * MLV_NONE .......... Aucun évènement récupéré + * + * MLV_KEY ........... Une touche du clavier a été appuyée ou + * relachée. + * + * MLV_INPUT_BOX ..... L'utilisateur a écrit une chaîne de + * caractères et validé cette chaîne par + * la touche entrée. + * + * MLV_MOUSE_BUTTON .. Un des boutons de la souris a été + * appuyé. + * + * MLV_MOUS_MOTION ... La souris a été déplacée. + * + * + * + * Voici un tableau qui donne les champs modifiés en fonction + * de l'évènement qui a été récupéré. + * + * Type Évènement .... Paramètres modifiés + * + * --------------------------------------- + * + * MLV_NONE .......... AUCUN + * + * MLV_KEY ........... key_sym, key_mod, state + * + * MLV_INPUT_BOX ..... texte, input_box + * + * MLV_MOUSE_BUTTON .. mouse_x, mouse_y, mouse_button, state + * + * MLV_MOUSE_MOTION .. mouse_x, mouse_y + * + * + * L'utilisateur n'est pas obligé d'utiliser un champs s'il + * n'en a pas l'utilité. Dans ce cas, il peut mettre la valeur + * NULL. Le champs est alors ignoré. + * + * \bug Il est possible que la récuperation du caractère unicode sous Windows + * ne fonctionne pas bien. En effet, aucun code de portage spécifique n'a été + * fait à ce sujet. + * + * \bug Sous WINDOWS, le clavier est configuré en "qwerty". + * + * \return La fonction renvoie un entier codant le type de l'évènement qui a + * été récupéré. + * + * \param key_sym Code de la touche qui a été appuyée ou relachée. La valeur de + * ce champs est définie par l'énumération : MLV_Keyboard_button. + * \param key_mod Mode dans lequel se trouve le clavier lorsqu'une touche est + * appuyée ou relachée. La valeur de ce champs est définie par + * l'énumération : MLV_Keyboard_modifier. + * \param unicode Caractère codé en unicode de la lettre obtenue en combinant + * le code et le mode précédent + * \param texte Texte récupéré par la boîte de saisie. L'allocation est + * affectée par la fonction elle-même. La désallocation est à + * la charge de l'utilisateur. + * \param input_box La boîte de saisie qui a récupérée le texte + * \param mouse_x Coordonnée en X de la position de la souris + * \param mouse_y Coordonnée en Y de la position de la souris + * \param mouse_button Bouton de la souris qui a été appuyé ou relaché. + * Ce champs est défini par l'énumération MLV_Mouse_button. + * \param state Etat de la touche concernée par l'évènement. La valeur de ce + * champs est défini par l'énumération: MLV_Button_state. + */ +MLV_Event MLV_get_event( + MLV_Keyboard_button* key_sym, MLV_Keyboard_modifier* key_mod, int* unicode, + char** texte, MLV_Input_box** input_box, + int* mouse_x, int* mouse_y, MLV_Mouse_button* mouse_button, + MLV_Button_state* state +); + + + + /** \~french + * \brief Cette fonction suspends l'éxecution du programme jusqu'à ce qu'un + * évènement apparaît dans la file d'attente. Lorsqu'un nouvel + * évènement apparaît, la fonction + * - remplit ses paramètres et renvoie un entier codant le type de + * l'évènement qui a été récupéré, si les paramètres passés en + * argument concernent l'évènement récupéré. + * - se rendort en l'attente d'un nouvel évènement, dans le cas + * contraire. + * + * Pour plus d'informations sur les différents types d'évènements et leurs + * liens avec les paramètres de la fonction, veuillez consulter la + * documentation de la fonction MLV_get_event(). + * + * L'utilisateur n'est pas obligé d'utiliser un champs s'il + * n'en a pas l'utilité. Dans ce cas, il peut mettre la valeur + * NULL et le paramètre est ignoré. + * + * \bug Voir les bugs de la fonction MLV_get_event(). + * + * \param key_sym Code de la touche qui a été appuyée ou relachée. La valeur de + * ce champs est définie par l'énumération : MLV_Keyboard_button. + * \param key_mod Mode dans lequel se trouve le clavier lorsqu'une touche est + * appuyée ou relachée. La valeur de ce champs est définie par + * l'énumération : MLV_Keyboard_modifier. + * \param unicode Caractère codé en unicode de la lettre obtenue en combinant + * le code et le mode précédent + * \param texte Texte récupéré par la boîte de saisie. L'allocation est affecté par la + * la fonction elle même. La désallocation est à la charge de + * l'utilisateur. + * \param input_box La boîte de saisie qui a récupérée le texte + * \param mouse_x Coordonnée en X de la position de la souris + * \param mouse_y Coordonnée en Y de la position de la souris + * \param mouse_button Bouton de la souris qui a été appuyé ou relaché. + * Ce champs est défini par l'énumération MLV_Mouse_button. + * \param state Etat de la touche concernée par l'évènement. La valeur de ce + * champs est défini par l'énumération: MLV_Button_state. + * + * \return La fonction renvoie un entier codant le type de l'évènement qui + * a été récupéré. + */ +MLV_Event MLV_wait_event( + MLV_Keyboard_button* key_sym, MLV_Keyboard_modifier* key_mod, int* unicode, + char** texte, MLV_Input_box** input_box, + int* mouse_x, int* mouse_y, MLV_Mouse_button* mouse_button, + MLV_Button_state* state +); + + + /** \~french + * \brief Cette fonction suspends l'éxecution du programme jusqu'à ce qu'un + * évènement apparaît dans la file d'attente ou jusqu'à ce qu'un certain + * nombre de secondes se soient écoulées. + * Si le temps s'est complètement écoulé, la fonction renvoie MLV_NONE. + * Si un nouvel évènement apparaît et que les paramètres passés en arguments + * sont en rapport avec l'évènement récupéré, alors la fonction + * remplit les paramètres et renvoie un entier codant le type de + * l'évènement qui a été récupéré. + * Si un nouvel évènement apparaît et qu'il n'est pas en rapport + * avec les paramètres de la fonction, alors il se rendort dans + * l'attente d'un nouvel évènement ou de la fin du temps. + * + * Pour plus d'informations sur les différents types d'évènements et leurs + * liens avec les paramètres de la fonction, veuillez consulter la + * documentation de la fonction MLV_get_event(). + * + * L'utilisateur n'est pas obligé d'utiliser un champs s'il + * n'en a pas l'utilité. Dans ce cas, il peut mettre la valeur + * NULL. Le champs est alors ignoré. + * + * \bug Voir les bugs de la fonction MLV_get_event(). + * + * \param key_sym Code de la touche qui a été appuyée ou relachée. La valeur de + * ce champs est définie par l'énumération : MLV_Keyboard_button. + * \param key_mod Mode dans lequel se trouve le clavier lorsqu'une touche est + * appuyée ou relachée. La valeur de ce champs est définie par + * l'énumération : MLV_Keyboard_modifier. + * \param unicode Caractère codé en unicode de la lettre obtenue en combinant + * le code et le mode précédent + * \param texte Texte récupéré par la boîte de saisie. L'allocation est affecté par la + * la fonction elle même. La désallocation est à la charge de + * l'utilisateur. + * \param input_box La boîte de saisie qui a récupérée le texte + * \param mouse_x Coordonnée en X de la position de la souris + * \param mouse_y Coordonnée en Y de la position de la souris + * \param mouse_button Bouton de la souris qui a été appuyé ou relaché. + * Ce champs est défini par l'énumération MLV_Mouse_button. + * \param state Etat de la touche concernée par l'évènement. La valeur de ce + * champs est défini par l'énumération: MLV_Button_state. + * \param seconds Nombre de secondes à attendre avant de terminer l'execution de + * la fonction en renvoyant MLV_NONE. + * \return La fonction renvoie un entier codant le type de l'évènement qui + * a été récupéré ou MLV_NONE si le temps s'est écoulé. + */ +MLV_Event MLV_wait_event_or_seconds( + MLV_Keyboard_button* key_sym, MLV_Keyboard_modifier* key_mod, int* unicode, + char** texte, MLV_Input_box** input_box, + int* mouse_x, int* mouse_y, MLV_Mouse_button* mouse_button, + MLV_Button_state* state, int seconds +); + + + +/** \~french + * \brief Cette fonction vide la file d'évènements. + * + */ +void MLV_flush_event_queue(); + +/** \~french + * \brief Suspend l'exécution jusqu'à ce que l'utilisateur appuie sur une touche + * du clavier ou sur le bouton gauche de la souris. + * + * Cette fonction renvoie un entier codant le type de l'évènement qui a été + * récupéré ( clavier ou souris ) + * + * Lorsque l'utilisateur appuie sur une touche, la fonction retourne trois + * valeurs ( sym, mod et unicode ) correspondant respectivement au code de la + * touche, au mode dans lequel se trouve le clavier (majuscule etc ...) et au + * caractère unicode correspondnant obtenu en combinant le mode du clavier et le + * code de la touche appuyée. + * + * Lorsque l'utilisateur appuie sur le bouton gauche de la souris, la fonction + * remplit les parametres correspondant aux coordonnées en X et Y de la position + * de la souris sur l'écran. + * + * \bug Voir les bugs de la fonction MLV_get_event(). + * + * \param sym Code de la touche qui a été appuyée ou relachée. La valeur de ce + * champs est définie par l'énumération : MLV_Keyboard_button. + * \param mod Mode dans lequel se trouve le clavier lorsqu'une touche est + * appuyée ou relachée. La valeur de ce champs est définie par + * l'énumération : MLV_Keyboard_modifier. + * \param unicode Caractère codé en unicode de la lettre obtenue en combinant + * le code et le mode précédent + * \param mouse_x Coordonnée en X de la position de la souris + * \param mouse_y Coordonnée en Y de la position de la souris + * \return un entier codant le type de l'évènement qui a été récupéré ( MLV_KEY + * ou MLV_MOUSE_BUTTON ) + */ +MLV_Event MLV_wait_keyboard_or_mouse( + MLV_Keyboard_button* sym, MLV_Keyboard_modifier* mod, int* unicode, + int* mouse_x, int* mouse_y +); + + +/** \~french + * \brief Suspend l'exécution jusqu'à ce que l'utilisateur appuie sur une touche + * du clavier, sur le bouton gauche de la souris ou qu'un certain nombre + * de secondes passées en paramètres se soient écoulées. + * + * Cette fonction renvoie un entier codant le type de l'évènement qui a été + * récupéré ( clavier, souris ou aucun des deux ). + * + * Voir les fonctions MLV_wait_keyboard_seconds() et MLV_wait_mouse_seconds() + * pour plus d'informations. + * + * \bug Voir les bugs de la fonction MLV_get_event(). + * + * \param sym Code de la touche qui a été appuyée ou relachée. La valeur de ce + * champs est définie par l'énumération : MLV_Keyboard_button. + * \param mod Mode dans lequel se trouve le clavier lorsqu'une touche est + * appuyée ou relachée. La valeur de ce champs est définie par + * l'énumération : MLV_Keyboard_modifier. + * \param unicode Caractère codé en unicode de la lettre obtenue en combinant le + * code et le mode précédent + * \param mouse_x Coordonnée en X de la position de la souris + * \param mouse_y Coordonnée en Y de la position de la souris + * \param seconds Le nombre de seconde à attendre avant d'arrêter la fonction + * \return un entier codant le type de l'évènement qui a été récupéré ( MLV_KEY + * ou MLV_MOUSE_BUTTON ), ou MLV_NONE si le temps s'est écoulé. + */ +MLV_Event MLV_wait_keyboard_or_mouse_or_seconds( + MLV_Keyboard_button* sym, MLV_Keyboard_modifier* mod, int* unicode, + int* mouse_x, int* mouse_y, + int seconds +); + +/** \~french + * \brief Convertit le code d'un évènement en une chaîne de caractères. + * + * \param event_code le code de l'évènement + * \return La chaîne de caractères associée au code de l'évènement. + */ +const char* MLV_convert_event_to_string( MLV_Event event_code ); + +/** \~french + * \brief Convertit le nom d'un évènement en son code associé. + * + * \param event_string le nom de l'évènement. + * \return Le code de l'évènement associé à la chaîne de caractères. + */ +MLV_Event MLV_convert_string_to_event( const char* event_string ); + +/** \~french + * \brief Convertit le code d'un état en une chaîne de caractères. + * + * \param state_code le code de l'état + * \return La chaîne de caractères associée au code de l'état. + */ +const char* MLV_convert_button_state_to_string( MLV_Button_state state_code ); + +/** \~french + * \brief Convertit le nom d'un état en son code associé. + * + * \param state_string le nom de l'état. + * \return Le code de l'état associé à la chaîne de caractères. + */ +MLV_Button_state MLV_convert_string_to_button_state( const char* state_string ); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/MLV/MLV_image.h b/MLV/MLV_image.h new file mode 100644 index 0000000..4f1192b --- /dev/null +++ b/MLV/MLV_image.h @@ -0,0 +1,623 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_image.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit tous les prototypes concernant les fonctions + * permettant d'insérer des images. + */ + +#ifndef __MLV__MLV_IMAGE_H__ +#define __MLV__MLV_IMAGE_H__ + +#include "MLV_color.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Définit le type Image dans la bibliothèque MLV. + * + * Une image dans la bibliothèque MLV est un tableau à deux dimentions + * dont chaque entée contient une couleur (voir MLV_Color). + * Nous rapellons que dans MLV les couleurs sont définies à l'aide de 4 + * entiers compris entre 0 et 256 exclu, que l'on appelle composantes : + * - la composante Rouge ( R ); + * - la composante Verte ( G ); + * - la composant Blue ( B ); + * - la composante Alpha, c'est la transparence ( A ). + * + */ +typedef struct _MLV_Image MLV_Image; + +/** \~french + * \brief Charge en mémoire une image contenue dans un fichier. + * + * Cette fonction permet de charger les images des formats suivants: + * ICO(Icon)/CUR(Cursor)/BMP, PNM (PPM/PGM/PBM), XPM, LBM(IFF ILBM), PCX, GIF, + * JPEG, PNG, TGA, TIFF, and XV. + * + * \bug Cette fonction provoque une erreur de segmentation si elle est utilisée + * avant MLV_create_window(). Pour l'instant, nous vous conseillons + * d'utiliser cette fonction apres MLV_create_window(). + * + * \bug Il est possible que cette fonction n'arrive pas à charger correctement + * les images qui ne sont pas en 32 bits (RGBA) - bug à tester. + * + * \bug BUG PRESENT SOUS WINDOWS ET MACOS X : Lorsque la composante alpha d'un + * pixel est à 0, MLV_load_image met à 0 les composantes Rouge, Verte + * et bleue du pixel associé. Ce bug provient de la bibliothèque SDL_image. + * + * \param file_image Chemin d'accès du fichier contenant l'image. + * \return L'image chargée. + */ +MLV_Image* MLV_load_image( const char* file_image ); + + +/** \~french + * \brief Sauvegarde une image dans une fichier BMP. + * + * \bug Cette fonction ne sauvegarde pas la composante alpha. + * + * \param image Image à sauvegarder + * \param file_image Chemin d'accès du fichier contenant l'image. + * \return 0 si c'est un succés, -1 s'il y a eut une erreur. + */ +int MLV_save_image_as_bmp( const MLV_Image* image, const char* file_image ); + +/** \~french + * \brief Créer une image de composante alpha opaque. + * + * \param width Largeur de l'image + * \param height Hauteur de l'image + * \return L'image créé. + */ +MLV_Image* MLV_create_image( int width, int height ); + +/** \~french + * \brief Libère la mémoire utilisée par l'image. + * + * \param image Image à supprimer de la mémoire + */ +void MLV_free_image( MLV_Image *image ); + +/** \~french + * \brief Copie une image. + * + * Cette fonction créé une nouvelle image qui est la copie conforme de l'image + * passée en paramètre. + * La gestion de la mémoire de l'image créée est laissée à l'utilisateur. + * + * \param image L'image à copier. + * \return La copie de l'image. + */ +MLV_Image* MLV_copy_image( const MLV_Image* image ); + +/** \~french + * \brief Copie une partie de l'image. + * + * Cette fonction créé une nouvelle image qui est la copie conforme d'une partie + * de l'image passée en paramètre. + * La gestion de la mémoire de l'image créée est laissée à l'utilisateur. + * + * \param image L'image à copier. + * \param x Abscisse du sommet Nord-Ouest de la partie de l'image à copier + * \param y Ordonnée du sommet Nord-Ouest de la partie de l'image à copier + * \param width Largeur de la partie de l'image à copier + * \param height Hauteur de la partie de l'image à copier + * \return La copie de l'image. + */ +MLV_Image* MLV_copy_partial_image( + const MLV_Image* image, int x, int y, int width, int height +); + +/** \~french + * \brief Retourne la taille d'une image donnée. + * + * \param image L'image pour laquelle la fonction doit retourner sa taille. + * \param width La largeur de l'image. + * \param height La hauteur de l'image. + */ +void MLV_get_image_size( const MLV_Image* image, int* width, int* height ); + +/** \~french + * \brief Retourne la largeur d'une image donnée. + * + * \param image L'image à analyser. + * \return La largeur de l'image. + */ +int MLV_get_image_width( const MLV_Image* image ); + +/** \~french + * \brief Retourne la hauteur d'une image donnée. + * + * \param image L'image à analyser. + * \return La hauteur de l'image + */ +int MLV_get_image_height( const MLV_Image* image ); + + +/** \~french + * \brief Redimensionne l'image en ne respectant pas les proportions de l'image + * originale. + * + * La hauteur et la largeur de la nouvelle image deviennent respectivement la + * hauteur et la largeur passées en paramètres. + * + * \param image L'image à redimentionner. + * \param width La largeur de l'image. + * \param height La hauteur de l'image. + */ +void MLV_resize_image( MLV_Image* image, int width, int height ); + +/** \~french + * \brief Modifie l'image en réalisant une réflexion verticale. + * + * \param image L'image à modifier. + */ +void MLV_vertical_image_mirror( MLV_Image* image ); + +/** \~french + * \brief Modifie l'image en réalisant une réflexion horizontale. + * + * \param image L'image à modifier. + */ +void MLV_horizontal_image_mirror( MLV_Image* image ); + +/** \~french + * \brief Cette fonction redimensionne l'image en repsectant les proportions + * de l'image originale. + * + * L'image résultat est la plus grande image possible incluse dans le rectangle + * de largeur width et de hauteur height. + * + * L'utilisateur peut entrer un entier négatif pour les champs width et height. + * Ces champs ne sont alors pas pris en compte dans le redimensionnement de + * l'image. Dans ce cas, si le paramètre width (resp. height) est + * négatif, alors l'image finale aura pour largeur (resp. hauteur) la taille + * spécifiée dans le paramètre width (resp. height). + * + * \param image L'image à redimentionner. + * \param width La nouvelle largeur de l'image. + * \param height La nouvlle hauteur de l'image. + */ +void MLV_resize_image_with_proportions( + MLV_Image* image, int width, int height +); + +/** \~french + * \brief Modifie l'image à l'aide d'une homotétie ( Étire l'image ) + * + * \param image L'image à modifier. + * \param scalar Coefficient de proportionalité de l'homotétie ( >1 l'image est + * agrandie, <1 l'image est rétrécie ). + */ +void MLV_scale_image( MLV_Image* image, double scalar ); + +/** \~french + * \brief Éffectue une rotation sur une image donnée. + * + * \param image L'image à modifier. + * \param rotation L'angle de la rotation. + */ +void MLV_rotate_image( MLV_Image* image, double rotation ); + +/** \~french + * \brief Éffectue une rotation suivie d'une homotétie + * + * \param image L'image à modifier. + * \param rotation L'angle de la rotation. + * \param scalar Le coéfficient de proportionnalité de l'homotétie. + */ +void MLV_rotate_and_scale_image( MLV_Image* image, double rotation, double scalar ); + +/** \~french + * \brief Étire l'image suivant l'axe X et l'axe Y avec des coefficients de + * proportionnalité différents pour les deux axes. + * + * \param image L'image à modifier. + * \param scalar_x Le coéfficient de proportionnalité de l'axe X. + * \param scalar_y Le coéfficient de proportionnalité de l'axe Y. + */ +void MLV_scale_xy_image( MLV_Image* image, double scalar_x, double scalar_y ); + +/** \~french + * \brief Éffectue une rotation, puis étire l'image suivant l'axe X et l'axe Y + * avec des coefficients de proportionnalité différents pour les deux + * axes. + * + * \param image L'image à modifier. + * \param rotation L'angle de la rotaiton. + * \param scalar_x Le coéfficient de proportionnalité de l'axe X. + * \param scalar_y Le coéfficient de proportionnalité de l'axe Y. + * + */ +void MLV_rotate_and_scale_xy_image( + MLV_Image* image, double rotation, double scalar_x, double scalar_y +); + +/** \~french + * \brief Dessine une image donnée à une position donnée de la fenêtre. + * + * \param image Image à dessiner. + * \param x Coordonnée en X de la position dans la fenêtre de sommet Nord-Ouest + * de l'image. + * \param y Coordonnée en Y de la position dans la fenêtre du sommet Nord-Ouest + * de l'image. + */ +void MLV_draw_image( const MLV_Image *image, int x, int y ); + +/** \~french + * \brief Dessine une partie d'une image donnée à une position donnée sur la + * fenêtre. + * \param image L'image à afficher sur la fenêtre + * \param x_source La coordonnée en X du sommet Nord-Ouest de la partie de + * l'image à afficher. + * \param y_source La coordonnée en Y du sommet Nord-Ouest de la partie de + * l'image à afficher. + * \param width_source La largeur de la partie de l'image à afficher. + * \param height_source La hauteur de la partie de l'image à afficher. + * \param x Coordonnée en X de la position dans la fenêtre du sommet Nord-Ouest + * de la partie de l'image à afficher. + * \param y Coordonnée en Y de la position dans la fenêtre du sommet Nord-Ouest + * de la partie de l'image à afficher. + */ +void MLV_draw_partial_image( + const MLV_Image *image, int x_source, int y_source, + int width_source, int height_source, + int x, int y +); + + +/** \~french + * \brief La composante alpha de l'image est remplacée par une composante + * alpha homogène dont la valeur est donnée en paramètre. + * + * La transparence joue un role lorsqu'une image est dessinée à l'écran, ou + * lorsqu'une image est recopiée à l'intérieure d'une autre image. + * Lorsque l'on recopie une image, les pixels du résultat final sont obtenus en + * faisant un barycentre entre le pixel de l'image source avec celui de l'image + * destination. Les poids des barycentres sont définis par la composante + * transparente ( composante alpha ) de l'image source. + * La transparence de l'image destination reste inchangée. + * + * Par exemple, + * \verbatim +couleur pixel source : RGBA( 60,80,100,128 ) +couleur destination : RGBA( 0,20,40,30 ) +couleur final après recopie : + RGBA( + barycentre( 60, 128, 0, 256-128 ), + barycentre( 80, 128, 20, 256-128 ), + barycentre( 100, 128, 40, 256-128 ), + 30 + ) = + RGBA( + ( 60 * 128 + 0 * (256-128) ) / 256, + ( 80 * 128 + 20 * (256-128) ) / 256, + ( 100 * 128 + 40 * (256-128) ) / 256, + 30 + ) = + RGBA( 30, 50, 70, 30 ) +\endverbatim + * + * \param image L'image à modifier. + * \param alpha La nouvelle composante alpha de l'image. + */ +void MLV_set_alpha_on_image( MLV_Alpha alpha, MLV_Image *image ); + +/** \~french + * + * \brief Écrase les composantes rouge, bleue, vert et alpha d'un pixel par + * celles passées en paramètre de la fonction. + * + * \param x La coordonnée en x du pixel à modifier. + * \param y La coordonnée en y du pixel à modifier. + * \param color La nouvelle couleur du pixel. + * \param image L'image à modifier. + */ +void MLV_set_pixel_on_image( + int x, int y, + MLV_Color color, + MLV_Image *image +); + +/** \~french + * \brief Renvoie la couleur du pixel de l'écran pour une position donnée. + * + * Les paramètres red, blue, green et alpha peuvent être égaux à 0. Dans ce + * cas, ils sont ignorés. + * + * \param x Coordonnée en X de la position du pixel. + * \param y Coordonnée en Y de la position du pixel. + * \param red Composante rouge du pixel. + * \param green Composante verte du pixel. + * \param blue Composante bleue du pixel. + * \param alpha Composante alpha (transparence) du pixel. + */ +void MLV_get_pixel( + int x, int y, int* red, int* green, int* blue, int* alpha +); + +/** \~french + * \brief Renvoie la couleur du pixel présent à une position donnée d'une image + * donnée. + * + * Les paramètres red, blue, green et alpha peuvent être égaux à NULL. Dans ce + * cas, ils sont ignorés. + * + * \param image Image à inspecter. + * \param x Coordonnée en X de la position du pixel à inspecter. + * \param y Coordonnée en Y de la position du pixel à inspecter. + * \param red Composante rouge du pixel. + * \param green Composante verte du pixel. + * \param blue Composante bleue du pixel. + * \param alpha Composante alpha (transparence) du pixel. + */ +void MLV_get_pixel_on_image( + const MLV_Image* image, int x, int y, + int* red, int* green, int* blue, int* alpha +); + +/** \~french + * \brief Dessine une image dans une image destination + * + * \param source_image Image source + * \param source_x Abscisse du sommet nord-Ouest de la position de la portion + * d'image à recopier + * \param source_y Ordonné du sommet nord-Ouest de la position de la portion + * d'image à recopier + * \param width Largeur de la position à recopier + * \param height Hauteur de la position à recopier + * \param destination_image Image destination + * \param destination_x Abscisse de la position où devra être recopier l'image. + * Il s'agit de la futur position du sommet nord-Ouest de + * la portion d'image à recopier. + * \param destination_y Ordonnée de la position où devra être recopier l'image. + * Il s'agit de la futur position du sommet nord-Ouest de + * la portion d'image à recopier. + */ +void MLV_draw_partial_image_on_image( + const MLV_Image* source_image, + int source_x, int source_y, + int width, int height, + MLV_Image* destination_image, + int destination_x, int destination_y +); + +/** \~french + * \brief Dessine une image dans une image destination + * + * \param source_image Image source + * \param destination_image Image destination + * \param destination_x Abscisse de la position où devra être recopier l'image. + * Il s'agit de la futur position du sommet nord-Ouest de + * la portion d'image à recopier. + * \param destination_y Ordonnée de la position où devra être recopier l'image. + * Il s'agit de la futur position du sommet nord-Ouest de + * la portion d'image à recopier. + */ +void MLV_draw_image_on_image( + const MLV_Image* source_image, + MLV_Image* destination_image, + int destination_x, int destination_y +); + +/** \~french + * \brief Renvoie les données internes de l'image. + * + * Cette fonction renvoie un pointeur vers la structure de donnée + * de la libriaire SDL codant une image. + * + * N'utilisez cette fonction que si vous souhaitez effectuer une opération + * sur une image qui n'existe pas dans la bibliothèque MLV. + * En effet, modifier les données internes d'une image de type MLV_Image + * peut corrompre le fonctionnement de la bibliothèque MLV. + * + * Vous pouvez alors utiliser les routines de la lirairie SDL pour + * modifier l'image. (http://libsdl.org) + * + * Voici un exemple de code montrant comment il est possible de récupérer les + * composantes rouge, vert, bleu et alpha du pixel (3,4) de l'image. + * + * \code + * int x=3, y=4; + * + * SDL_Surface* surface = MLV_get_image_data( image ); + * Uint32 red, blue, green, alpha; + * + * // Extracting color components from a 32-bit color value + * SDL_PixelFormat *fmt; + * Uint32 pixel; + * + * SDL_LockSurface(surface); + * fmt = surface->format; + * pixel = *(((Uint32*) surface->pixels)+ y*surface->pitch/4 + x ); + * + * // Get Red component + * red = pixel & fmt->Rmask; // Isolate red component + * red = red >> fmt->Rshift; // Shift it down to 8-bit + * red = red << fmt->Rloss; // Expand to a full 8-bit number + * + * // Get Green component + * green = pixel & fmt->Gmask; // Isolate green component + * green = green >> fmt->Gshift; // Shift it down to 8-bit + * green = green << fmt->Gloss; // Expand to a full 8-bit number + * + * // Get Blue component + * blue = pixel & fmt->Bmask; // Isolate blue component + * blue = blue >> fmt->Bshift; // Shift it down to 8-bit + * blue = blue << fmt->Bloss; // Expand to a full 8-bit number + * + * // Get Alpha component + * alpha = pixel & fmt->Amask; // Isolate alpha component + * alpha = alpha >> fmt->Ashift; // Shift it down to 8-bit + * alpha = alpha << fmt->Aloss; // Expand to a full 8-bit number + * + * MLV_unlock_image( image ); + * \endcode + * + * \param image L'image dont vous souhaitez récuperer les données internes. + * \return un pointeur vers une image de la bibliothèque SDL. + */ +SDL_Surface* MLV_get_image_data( MLV_Image* image ); + +/** \~french + * \brief Enregistre l'image de l'écran dans un presse papier interne à la + * bibliothèque MLV.. + * + */ +void MLV_save_screen(); + +/** \~french + * \brief Charge l'image présent dans le presse papier interne de la bibliothèque + * MLV. + * + */ +void MLV_load_screen(); + +// TODO +#if 0 +/** \~french + * \brief Enmére différents types d'opérations mathématiques. + * + */ +typedef enum { + MLV_NONE, + MLV_REPLACE, + MLV_MAX, + MLV_MIN, + MLV_BARYCENTER +} MLV_Mathematic_operations; + + +/** \~french + * \brief Dessine une image dans une image destination + * + * Cette fonction offre diférentes façon de dessiner une image + * dans une autre. + * Ces différentes façon concerne d'une part les couveh RGB + * ( rouge-vert-bleue) de l'image et d'autre part la couche alpha + * Les différentes façons sont décrites par les paramètres : rgb_treatment + * et alpha_treatment + * Voici un tableau récapitulatif des effets obtenus + * Opération ........ Éffet + * MLV_NONE ........ Les composante destination sont laissée intactes + * MLV_REPLACE ..... Les composantes contenues dans l'image destinatiion sont + * remplacées par celle de l'image source + * MLV_MAX ......... La composante maximale entre source et destination est + * stocké dans l'image destination + * MLV_MIN ......... La composante minimale entre source et destination est + * stocké dans l'image destination + * MLV_BARYCENTER .. Cette opération n'est définit que pour les composantes + * RGB. La composane destination est obtenu en faisant un + * barycentre entre l'image source et l'image destination + * en utilisant la composante alpha de l'image source. + * + * + * \param source_image Image source + * \param source_x Abscisse du sommet nord-Ouest de la position de la portion + * d'image à recopier + * \param source_y Ordonné du sommet nord-Ouest de la position de la portion + * d'image à recopier + * \param with Largeur de la position à recopier + * \param height Hauteur de la position à recopier + * \param destination_image Image destination + * \param destination_x Abscisse de la position où devra être recopier l'image. + * Il s'agit de la futur position du sommet nord-Ouest de + * la portion d'image à recopier. + * \param destination_y Ordonnée de la position où devra être recopier l'image. + * Il s'agit de la futur position du sommet nord-Ouest de + * la portion d'image à recopier. + * \param rgb_treatment Opération mathématique à appliquer pour traiter les + * composantes RGB de l'image + * \param alpha_treatment Opération mathématique à appliquer pour traiter la + * composante alpha de l'image + */ +void MLV_draw_partial_image_on_image( + const MLV_Image* source_image, + int source_x, int source_y, + int with, int height, + MLV_Image* destination_image, + int destination_x, int destination_y, + MLV_Mathematic_operations rgb_treatment, + MLV_Mathematic_operations alpha_treatment +); + +/** \~french + * \brief Dessine une image dans une image destination en utilisant + * l'accélération de la carte graphique. + * + * Les couleurs RGB des images sources et destinations sont mélangé suivant + * les proportions préssentes dans la couches alpha de l'image" source. + * Par exemple, si pour un pixel de l'image, la composant alpha + * vaut 200, alors le pixal final sera composé à 200/255 de la couleur de + * l'image source et de 255-200/255 = 55/200 de l'image destination. + * La composant alpha de l'image destination reste inchangée. + * + * Cette opération est identique à + * MLV_draw_partial_image_on_image( + * X,X,X,X,X,X,X,X, + * MLV_BARYCENTER, + * MLV_NONE, + * ); + * Cependant, MLV_draw_partial_image_on_image_FAST est un opération + * qui bénéficie d'optimisation par la carte graphique. + * + * \param source_image Image source + * \param source_x Abscisse du sommet nord-Ouest de la position de la portion + * d'image à recopier + * \param source_y Ordonné du sommet nord-Ouest de la position de la portion + * d'image à recopier + * \param with Largeur de la position à recopier + * \param height Hauteur de la position à recopier + * \param destination_image Image destination + * \param destination_x Abscisse de la position où devra être recopier l'image. + * Il s'agit de la futur position du sommet nord-Ouest de + * la portion d'image à recopier. + * \param destination_y Ordonnée de la position où devra être recopier l'image. + * Il s'agit de la futur position du sommet nord-Ouest de + * la portion d'image à recopier. + */ +void MLV_draw_partial_image_on_image_FAST( + const MLV_Image* source_image, + int source_x, int source_y, + int with, int height, + const MLV_Image* destination_image, + int destination_x, int destination_y +); +#endif + +/* TODO : A Vérifier ! +void MLV_draw_rotated_image( MLV_Image *image, int x, int y, double rotation ); +void MLV_draw_scaled_image( MLV_Image *image, int x, int y, double scalar ); +void MLV_draw_scaled_rotated_image( MLV_Image *image, int x, int y, double roation, double scalar ); +*/ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MLV/MLV_information.h b/MLV/MLV_information.h new file mode 100644 index 0000000..1fc23ec --- /dev/null +++ b/MLV/MLV_information.h @@ -0,0 +1,98 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_information.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit les prototypes des fonctions permettant de récupérer + * des informations sur la bibliothèque. + */ + +#ifndef __MLV__MLV_INFORMATIONS_H__ +#define __MLV__MLV_INFORMATIONS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Renvoie le nom de la bibliothèque. + * + * \return Le nom de la bibliothèque. + */ +const char* MLV_get_package_name( ); + +/** \~french + * \brief Renvoie la version de la bibliothèque + * + * \return La version de la bibliothèque. + */ +const char* MLV_get_version( ); + +/** \~french + * \brief Renvoie la révision du dépot du logiciel de gestion de version de + * mlv. + * + * \return La révision du dépot du logiciel de gestion de version de mlv. + */ +const char* MLV_get_revision_of_revision_control_software( ); + + +/** \~french + * \brief Renvoie l'adresse du dépot de code source où se trouve la + * bibliothèque. + * + * \return Le dépôt de la bibliothèque. + */ +const char* MLV_get_repository( ); + +/** \~french + * \brief Renvoie l'addresse mail à laquelle vous pouvez envoyer les bugs que + * vous rencontrez. + * + * \return L'addresse mail. + */ +const char* MLV_get_bug_report_address( ); + +/** \~french + * \brief Renvoie le nom de la licence de la bibliothèque. + * + * \return Le nom de la licence de la bibliothèque. + */ +const char* MLV_get_licence( ); + +/** \~french + * \brief Renvoie l'addresse internet où l'on peut trouver le code source de la + * bibliothèque. + * + * \return L'addresse internet où l'on peut trouver le code source de la + * bibliothèque. + */ +const char* MLV_get_web_distribution( ); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/MLV/MLV_input_box.h b/MLV/MLV_input_box.h new file mode 100644 index 0000000..3f39dde --- /dev/null +++ b/MLV/MLV_input_box.h @@ -0,0 +1,317 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_input_box.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit les prototypes des fonctions permettant de + * demander à l'utilisateur du texte par l'intermédiaire de boîtes + * de saisie. + * + */ + +#ifndef __MLV__MLV_INPUT_BOX_H__ +#define __MLV__MLV_INPUT_BOX_H__ + +#include "MLV_color.h" +#include "MLV_text.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Définition du type des boîtes de saisies + * + */ +typedef struct _MLV_Input_box MLV_Input_box; + +/** \~french + * + * \brief Cette fonction suspend l'exécution du programme, affiche une boîte + * de saisie et attends que l'utilisateur rentre une phrase dans le + * champs de la boîte. + * + * La boîte de saisie contient deux zones de textes. + * La première zone ne peut pas être éditée par l'utilisateur et sert à + * afficher un message d'information. + * La deuxième est vide et peut être éditée par l'utilisateur. + * Lorsque l'utilisateur appuie sur la touche entrée, le texte qui + * se trouve dans la zone de texte est renvoyé par la fonction + * grâce au paramètre text. + * Le texte, la taille et les couleurs de la boîte de saisie sont + * paramétrables. + * + * MLV_wait_input_box() alloue lui même la mémoire associée au paramètre "text". + * Par contre, après utilisation, vous devez libérer l'espace mémoire qui a été + * alloué. + * + * \param sommetHautGaucheX La coordonnée en X du coin Nord-Ouest de la + * boîte de saisie. + * \param sommetHautGaucheY La coordonnée en Y du coin Nord-Ouest de la + * boîte de saisie. + * \param sommetBasDroitX La coordonnée en X du coin Sud-Est de la + * boîte de saisie. + * \param sommetBasDroitY La coordonnée en Y du coin Sud-Est de la + * boîte de saisie. + * \param borderColor La couleur de la bordure de la boîte de saisie. + * \param textColor La couleur du texte de la boîte de saisie. + * \param backgroundColor La couleur de fond de la boîte de saisie. + * \param informativeMessage Le message à afficher devant la boîte de saisie. + * \param text L'addresse où sera placé la réponse donnée par + * l'utilisateur. + */ +void MLV_wait_input_box( + int sommetHautGaucheX, int sommetHautGaucheY, + int sommetBasDroitX, int sommetBasDroitY, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, + char** text, ... +); + +/** \~french + * + * \brief Même chose que MLV_wait_input_box(), mais il est possible de + * changer la fonte du du texte. + * + * MLV_wait_input_box_with_font() alloue lui même la mémoire associée au + * paramètre "text". + * Par contre, après utilisation, vous devez libérer l'espace mémoire qui a + * été alloué. + * + * \param sommetHautGaucheX La coordonnée en X du coin Nord-Ouest de la + * boîte de saisie. + * \param sommetHautGaucheY La coordonnée en Y du coin Nord-Ouest de la + * boîte de saisie. + * \param sommetBasDroitX La coordonnée en X du coin Sud-Est de la boîte + * de saisie. + * \param sommetBasDroitY La coordonnée en Y du coin Sud-Est de la boîte + * de saisie. + * \param borderColor La couleur de la bordure de la boîte de saisie. + * \param textColor La couleur du texte de la boîte de saisie. + * \param backgroundColor La couleur de fond de la boîte de saisie. + * \param informativeMessage Le message à afficher devant la boîte de saisie. + * \param text L'addresse où sera placé la réponse donnée par + * l'utilisateur. + * \param font La font du texte à utiliser. + */ +void MLV_wait_input_box_with_font( + int sommetHautGaucheX, int sommetHautGaucheY, + int sommetBasDroitX, int sommetBasDroitY, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, + char** text, + const MLV_Font* font, ... +); + + +/** \~french + * \brief Cette fonction suspend l'exécution du programme jusqu'à ce que + * l'utilisateur écrive une phrase dans le champs de la boîte de + * saisie passée en paramètre de la fonction. + * + * \param input_box La boîte de saisie qui doit être observée. + * \param text Le texte récupéré par la boîte de saisie. + */ +void MLV_wait_particular_input_box( MLV_Input_box* input_box, char** text); + + +/** \~french + * \brief Cette fonction créé une boîte de saisie. + * + * Une fois la boîte de saisie créé, si l'utilisateur clique sur la boîte + * de saisie, la boîte de saisie devient active. + * Cela veux dire que tout les évènements clavier sont récupérés par la + * boîte de saisie qui s'en sert pour enregistrer le texte tapé par + * l'utilisateur. + * De même, tout clique de souris réalisé sur la boîte de saisie est + * acaparé par la boîte de saisie. + * + * Pour dessiner une ou toutes les boîtes de saisies, dans la zone où vous + * les avez créées, vous devez utiliser les fonctions : + * - MLV_draw_input_box() + * - MLV_draw_all_input_boxes() + * + * \param sommetHautGaucheX La coordonnée en X du sommet Nord-Ouest de la boîte + * de saisie. + * \param sommetHautGaucheY La coordonnée en Y du sommet Nord-Ouest de la boîte + * de saisie. + * \param width La largeur de la boîte de saisie. + * \param height La hauteur de la boîte de saisie. + * \param borderColor La couleur de la bordure de la boîte de saisie. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond. + * \param informativeMessage La message d'entête de la boîte de saisie. + */ +MLV_Input_box* MLV_create_input_box( + int sommetHautGaucheX, int sommetHautGaucheY, + int width, int height, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, ... +); + +/** \~french + * \brief Cette fonction créé une boîte de saisie avec une font spécifique. + * + * \param sommetHautGaucheX La coordonnée en X du sommet Nord-Ouest de la boîte de saisie. + * \param sommetHautGaucheY La coordonnée en Y du sommet Nord-Ouest de la boîte de saisie. + * \param width La largeur de la boîte de saisie. + * \param height La hauteur de la boîte de saisie. + * \param borderColor La couleur de la bordure de la boîte de saisie. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond. + * \param informativeMessage Le message d'entête de la boîte de saisie. + * \param font La font à utiliser pour le texte. + */ +MLV_Input_box* MLV_create_input_box_with_font( + int sommetHautGaucheX, int sommetHautGaucheY, + int width, int height, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, + const MLV_Font* font, ... +); + + +/** \~french + * \brief Cette fonction ferme une boîte de saisie précédement créée. + * + * L'espace mémoire allouée à la boîte de saisie est libéré. + * + * \param input_box La boîte de saisie à fermer. + */ +void MLV_free_input_box( MLV_Input_box* input_box ); + +/** \~french + * \brief Cette fonction change le message d'entête d'une boîte de saisie. + * + * \param input_box La boîte de saisie à modifier. + * \param message Le message d'entête. + */ +void MLV_change_informative_message_of_input_box( + MLV_Input_box* input_box, const char* message, ... +); + +/** \~french + * \brief Cette fonction dessine une boîte de saisie particulière. + * + * \param input_box La boîte de saisie à dessiner. + */ +void MLV_draw_input_box( MLV_Input_box* input_box ); + +/** \~french + * \brief Cette fonction dessine tous les boîtes de saisies. + * + + */ +void MLV_draw_all_input_boxes(); + +/** \~french + * \brief Cette fonction supprime l'historique d'une boîte de saisie. + * + * \param input_box La boîte de saisie dont l'histoirque doit être supprimé + */ +void MLV_suppress_history( MLV_Input_box* input_box ); + +/** \~french + * \brief Cette fonction change la taille et la position d'une boîte de saisie donnée en paramètre. + * + * \param input_box La boîte de saisie à modifier. + * \param sommetHautGaucheX La nouvelle coordonnée en X de la position du sommet + * Nord-Ouest de la boîte de saisie. + * \param sommetHautGaucheY La nouvelle coordonnée en Y de la position du sommet + * Nord-Ouest de la boîte de saisie. + * \param width La nouvelle largeur de la boîte de saisie. + * \param height La nouvelle hauteur de la boîte de saisie. + */ +void MLV_change_input_box_geometry( + MLV_Input_box* input_box, int sommetHautGaucheX, int sommetHautGaucheY, + int width, int height +); + +/** \~french + * \brief Cette fonction change la taille d'une boîte de saisie. + * + * \param input_box La boîte de saisie à modifier. + * \param width La nouvelle largeur de la boîte de saisie. + * \param height La nouvelle hauteur de la boîte de saisie. + */ +void MLV_change_input_box_size(MLV_Input_box* input_box, int width, int height); + +/** \~french + * \brief Cette fonction change la position d'une boîte de saisie donnée en paramètre. + * + * \param input_box La boîte de saisie à modifier. + * \param sommetHautGaucheX La nouvelle coordonnée en X de la position du sommet + * Nord-Ouest de la boîte de saisie. + * \param sommetHautGaucheY La nouvelle coordonnée en Y de la position du sommet + * Nord-Ouest de la boîte de saisie. + */ +void MLV_change_input_box_position( + MLV_Input_box* input_box, int sommetHautGaucheX, int sommetHautGaucheY +); + +/** \~french + * \brief Cette fonction change les différentes couleurs d'une boîte de saisie donnée + * + * \param input_box La boîte de saisie à modifier. + * \param borderColor La nouvelle couleur du bord de la boîte de saisie. + * \param textColor La nouvelle couleur du texte de la boîte de saisie. + * \param backgroundColor La nouvelle couleur de fond de la boîte de saisie. + */ +void MLV_change_input_box_colors( + MLV_Input_box* input_box, MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor +); + +/** \~french + * \brief Cette fonction active une boîte de saisie. + * + * Cette opération agit comme si l'utilisateur avait cliqué sur la boîte de + * saisie en question (action qui rend active une boîte de saisie). + * + * Lorsque une boîte de saisie est active, les évènements du clavier sont + * récupérés par la boîte de saisie et sont utilisés pour enregistrer le + * texte tapé par l'utilisateur. + * Les cliques de souris sur la boîte de saisie sont aussi récupérés par + * la boîte de saisie. + * + * \param input_box La boîte de saisie à activer. + */ +void MLV_activate_input_box( MLV_Input_box* input_box ); + +/** \~french + * \brief Cette fonction désactive la boîte de saisie qui est active. + * + * Si il n'y a pas de boîte de saisie active, cette fonction ne fait rien. + */ +void MLV_desactivate_input_box( ); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MLV/MLV_input_box_va.h b/MLV/MLV_input_box_va.h new file mode 100644 index 0000000..2d01d39 --- /dev/null +++ b/MLV/MLV_input_box_va.h @@ -0,0 +1,204 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2013-2014 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_input_box_va.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit les prototypes des fonctions permettant de + * demander à l'utilisateur du texte par l'intermédiaire de boîtes + * de saisie. + * + */ + +#ifndef __MLV__MLV_INPUT_BOX_VA_H__ +#define __MLV__MLV_INPUT_BOX_VA_H__ + +#include "MLV_color.h" +#include "MLV_text.h" +#include "MLV_input_box.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * + * \brief Cette fonction suspend l'exécution du programme, affiche une boîte + * de saisie et attends que l'utilisateur rentre une phrase dans le + * champs de la boîte. + * + * La boîte de saisie contient deux zones de textes. + * La première zone ne peut pas être éditée par l'utilisateur et sert à + * afficher un message d'information. + * La deuxième est vide et peut être éditée par l'utilisateur. + * Lorsque l'utilisateur appuie sur la touche entrée, le texte qui + * se trouve dans la zone de texte est renvoyé par la fonction + * grâce au paramètre text. + * Le texte, la taille et les couleurs de la boîte de saisie sont + * paramétrables. + * + * MLV_wait_input_box() alloue lui même la mémoire associée au paramètre "text". + * Par contre, après utilisation, vous devez libérer l'espace mémoire qui a été + * alloué. + * + * \param sommetHautGaucheX La coordonnée en X du coin Nord-Ouest de la + * boîte de saisie. + * \param sommetHautGaucheY La coordonnée en Y du coin Nord-Ouest de la + * boîte de saisie. + * \param sommetBasDroitX La coordonnée en X du coin Sud-Est de la + * boîte de saisie. + * \param sommetBasDroitY La coordonnée en Y du coin Sud-Est de la + * boîte de saisie. + * \param borderColor La couleur de la bordure de la boîte de saisie. + * \param textColor La couleur du texte de la boîte de saisie. + * \param backgroundColor La couleur de fond de la boîte de saisie. + * \param informativeMessage Le message à afficher devant la boîte de saisie. + * \param text L'addresse où sera placé la réponse donnée par + * l'utilisateur. + * \param pile La pile des complements de paramètres comme dans vaprintf. + */ +void MLV_wait_input_box_va( + int sommetHautGaucheX, int sommetHautGaucheY, + int sommetBasDroitX, int sommetBasDroitY, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, + char** text, + va_list pile +); + +/** \~french + * + * \brief Même chose que MLV_wait_input_box(), mais il est possible de + * changer la fonte du du texte. + * + * MLV_wait_input_box_with_font() alloue lui même la mémoire associée au + * paramètre "text". + * Par contre, après utilisation, vous devez libérer l'espace mémoire qui a + * été alloué. + * + * \param sommetHautGaucheX La coordonnée en X du coin Nord-Ouest de la + * boîte de saisie. + * \param sommetHautGaucheY La coordonnée en Y du coin Nord-Ouest de la + * boîte de saisie. + * \param sommetBasDroitX La coordonnée en X du coin Sud-Est de la boîte + * de saisie. + * \param sommetBasDroitY La coordonnée en Y du coin Sud-Est de la boîte + * de saisie. + * \param borderColor La couleur de la bordure de la boîte de saisie. + * \param textColor La couleur du texte de la boîte de saisie. + * \param backgroundColor La couleur de fond de la boîte de saisie. + * \param informativeMessage Le message à afficher devant la boîte de saisie. + * \param text L'addresse où sera placé la réponse donnée par + * l'utilisateur. + * \param font La font du texte à utiliser. + * \param pile La pile des complements de paramètres comme dans vaprintf. + */ +void MLV_wait_input_box_with_font_va( + int sommetHautGaucheX, int sommetHautGaucheY, + int sommetBasDroitX, int sommetBasDroitY, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, + char** text, + const MLV_Font* font, + va_list pile +); + +/** \~french + * \brief Cette fonction créé une boîte de saisie. + * + * Une fois la boîte de saisie créé, si l'utilisateur clique sur la boîte + * de saisie, la boîte de saisie devient active. + * Cela veux dire que tout les évènements clavier sont récupérés par la + * boîte de saisie qui s'en sert pour enregistrer le texte tapé par + * l'utilisateur. + * De même, tout clique de souris réalisé sur la boîte de saisie est + * acaparé par la boîte de saisie. + * + * Pour dessiner une ou toutes les boîtes de saisies, dans la zone où vous + * les avez créées, vous devez utiliser les fonctions : + * - MLV_draw_input_box() + * - MLV_draw_all_input_boxes() + * + * \param sommetHautGaucheX La coordonnée en X du sommet Nord-Ouest de la boîte + * de saisie. + * \param sommetHautGaucheY La coordonnée en Y du sommet Nord-Ouest de la boîte + * de saisie. + * \param width La largeur de la boîte de saisie. + * \param height La hauteur de la boîte de saisie. + * \param borderColor La couleur de la bordure de la boîte de saisie. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond. + * \param informativeMessage La message d'entête de la boîte de saisie. + * \param pile La pile des complements de paramètres comme dans vaprintf. + */ +MLV_Input_box* MLV_create_input_box_va( + int sommetHautGaucheX, int sommetHautGaucheY, + int width, int height, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, + va_list pile +); + +/** \~french + * \brief Cette fonction créé une boîte de saisie avec une font spécifique. + * + * \param sommetHautGaucheX La coordonnée en X du sommet Nord-Ouest de la boîte de saisie. + * \param sommetHautGaucheY La coordonnée en Y du sommet Nord-Ouest de la boîte de saisie. + * \param width La largeur de la boîte de saisie. + * \param height La hauteur de la boîte de saisie. + * \param borderColor La couleur de la bordure de la boîte de saisie. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond. + * \param informativeMessage Le message d'entête de la boîte de saisie. + * \param font La font à utiliser pour le texte. + * \param pile La pile des complements de paramètres comme dans vaprintf. + */ +MLV_Input_box* MLV_create_input_box_with_font_va( + int sommetHautGaucheX, int sommetHautGaucheY, + int width, int height, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, + const MLV_Font* font, + va_list pile +); + +/** \~french + * \brief Cette fonction change le message d'entête d'une boîte de saisie. + * + * \param input_box La boîte de saisie à modifier. + * \param message Le message d'entête. + * \param pile La pile des complements de paramètres comme dans vaprintf. + */ +void MLV_change_informative_message_of_input_box_va( + MLV_Input_box* input_box, const char* message, va_list pile +); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MLV/MLV_keyboard.h b/MLV/MLV_keyboard.h new file mode 100644 index 0000000..ac5e078 --- /dev/null +++ b/MLV/MLV_keyboard.h @@ -0,0 +1,545 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_keyboard.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit les prototypes des fonctions permettant + * d'utiliser le clavier. + * + */ + +#ifndef __MLV__MLV_KEYBOARD_H__ +#define __MLV__MLV_KEYBOARD_H__ + +#ifndef MEMORY_DEBUG +#include +#else +#include "memory_debug.h" +#endif + +#include "MLV_device_with_buttons.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Énumère l'ensemble des codes des touches du clavier + */ +typedef enum { + MLV_KEYBOARD_NONE = SDLK_UNKNOWN, + MLV_KEYBOARD_UNKNOWN = SDLK_UNKNOWN, + MLV_KEYBOARD_FIRST = SDLK_FIRST, + MLV_KEYBOARD_BACKSPACE = SDLK_BACKSPACE, + MLV_KEYBOARD_TAB = SDLK_TAB, + MLV_KEYBOARD_CLEAR = SDLK_CLEAR, + MLV_KEYBOARD_RETURN = SDLK_RETURN, + MLV_KEYBOARD_PAUSE = SDLK_PAUSE, + MLV_KEYBOARD_ESCAPE = SDLK_ESCAPE, + MLV_KEYBOARD_SPACE = SDLK_SPACE, + MLV_KEYBOARD_EXCLAIM = SDLK_EXCLAIM, + MLV_KEYBOARD_QUOTEDBL = SDLK_QUOTEDBL, + MLV_KEYBOARD_HASH = SDLK_HASH, + MLV_KEYBOARD_DOLLAR = SDLK_DOLLAR, + MLV_KEYBOARD_AMPERSAND = SDLK_AMPERSAND, + MLV_KEYBOARD_QUOTE = SDLK_QUOTE, + MLV_KEYBOARD_LEFTPAREN = SDLK_LEFTPAREN, + MLV_KEYBOARD_RIGHTPAREN = SDLK_RIGHTPAREN, + MLV_KEYBOARD_ASTERISK = SDLK_ASTERISK, + MLV_KEYBOARD_PLUS = SDLK_PLUS, + MLV_KEYBOARD_COMMA = SDLK_COMMA, + MLV_KEYBOARD_MINUS = SDLK_MINUS, + MLV_KEYBOARD_PERIOD = SDLK_PERIOD, + MLV_KEYBOARD_SLASH = SDLK_SLASH, + MLV_KEYBOARD_0 = SDLK_0, + MLV_KEYBOARD_1 = SDLK_1, + MLV_KEYBOARD_2 = SDLK_2, + MLV_KEYBOARD_3 = SDLK_3, + MLV_KEYBOARD_4 = SDLK_4, + MLV_KEYBOARD_5 = SDLK_5, + MLV_KEYBOARD_6 = SDLK_6, + MLV_KEYBOARD_7 = SDLK_7, + MLV_KEYBOARD_8 = SDLK_8, + MLV_KEYBOARD_9 = SDLK_9, + MLV_KEYBOARD_COLON = SDLK_COLON, + MLV_KEYBOARD_SEMICOLON = SDLK_SEMICOLON, + MLV_KEYBOARD_LESS = SDLK_LESS, + MLV_KEYBOARD_EQUALS = SDLK_EQUALS, + MLV_KEYBOARD_GREATER = SDLK_GREATER, + MLV_KEYBOARD_QUESTION = SDLK_QUESTION, + MLV_KEYBOARD_AT = SDLK_AT, + + MLV_KEYBOARD_LEFTBRACKET = SDLK_LEFTBRACKET, + MLV_KEYBOARD_BACKSLASH = SDLK_BACKSLASH, + MLV_KEYBOARD_RIGHTBRACKET = SDLK_RIGHTBRACKET, + MLV_KEYBOARD_CARET = SDLK_CARET, + MLV_KEYBOARD_UNDERSCORE = SDLK_UNDERSCORE, + MLV_KEYBOARD_BACKQUOTE = SDLK_BACKQUOTE, + MLV_KEYBOARD_a = SDLK_a, + MLV_KEYBOARD_b = SDLK_b, + MLV_KEYBOARD_c = SDLK_c, + MLV_KEYBOARD_d = SDLK_d, + MLV_KEYBOARD_e = SDLK_e, + MLV_KEYBOARD_f = SDLK_f, + MLV_KEYBOARD_g = SDLK_g, + MLV_KEYBOARD_h = SDLK_h, + MLV_KEYBOARD_i = SDLK_i, + MLV_KEYBOARD_j = SDLK_j, + MLV_KEYBOARD_k = SDLK_k, + MLV_KEYBOARD_l = SDLK_l, + MLV_KEYBOARD_m = SDLK_m, + MLV_KEYBOARD_n = SDLK_n, + MLV_KEYBOARD_o = SDLK_o, + MLV_KEYBOARD_p = SDLK_p, + MLV_KEYBOARD_q = SDLK_q, + MLV_KEYBOARD_r = SDLK_r, + MLV_KEYBOARD_s = SDLK_s, + MLV_KEYBOARD_t = SDLK_t, + MLV_KEYBOARD_u = SDLK_u, + MLV_KEYBOARD_v = SDLK_v, + MLV_KEYBOARD_w = SDLK_w, + MLV_KEYBOARD_x = SDLK_x, + MLV_KEYBOARD_y = SDLK_y, + MLV_KEYBOARD_z = SDLK_z, + MLV_KEYBOARD_DELETE = SDLK_DELETE, + + MLV_KEYBOARD_WORLD_0 = SDLK_WORLD_0, + MLV_KEYBOARD_WORLD_1 = SDLK_WORLD_1, + MLV_KEYBOARD_WORLD_2 = SDLK_WORLD_2, + MLV_KEYBOARD_WORLD_3 = SDLK_WORLD_3, + MLV_KEYBOARD_WORLD_4 = SDLK_WORLD_4, + MLV_KEYBOARD_WORLD_5 = SDLK_WORLD_5, + MLV_KEYBOARD_WORLD_6 = SDLK_WORLD_6, + MLV_KEYBOARD_WORLD_7 = SDLK_WORLD_7, + MLV_KEYBOARD_WORLD_8 = SDLK_WORLD_8, + MLV_KEYBOARD_WORLD_9 = SDLK_WORLD_9, + MLV_KEYBOARD_WORLD_10 = SDLK_WORLD_10, + MLV_KEYBOARD_WORLD_11 = SDLK_WORLD_11, + MLV_KEYBOARD_WORLD_12 = SDLK_WORLD_12, + MLV_KEYBOARD_WORLD_13 = SDLK_WORLD_13, + MLV_KEYBOARD_WORLD_14 = SDLK_WORLD_14, + MLV_KEYBOARD_WORLD_15 = SDLK_WORLD_15, + MLV_KEYBOARD_WORLD_16 = SDLK_WORLD_16, + MLV_KEYBOARD_WORLD_17 = SDLK_WORLD_17, + MLV_KEYBOARD_WORLD_18 = SDLK_WORLD_18, + MLV_KEYBOARD_WORLD_19 = SDLK_WORLD_19, + MLV_KEYBOARD_WORLD_20 = SDLK_WORLD_20, + MLV_KEYBOARD_WORLD_21 = SDLK_WORLD_21, + MLV_KEYBOARD_WORLD_22 = SDLK_WORLD_22, + MLV_KEYBOARD_WORLD_23 = SDLK_WORLD_23, + MLV_KEYBOARD_WORLD_24 = SDLK_WORLD_24, + MLV_KEYBOARD_WORLD_25 = SDLK_WORLD_25, + MLV_KEYBOARD_WORLD_26 = SDLK_WORLD_26, + MLV_KEYBOARD_WORLD_27 = SDLK_WORLD_27, + MLV_KEYBOARD_WORLD_28 = SDLK_WORLD_28, + MLV_KEYBOARD_WORLD_29 = SDLK_WORLD_29, + MLV_KEYBOARD_WORLD_30 = SDLK_WORLD_30, + MLV_KEYBOARD_WORLD_31 = SDLK_WORLD_31, + MLV_KEYBOARD_WORLD_32 = SDLK_WORLD_32, + MLV_KEYBOARD_WORLD_33 = SDLK_WORLD_33, + MLV_KEYBOARD_WORLD_34 = SDLK_WORLD_34, + MLV_KEYBOARD_WORLD_35 = SDLK_WORLD_35, + MLV_KEYBOARD_WORLD_36 = SDLK_WORLD_36, + MLV_KEYBOARD_WORLD_37 = SDLK_WORLD_37, + MLV_KEYBOARD_WORLD_38 = SDLK_WORLD_38, + MLV_KEYBOARD_WORLD_39 = SDLK_WORLD_39, + MLV_KEYBOARD_WORLD_40 = SDLK_WORLD_40, + MLV_KEYBOARD_WORLD_41 = SDLK_WORLD_41, + MLV_KEYBOARD_WORLD_42 = SDLK_WORLD_42, + MLV_KEYBOARD_WORLD_43 = SDLK_WORLD_43, + MLV_KEYBOARD_WORLD_44 = SDLK_WORLD_44, + MLV_KEYBOARD_WORLD_45 = SDLK_WORLD_45, + MLV_KEYBOARD_WORLD_46 = SDLK_WORLD_46, + MLV_KEYBOARD_WORLD_47 = SDLK_WORLD_47, + MLV_KEYBOARD_WORLD_48 = SDLK_WORLD_48, + MLV_KEYBOARD_WORLD_49 = SDLK_WORLD_49, + MLV_KEYBOARD_WORLD_50 = SDLK_WORLD_50, + MLV_KEYBOARD_WORLD_51 = SDLK_WORLD_51, + MLV_KEYBOARD_WORLD_52 = SDLK_WORLD_52, + MLV_KEYBOARD_WORLD_53 = SDLK_WORLD_53, + MLV_KEYBOARD_WORLD_54 = SDLK_WORLD_54, + MLV_KEYBOARD_WORLD_55 = SDLK_WORLD_55, + MLV_KEYBOARD_WORLD_56 = SDLK_WORLD_56, + MLV_KEYBOARD_WORLD_57 = SDLK_WORLD_57, + MLV_KEYBOARD_WORLD_58 = SDLK_WORLD_58, + MLV_KEYBOARD_WORLD_59 = SDLK_WORLD_59, + MLV_KEYBOARD_WORLD_60 = SDLK_WORLD_60, + MLV_KEYBOARD_WORLD_61 = SDLK_WORLD_61, + MLV_KEYBOARD_WORLD_62 = SDLK_WORLD_62, + MLV_KEYBOARD_WORLD_63 = SDLK_WORLD_63, + MLV_KEYBOARD_WORLD_64 = SDLK_WORLD_64, + MLV_KEYBOARD_WORLD_65 = SDLK_WORLD_65, + MLV_KEYBOARD_WORLD_66 = SDLK_WORLD_66, + MLV_KEYBOARD_WORLD_67 = SDLK_WORLD_67, + MLV_KEYBOARD_WORLD_68 = SDLK_WORLD_68, + MLV_KEYBOARD_WORLD_69 = SDLK_WORLD_69, + MLV_KEYBOARD_WORLD_70 = SDLK_WORLD_70, + MLV_KEYBOARD_WORLD_71 = SDLK_WORLD_71, + MLV_KEYBOARD_WORLD_72 = SDLK_WORLD_72, + MLV_KEYBOARD_WORLD_73 = SDLK_WORLD_73, + MLV_KEYBOARD_WORLD_74 = SDLK_WORLD_74, + MLV_KEYBOARD_WORLD_75 = SDLK_WORLD_75, + MLV_KEYBOARD_WORLD_76 = SDLK_WORLD_76, + MLV_KEYBOARD_WORLD_77 = SDLK_WORLD_77, + MLV_KEYBOARD_WORLD_78 = SDLK_WORLD_78, + MLV_KEYBOARD_WORLD_79 = SDLK_WORLD_79, + MLV_KEYBOARD_WORLD_80 = SDLK_WORLD_80, + MLV_KEYBOARD_WORLD_81 = SDLK_WORLD_81, + MLV_KEYBOARD_WORLD_82 = SDLK_WORLD_82, + MLV_KEYBOARD_WORLD_83 = SDLK_WORLD_83, + MLV_KEYBOARD_WORLD_84 = SDLK_WORLD_84, + MLV_KEYBOARD_WORLD_85 = SDLK_WORLD_85, + MLV_KEYBOARD_WORLD_86 = SDLK_WORLD_86, + MLV_KEYBOARD_WORLD_87 = SDLK_WORLD_87, + MLV_KEYBOARD_WORLD_88 = SDLK_WORLD_88, + MLV_KEYBOARD_WORLD_89 = SDLK_WORLD_89, + MLV_KEYBOARD_WORLD_90 = SDLK_WORLD_90, + MLV_KEYBOARD_WORLD_91 = SDLK_WORLD_91, + MLV_KEYBOARD_WORLD_92 = SDLK_WORLD_92, + MLV_KEYBOARD_WORLD_93 = SDLK_WORLD_93, + MLV_KEYBOARD_WORLD_94 = SDLK_WORLD_94, + MLV_KEYBOARD_WORLD_95 = SDLK_WORLD_95, + + MLV_KEYBOARD_KP0 = SDLK_KP0, + MLV_KEYBOARD_KP1 = SDLK_KP1, + MLV_KEYBOARD_KP2 = SDLK_KP2, + MLV_KEYBOARD_KP3 = SDLK_KP3, + MLV_KEYBOARD_KP4 = SDLK_KP4, + MLV_KEYBOARD_KP5 = SDLK_KP5, + MLV_KEYBOARD_KP6 = SDLK_KP6, + MLV_KEYBOARD_KP7 = SDLK_KP7, + MLV_KEYBOARD_KP8 = SDLK_KP8, + MLV_KEYBOARD_KP9 = SDLK_KP9, + MLV_KEYBOARD_KP_PERIOD = SDLK_KP_PERIOD, + MLV_KEYBOARD_KP_DIVIDE = SDLK_KP_DIVIDE, + MLV_KEYBOARD_KP_MULTIPLY = SDLK_KP_MULTIPLY, + MLV_KEYBOARD_KP_MINUS = SDLK_KP_MINUS, + MLV_KEYBOARD_KP_PLUS = SDLK_KP_PLUS, + MLV_KEYBOARD_KP_ENTER = SDLK_KP_ENTER, + MLV_KEYBOARD_KP_EQUALS = SDLK_KP_EQUALS, + + MLV_KEYBOARD_UP = SDLK_UP, + MLV_KEYBOARD_DOWN = SDLK_DOWN, + MLV_KEYBOARD_RIGHT = SDLK_RIGHT, + MLV_KEYBOARD_LEFT = SDLK_LEFT, + MLV_KEYBOARD_INSERT = SDLK_INSERT, + MLV_KEYBOARD_HOME = SDLK_HOME, + MLV_KEYBOARD_END = SDLK_END, + MLV_KEYBOARD_PAGEUP = SDLK_PAGEUP, + MLV_KEYBOARD_PAGEDOWN = SDLK_PAGEDOWN, + + MLV_KEYBOARD_F1 = SDLK_F1, + MLV_KEYBOARD_F2 = SDLK_F2, + MLV_KEYBOARD_F3 = SDLK_F3, + MLV_KEYBOARD_F4 = SDLK_F4, + MLV_KEYBOARD_F5 = SDLK_F5, + MLV_KEYBOARD_F6 = SDLK_F6, + MLV_KEYBOARD_F7 = SDLK_F7, + MLV_KEYBOARD_F8 = SDLK_F8, + MLV_KEYBOARD_F9 = SDLK_F9, + MLV_KEYBOARD_F10 = SDLK_F10, + MLV_KEYBOARD_F11 = SDLK_F11, + MLV_KEYBOARD_F12 = SDLK_F12, + MLV_KEYBOARD_F13 = SDLK_F13, + MLV_KEYBOARD_F14 = SDLK_F14, + MLV_KEYBOARD_F15 = SDLK_F15, + + MLV_KEYBOARD_NUMLOCK = SDLK_NUMLOCK, + MLV_KEYBOARD_CAPSLOCK = SDLK_CAPSLOCK, + MLV_KEYBOARD_SCROLLOCK = SDLK_SCROLLOCK, + MLV_KEYBOARD_RSHIFT = SDLK_RSHIFT, + MLV_KEYBOARD_LSHIFT = SDLK_LSHIFT, + MLV_KEYBOARD_RCTRL = SDLK_RCTRL, + MLV_KEYBOARD_LCTRL = SDLK_LCTRL, + MLV_KEYBOARD_RALT = SDLK_RALT, + MLV_KEYBOARD_LALT = SDLK_LALT, + MLV_KEYBOARD_RMETA = SDLK_RMETA, + MLV_KEYBOARD_LMETA = SDLK_LMETA, + MLV_KEYBOARD_LSUPER = SDLK_LSUPER, + MLV_KEYBOARD_RSUPER = SDLK_RSUPER, + MLV_KEYBOARD_MODE = SDLK_MODE, + MLV_KEYBOARD_COMPOSE = SDLK_COMPOSE, + + MLV_KEYBOARD_HELP = SDLK_HELP, + MLV_KEYBOARD_PRINT = SDLK_PRINT, + MLV_KEYBOARD_SYSREQ = SDLK_SYSREQ, + MLV_KEYBOARD_BREAK = SDLK_BREAK, + MLV_KEYBOARD_MENU = SDLK_MENU, + MLV_KEYBOARD_POWER = SDLK_POWER, + MLV_KEYBOARD_EURO = SDLK_EURO, + MLV_KEYBOARD_UNDO = SDLK_UNDO, + + MLV_KEYBOARD_LAST = SDLK_LAST +} MLV_Keyboard_button; + +/** \~french + * \brief Énumère l'ensemble des codes associées aux différents modes du clavier + */ +typedef enum { + MLV_KEYBOARD_KMOD_NONE = KMOD_NONE, + MLV_KEYBOARD_KMOD_LSHIFT = KMOD_LSHIFT, + MLV_KEYBOARD_KMOD_RSHIFT = KMOD_RSHIFT, + MLV_KEYBOARD_KMOD_LCTRL = KMOD_LCTRL, + MLV_KEYBOARD_KMOD_RCTRL = KMOD_RCTRL, + MLV_KEYBOARD_KMOD_LALT = KMOD_LALT, + MLV_KEYBOARD_KMOD_RALT = KMOD_RALT, + MLV_KEYBOARD_KMOD_LMETA = KMOD_LMETA, + MLV_KEYBOARD_KMOD_RMETA = KMOD_RMETA, + MLV_KEYBOARD_KMOD_NUM = KMOD_NUM, + MLV_KEYBOARD_KMOD_CAPS = KMOD_CAPS, + MLV_KEYBOARD_KMOD_MODE = KMOD_MODE, + MLV_KEYBOARD_KMOD_RESERVED = KMOD_RESERVED +} MLV_Keyboard_modifier; + +/** \~french + * \brief Suspend l'exécution jusqu'à ce que l'utilisateur appuie sur une touche + * du clavier. + * + * Lorsque l'utilisateur appuie sur une touche, la fonction remplit le contenu + * des trois paramètres sym, mod et unicode correspondant respectivement au + * code de la touche, au mode dans lequel se trouve le clavier + * (majuscule etc ...) et au caractère unicode obtenu en combinant le mode du + * clavier et le code de la touche appuyée. + * + * La fonction accepte des valeurs nulles pour les pointeurs sym, mod et + * unicode. + * Dans ce cas la fonction ignore les champs en questions. + * + * \bug Voir les bugs de la fonction MLV_get_event(). + * + * \param sym Le code de la touche. + * \param mod Le mode dans lequel se trouve le clavier. + * \param unicode Le caractère codé en unicode de la lettre obtenue en combinant + * le code et le mode précédent. + */ +void MLV_wait_keyboard( MLV_Keyboard_button* sym, MLV_Keyboard_modifier* mod, int* unicode ); + +/** \~french + * \brief Suspend l'exécution jusqu'à ce que l'utilisateur appuie sur une touche + * du clavier ou jusq'à ce q'un nombre de secondes passées en paramètres + * soient écoulées. + * + * Pour plus d'informations sur le fonctionnement de cette fonction, veuillez + * vous reporter à la documentation de MLV_wait_keyboard(). + * + * La fonction accepte des valeurs nulles pour les pointeurs sym, mod et + * unicode. + * Dans ce cas la fonction ignore les champs en questions. + * + * \bug Voir les bugs de la fonction MLV_get_event(). + * + * \param sym Le code de la touche. + * \param mod Le mode dans lequel se trouve le clavier. + * \param unicode Le caractère codé en unicode de la lettre obtenue en combinant + * le code et le mode précédent. + * \param seconds Le nombre de secondes à attendre. + * \return Renvoie 1 si l'utilisateur a utilisé le calvier, 0 si le temps s'est + * écoulé. + */ +int MLV_wait_keyboard_or_seconds( + MLV_Keyboard_button* sym, MLV_Keyboard_modifier* mod, int* unicode, int seconds +); + + +/** \~french + * \brief Renvoie le code de la touche clavier correspondant au type clavier + * passé en paramètre. + * + * \param key_string La chaine de caractères codant le type de la touche. + * + * \return Le code de la touche clavier. + */ +MLV_Keyboard_button MLV_convert_string_to_keyboard_button( const char* key_string ); + +/** \~french + * \brief Renvoie la chaîne de caractères correspondant au code de la touche + * passé en paramètre. + * + * \param key_code Le code de la touche. + * + * \return La chaine de caractères codant le code de la touche. + */ +const char* MLV_convert_keyboard_button_to_string( MLV_Keyboard_button key_code ); + +/** \~french + * \brief Renvoie la chaîne de caractères correspondant au mode du clavier + * passé en paramètre. + * + * \param keymod_code Le code du mode. + * + * \return La chaine de caractères codant le mode du clavier. + */ +char* MLV_convert_keyboard_mod_to_string( MLV_Keyboard_modifier keymod_code ); + + +/** \~french + * + * \brief Renvoie l'état (préssé ou relaché) d'une touche donnée d'un clavier. + * + * \param keyboard_code Le code de la touche dont il faut renvoyer l'état. + * \return L'état de la touche. + */ +MLV_Button_state MLV_get_keyboard_state( MLV_Keyboard_button keyboard_code ); + +/** \~french + * + * \brief Renvoie vrai si le code, passé en paramètre, correspond à l'état appuyé de la touche de combinaison shift du clavier. + * + * \param modifier_code Le code de la touche de combinaison. + * \return Vrai, si la touche de cobinaison shift a été appuyée. + */ +int MLV_shift_key_was_pressed( MLV_Keyboard_modifier modifier_code ); + +/** \~french + * + * \brief Renvoie vrai si le code, passé en paramètre, correspond à l'état appuyé de la touche de combinaison shift gauche du clavier. + * + * \param modifier_code Le code de la touche de combinaison. + * \return Vrai, si la touche de cobinaison shift gauche a été appuyée. + */ +int MLV_left_shift_key_was_pressed( MLV_Keyboard_modifier modifier_code ); + +/** \~french + * + * \brief Renvoie vrai si le code, passé en paramètre, correspond à l'état appuyé de la touche de combinaison shift droit du clavier. + * + * \param modifier_code Le code de la touche de combinaison. + * \return Vrai, si la touche de cobinaison shift droit a été appuyée. + */ +int MLV_right_shift_key_was_pressed( MLV_Keyboard_modifier modifier_code ); + +/** \~french + * + * \brief Renvoie vrai si le code, passé en paramètre, correspond à l'état appuyé de la touche de combinaison ctrl gauche du clavier. + * + * \param modifier_code Le code de la touche de combinaison. + * \return Vrai, si la touche de cobinaison ctrl gauche a été appuyée. + */ +int MLV_left_ctrl_key_was_pressed( MLV_Keyboard_modifier modifier_code ); + +/** \~french + * + * \brief Renvoie vrai si le code, passé en paramètre, correspond à l'état appuyé de la touche de combinaison ctrl droit du clavier. + * + * \param modifier_code Le code de la touche de combinaison. + * \return Vrai, si la touche de cobinaison ctrl droit a été appuyée. + */ +int MLV_right_ctrl_key_was_pressed( MLV_Keyboard_modifier modifier_code ); + +/** \~french + * + * \brief Renvoie vrai si le code, passé en paramètre, correspond à l'état appuyé de la touche de combinaison ctrl du clavier. + * + * \param modifier_code Le code de la touche de combinaison. + * \return Vrai, si la touche de cobinaison ctrl a été appuyée. + */ +int MLV_ctrl_key_was_pressed( MLV_Keyboard_modifier modifier_code ); + +/** \~french + * + * \brief Renvoie vrai si le code, passé en paramètre, correspond à l'état appuyé de la touche de combinaison alt gauche du clavier. + * + * \param modifier_code Le code de la touche de combinaison. + * \return Vrai, si la touche de cobinaison alt gauche a été appuyée. + */ +int MLV_left_alt_key_was_pressed( MLV_Keyboard_modifier modifier_code ); + +/** \~french + * + * \brief Renvoie vrai si le code, passé en paramètre, correspond à l'état appuyé de la touche de combinaison alt droit du clavier. + * + * \param modifier_code Le code de la touche de combinaison. + * \return Vrai, si la touche de cobinaison alt droit a été appuyée. + */ +int MLV_right_alt_key_was_pressed( MLV_Keyboard_modifier modifier_code ); + +/** \~french + * + * \brief Renvoie vrai si le code, passé en paramètre, correspond à l'état appuyé de la touche de combinaison alt du clavier. + * + * \param modifier_code Le code de la touche de combinaison. + * \return Vrai, si la touche de cobinaison alt a été appuyée. + */ +int MLV_alt_key_was_pressed( MLV_Keyboard_modifier modifier_code ); + +/** \~french + * + * \brief Renvoie vrai si le code, passé en paramètre, correspond à l'état appuyé de la touche de combinaison meta gauche du clavier. + * + * \param modifier_code Le code de la touche de combinaison. + * \return Vrai, si la touche de cobinaison meta gauche a été appuyée. + */ +int MLV_left_meta_key_was_pressed( MLV_Keyboard_modifier modifier_code ); + +/** \~french + * + * \brief Renvoie vrai si le code, passé en paramètre, correspond à l'état appuyé de la touche de combinaison meta droit du clavier. + * + * \param modifier_code Le code de la touche de combinaison. + * \return Vrai, si la touche de cobinaison meta droit a été appuyée. + */ +int MLV_right_meta_key_was_pressed( MLV_Keyboard_modifier modifier_code ); + +/** \~french + * + * \brief Renvoie vrai si le code, passé en paramètre, correspond à l'état appuyé de la touche de combinaison meta du clavier. + * + * \param modifier_code Le code de la touche de combinaison. + * \return Vrai, si la touche de cobinaison meta a été appuyée. + */ +int MLV_meta_key_was_pressed( MLV_Keyboard_modifier modifier_code ); + +/** \~french + * + * \brief Renvoie vrai si le code, passé en paramètre, correspond à l'état appuyé de la touche de combinaison num du clavier. + * + * \param modifier_code Le code de la touche de combinaison. + * \return Vrai, si la touche de cobinaison num a été appuyée. + */ +int MLV_num_key_was_pressed( MLV_Keyboard_modifier modifier_code ); + +/** \~french + * + * \brief Renvoie vrai si le code, passé en paramètre, correspond à l'état appuyé de la touche de combinaison cpas du clavier. + * + * \param modifier_code Le code de la touche de combinaison. + * \return Vrai, si la touche de cobinaison caps a été appuyée. + */ +int MLV_caps_key_was_pressed( MLV_Keyboard_modifier modifier_code ); + +/** \~french + * + * \brief Renvoie vrai si le code, passé en paramètre, correspond à l'état appuyé de la touche de combinaison mode du clavier. + * + * \param modifier_code Le code de la touche de combinaison. + * \return Vrai, si la touche de cobinaison mode a été appuyée. + */ +int MLV_mode_key_was_pressed( MLV_Keyboard_modifier modifier_code ); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MLV/MLV_mouse.h b/MLV/MLV_mouse.h new file mode 100644 index 0000000..a8bbb94 --- /dev/null +++ b/MLV/MLV_mouse.h @@ -0,0 +1,127 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_mouse.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit les prototypes des fonctions qui permettent + * d'utiliser la souris. + * + */ + +#ifndef __MLV__MLV_MOUSE_H__ +#define __MLV__MLV_MOUSE_H__ + +#ifndef MEMORY_DEBUG +#include +#else +#include "memory_debug.h" +#endif + +#include "MLV_device_with_buttons.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Énumère les différents bouttons de la souris + * + */ +typedef enum{ + MLV_BUTTON_LEFT = SDL_BUTTON_LEFT, /**< \~french Bouton gauche de la souris */ + MLV_BUTTON_MIDDLE = SDL_BUTTON_MIDDLE, /**< \~french Bouton du milieu de la souris */ + MLV_BUTTON_RIGHT = SDL_BUTTON_RIGHT /**< \~french Bouton droit de la souris */ +} MLV_Mouse_button; + +/** \~french + * + * \brief Suspend l'exécution jusqu'à ce que l'utilisateur clique sur le bouton + * gauche de la souris. + * + * Au moment où l'utilisateur clique, la fonction retourne les + * coordonnées de la position de la souris dans la fenêtre. + * + * \param x Coordonnée en X de la position de la souris dans la fenêtre. + * \param y Coordonnée en Y de la position de la souris dans la fenêtre. + */ +void MLV_wait_mouse(int *x, int *y); + +/** \~french + * + * \brief Suspend l'exécution jusqu'à ce que l'utilisateur clique sur le bouton + * gauche de la souris où jusqu'à ce qu'un nombre de secondes, passé en + * paramètres, se soient écoulées. + * + * Au moment où l'utilisateur clique, la fonction retourne les + * coordonnées de la position de la souris dans la fenêtre. + * + * \param x Coordonnée en X de la position de la souris dans la fenêtre. + * \param y Coordonnée en Y de la position de la souris dans la fenêtre. + * \param seconds Le nombre de second à attendre avant de quitter la fonction. + * \return Renvoie 1 si l'utilisateur a cliqué avec le bouton gauche de la souris, + * et 0 si le temps s'est écoulé. + */ +int MLV_wait_mouse_or_seconds(int *x, int *y, int seconds); + +/** \~french + * \brief Convertit le code associé à un boutton de la souris (MLV_Mouse_button) en + * chaîne de caratères. + * + * \param button_code Le code du bouton. + * \return La chaîne de caratères correspondant au code du boutton de la + * souris passé en paramètre. + */ +const char* MLV_convert_mouse_button_to_string( MLV_Mouse_button button_code ); + +/** \~french + * \brief Convertit une chaîne de caractères en un code bouton. + * + * \param button_string La chaîne de caractères à convertir. + * \return Le code bouton associé à la chaîne de caractères. + */ +MLV_Mouse_button MLV_convert_string_to_mouse_button( const char* button_string ); + +/** \~french + * + * \brief Renvoie la position courante de la souris. + * + * \param x Coordonnée en X de la position de la souris dans la fenêtre. + * \param y Coordonnée en Y de la position de la souris dans la fenêtre. + */ +void MLV_get_mouse_position( int* x, int* y ); + +/** \~french + * + * \brief Renvoie l'état (préssé ou relaché) d'un bouton de la souris. + * + * \param mouse_button Le code du bouton de la souris + * \return L'état du bouton. + */ +MLV_Button_state MLV_get_mouse_button_state( MLV_Mouse_button mouse_button ); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MLV/MLV_path.h b/MLV/MLV_path.h new file mode 100644 index 0000000..54d6b5e --- /dev/null +++ b/MLV/MLV_path.h @@ -0,0 +1,172 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_path.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit les prototypes des fonctions permettant de + * manipuler les chemins d'accès aux fichiers et répertoires. + * + */ + +#ifndef __MLV__MLV_PATH_H__ +#define __MLV__MLV_PATH_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Renvoie la chaîne de caractères après le dernier séparteur / dans un + * chemin donné en paramètre. + * + * La chaîne de caractères doit être désallouée après utilisation. + * + * \param path Le chemin à analyser. + * \return Une chaîne de caractères. + */ +char* MLV_get_base_name( const char* path ); + +/** \~french + * + * \brief Renvoie la chaîne de caractères s'étendant jusqu'au dernier séparateur + * / du chemin donné en paramètre. + * + * La chaîne de caractères doit être désallouée après utilisation. + * + * \param path Le chemin à analyser. + * \return Une chaîne de caractères. + */ +char* MLV_get_directory_name( const char* path ); + +/** \~french + * \brief Teste si un chemin est absolu. + * + * \param path Le chemin + * \return Renvoie 1 si le chemin est absolue, 0 sinon. + */ +int MLV_path_is_absolute( const char* path ); + +/** \~french + * \brief Teste si un chemin est relatif. + * + * \param path Le chemin + * \return Renoie 1 si le chemin est relatif, 0 sinon. + */ +int MLV_path_is_relative( const char* path ); + +/** \~french + * + * \brief Teste si le chemin corespond au chemin d'un fichier ou dossier + * existant. + * + * \param path Le chemin + * \return Renvoie 1 si le chemin est associé à un dossier ou à un fichier + * existant, 0 sinon. + */ +int MLV_path_exists( const char* path ); + +/** \~french + * \brief Vérifie si un chemin est associé à un répertoire. + * + * \param path Le chemin + * \return Renvoie 1 si le chemin est associé à un dossier, 0 sinon. + */ +int MLV_path_is_a_directory( const char* path ); + +/** \~french + * \brief Vérifie si un chemin est associé à un fichier. + * + * \param path Le chemin + * \return Renvoie 1 si le chemin est associé à un fichier, 0 sinon. + */ +int MLV_path_is_a_file( const char* path ); + +/** \~french + * \brief Construit en concaténant différents textes, une chaîne de caractères + * représentant un chemin dont les séparateurs corespondent aux + * spécifications de la plateforme sur laquel s'exécute le programme. + * + * \bug Cette fonction ne fait que concaténer les differentes chaînes en + * mettant entre chaque chaîne un séparateur de répertoire compatible + * avec le système d'exploitation. Par contre, ce qui constitue le bug, il + * ne convertit pas chaque chaîne dans un format compatible avec celui du + * système d'exploitation. + * + * La chaîne de caractères doit être désallouée après utilisation. + * + * \param first_element La première chaîne à concaténer. + * \param ... Les autres éléments à concaténer. + * \return Le chemin vérifiant les normes de la plateforme hôte. + */ +char* MLV_build_path( const char* first_element, ... ); + +/** \~french + * \brief Même chose que MLV_build_path + * + * La chaîne de caractères doit être désallouée après utilisation. + * + * \param elements Les éléments à concaténer ensemble. + * \return Le chemin vérifiant les normes de la plateforme qui va exécuter + * le programme. + */ +char* MLV_build_path_v( char** elements ); + +/** \~french + * \brief Détermine le répertoire courant. + * + * La chaîne de caractères doit être désallouée après utilisation. + * + * \return Le chemin du répertoire courant. + */ +char * MLV_get_current_directory( ); + +/** \~french + * \brief Détermine le répertoire temporaire. + * + * Le répertoire temporaire est le répertoire dans lequel les applications + * ont le droit d'ajouter et de modifier des fichiers. + * Ce répertoire est génaralement vidé lorsque la machine est étteinte. + * + * La chaîne de caractères doit être désallouée après utilisation. + * + * \return Le chemin du répertoire temporaire. + */ +const char * MLV_get_temporary_directory( ); + +/** \~french + * \brief Détermine le répertoire personnel de l'utilisateur courant. + * + * La chaîne de caractères doit être désallouée après utilisation. + * + * \return Le chemin du répertoire personnel. + */ +const char * MLV_get_home_directory( ); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MLV/MLV_playlist.h b/MLV/MLV_playlist.h new file mode 100644 index 0000000..1f0619a --- /dev/null +++ b/MLV/MLV_playlist.h @@ -0,0 +1,58 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#ifndef __MLV__MLV_PLAYLIST_H__ +#define __MLV__MLV_PLAYLIST_H__ + + +#include "MLV_audio.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _MLV_Playlist MLV_Playlist; + +void MLV_init_playlists(); +void MLV_close_playlists(); + +MLV_Playlist* MLV_create_playlist( int loop ); +void MLV_close_playlist( MLV_Playlist* playlist ); + +void MLV_playlist_add( MLV_Playlist* playlist, const char* file_music ); +void MLV_playlist_add_sheet_music( MLV_Playlist* playlist, MLV_Music* ); +void MLV_playlist_remove( MLV_Playlist* playlist, int index ); +void MLV_playlist_clear( MLV_Playlist* playlist ); + +void MLV_playlist_volume( MLV_Playlist* playlist, double volume ); +void MLV_playlist_play( MLV_Playlist* playlist ); +void MLV_playlist_pause( MLV_Playlist* playlist ); +void MLV_playlist_stop( MLV_Playlist* playlist ); +void MLV_playlist_next( MLV_Playlist* playlist ); +void MLV_playlist_previous( MLV_Playlist* playlist ); +void MLV_playlist_first( MLV_Playlist* playlist ); +void MLV_playlist_last( MLV_Playlist* playlist ); +void MLV_playlist_index( MLV_Playlist* playlist, int index); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MLV/MLV_random.h b/MLV/MLV_random.h new file mode 100755 index 0000000..b5b3150 --- /dev/null +++ b/MLV/MLV_random.h @@ -0,0 +1,70 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_random.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit tous les prototypes des fonctions concernant + * la manipulation des nombres aléatoires. + * + */ + +#ifndef __MLV__MLV_RANDOM_H__ +#define __MLV__MLV_RANDOM_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Renvoie 0 ou 1 aléatoirement. + * + * \return 0 ou 1 aléatoirement. + */ +int MLV_get_random_boolean(); + +/** \~french + * \brief Renvoie un entier aléatoire choisi dans un intervalle donné en + * paramètre. + * + * \param begin Borne inférieur de l'intervalle ( inclusif ) + * \param end Borne supérieur de l'intervalle ( inclusif ) + * \return Un entier aléatoire choisi dans l'intervalle [begin, end]. + */ +int MLV_get_random_integer(int begin, int end); + +/** \~french + * \brief Renvoie un réel aléatoire choisi dans un intervalle donné en + * paramètre. + * + * \param begin Borne inférieur de l'intervalle ( inclusif ) + * \param end Borne supérieur de l'intervalle ( inclusif ) + * \return Un réel aléatoire choisi dans l'intervalle [begin, end]. + */ +double MLV_get_random_double(double begin, double end); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MLV/MLV_shape.h b/MLV/MLV_shape.h new file mode 100644 index 0000000..f41f113 --- /dev/null +++ b/MLV/MLV_shape.h @@ -0,0 +1,414 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_shape.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit tout les prototypes des fonctions permettant de + * dessiner des figures. + * + * + */ + +#ifndef __MLV__MLV_FIGURES_H__ +#define __MLV__MLV_FIGURES_H__ + +#include "MLV_color.h" +#include "MLV_image.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Dessine un cercle à une position et un rayon spécifiés en paramètres. + ** + * \param x La coordonnée en X du centre. + * \param y La coordonnée en Y du centre. + * \param radius Le rayon du cercle. + * \param color La couleur du tracé. + */ +void MLV_draw_circle(int x, int y, int radius, MLV_Color color); + +/** \~french + * \brief Dessine un disque plein dont le centre et le rayon sont passés en + * paramètres. + * + * \param x La coordonnée en X du centre. + * \param y La coordonnée en Y du centre. + * \param radius Le rayon du cercle. + * \param color La couleur du tracé. + */ +void MLV_draw_filled_circle(int x, int y, int radius, MLV_Color color); + +/** \~french + * \brief Dessine une ellipse. + * + * \param x La coordonnée en X du centre de l'ellipse. + * \param y La coordonnée en Y du centre de l'ellipse. + * \param radius_x Le rayon en X de l'ellipse. + * \param radius_y Le rayon en Y de l'ellipse. + * \param color La couleur du tracé. + */ +void MLV_draw_ellipse( + int x, int y, int radius_x, int radius_y, MLV_Color color +); + +/** \~french + * \brief Dessine une ellipse pleine. + * + * \param x La coordonnée en X du centre de l'ellipse. + * \param y La coordonnée en Y du centre de l'ellipse. + * \param radius_x Le rayon en X de l'ellipse. + * \param radius_y Le rayon en Y de l'ellipse. + * \param color La couleur du tracé. + */ +void MLV_draw_filled_ellipse( + int x, int y, int radius_x, int radius_y, MLV_Color color +); + +/** \~french + * \brief Dessine un polygone à partir d'une liste de sommets. + * + * \param vx La liste des coordonnées en X des différents sommets du polygone. + * \param vy La liste des coordonnées en Y des différents sommets du polygone. + * \param nb_points Le nombre de sommets du polygone. + * \param color La couleur du tracé. + */ +void MLV_draw_polygon( + const int* vx, const int* vy, int nb_points, MLV_Color color +); + +/** \~french + * \brief Dessine un polygone plein à partir d'une liste de sommets. + * + * \param vx La liste des coordonnées en X des différents sommets du polygone. + * \param vy La liste des coordonnées en Y des différents sommets du polygone. + * \param nb_points Le nombre de sommets du polygone. + * \param color La couleur du tracé. + */ +void MLV_draw_filled_polygon( + const int* vx, const int* vy, int nb_points, MLV_Color color +); + +/** \~french + * \brief Dessine une courbe de Bézier à partir d'une liste de sommets. + * + * \param vx La liste des coordonnées en X des différents sommets de la courbe. + * \param vy La liste des coordonnées en Y des différents sommets de la courbe. + * \param nb_points Le nombre de sommets disponibles pour dessiner la courbe de + * Bézier. + * \param color La couleur du tracé. + */ +void MLV_draw_bezier_curve( + const int* vx, const int* vy, int nb_points, MLV_Color color +); + +/** \~french + * \brief Dessine un polygone plein à partir d'une liste de sommets. + * + * \param vx La liste des coordonnées en X des différents sommets du polygone. + * \param vy La liste des coordonnées en Y des différents sommets du polygone. + * \param nb_points Le nombre de sommets du polygone. + * \param color La couleur du tracé. + */ +void MLV_draw_filled_polygon( + const int* vx, const int* vy, int nb_points, MLV_Color color +); + +/** \~french + * \brief Dessine un rectangle dont la taille, la couleur et la position du + * sommet Nord-Ouest sont données en paramètres. + * + * \param x La coordonnée en X du sommet Nord-Ouest du rectangle. + * \param y La coordonnée en Y du sommet Nord-Ouest du rectangle. + * \param width La largeur du rectangle. + * \param height La hauteur du rectangle. + * \param color La couleur du tracé. + */ +void MLV_draw_rectangle(int x, int y, int width, int height, MLV_Color color); + +/** \~french + * \brief Dessine un rectangle dont la taille, la couleur et la position du + * sommet Nord-Ouest sont données en paramètres. + * + * \param x La coordonnée en X du sommet Nord-Ouest du rectangle. + * \param y La coordonnée en Y du sommet Nord-Ouest du rectangle. + * \param width La largeur du rectangle. + * \param height La hauteur du rectangle. + * \param color La couleur du tracé. + */ +void MLV_draw_rectangle(int x, int y, int width, int height, MLV_Color color); + +/** \~french + * \brief Dessine un rectangle plein dont la taille, la couleur et la position + * du sommet Nord-Ouest sont données en paramètres. + * + * \param x La coordonnée en X du sommet Nord-Ouest du rectangle. + * \param y La coordonnée en Y du sommet Nord-Ouest du rectangle. + * \param width La largeur du rectangle. + * \param height La hauteur du rectangle. + * \param color La couleur du tracé. + */ +void MLV_draw_filled_rectangle( + int x, int y, int width, int height, MLV_Color color +); + +/** \~french + * \brief Dessine une ligne. + * + * \param x1 La coordonnée en X de la première extrémité de la ligne. + * \param y1 La coordonnée en Y de la première extrémité de la ligne. + * \param x2 La coordonnée en X de la deuxième extrémité de la ligne. + * \param y2 La coordonnée en Y de la deuxième extrémité de la ligne. + * \param color La couleur du tracé. + */ +void MLV_draw_line(int x1, int y1, int x2, int y2, MLV_Color color); + +/** \~french + * \brief Dessine un pixel dont les coordonnées sont passées en paramètres. + * + * \param x La coordonnée en X du pixel. + * \param y La coordonnée en Y du pixel. + * \param color La couleur du tracé. + */ +void MLV_draw_pixel(int x, int y, MLV_Color color); + +/** \~french + * \brief Dessine un point dont les coordonnées sont passées en paramètres. + * Cette fonction est identique à MLV_draw_pixel. + * + * \param x La coordonnée en X du point. + * \param y La coordonnée en Y du point. + * \param color La couleur du tracé. + */ +void MLV_draw_point(int x, int y, MLV_Color color); + + + + + + +/////////////////////////////////////////////////////////////////////////////// +// Drawing operation on images // +/////////////////////////////////////////////////////////////////////////////// + +/** \~french + * \brief Dessine un cercle à une position et un rayon spécifiés en paramètres + * dans une image. + * + * \param x La coordonnée en X du centre. + * \param y La coordonnée en Y du centre. + * \param radius Le rayon du cercle. + * \param color La couleur du tracé. + * \param image L'image dans laquelle la figure est dessinée. + */ +void MLV_draw_circle_on_image( + int x, int y, int radius, MLV_Color color, MLV_Image* image +); + +/** \~french + * \brief Dessine un disque plein dont le centre et le rayon sont passés en + * parametres dans une image. + * + * \param x La coordonnée en X du centre. + * \param y La coordonnée en Y du centre. + * \param radius Le rayon du cercle. + * \param color La couleur du tracé. + * \param image L'image dans laquelle la figure est dessinée. + */ +void MLV_draw_filled_circle_on_image( + int x, int y, int radius, MLV_Color color, MLV_Image* image +); + +/** \~french + * \brief Dessine une ellipse dans une image. + * + * \param x La coordonnée en X du centre de l'ellipse. + * \param y La coordonnée en Y du centre de l'ellipse. + * \param radius_x Le rayon en X de l'ellipse. + * \param radius_y Le rayon en Y de l'ellipse. + * \param color La couleur du tracé. + * \param image L'image dans laquelle la figure est dessinée. + */ +void MLV_draw_ellipse_on_image( + int x, int y, int radius_x, int radius_y, MLV_Color color, MLV_Image* image +); + +/** \~french + * \brief Dessine une ellipse pleine dans une image. + * + * \param x La coordonnée en X du centre de l'ellipse. + * \param y La coordonnée en Y du centre de l'ellipse. + * \param radius_x Le rayon en X de l'ellipse. + * \param radius_y Le rayon en Y de l'ellipse. + * \param color La couleur du tracé. + * \param image L'image dans laquelle la figure est dessinée. + */ +void MLV_draw_filled_ellipse_on_image( + int x, int y, int radius_x, int radius_y, MLV_Color color, MLV_Image* image +); + +/** \~french + * \brief Dessine un polygone à partir d'une liste de sommets dans une image. + * + * \param vx La liste des coordonnées en X des différents sommets du polygone. + * \param vy La liste des coordonnées en Y des différents sommets du polygone. + * \param nb_points Le nombre de sommets du polygone. + * \param color La couleur du tracé. + * \param image L'image dans laquelle la figure est dessinée. + */ +void MLV_draw_polygon_on_image( + const int* vx, const int* vy, int nb_points, MLV_Color color, MLV_Image* image +); + +/** \~french + * \brief Dessine un polygone plein à partir d'une liste de sommets dans une + * image. + * + * \param vx La liste des coordonnées en X des différents sommets du polygone. + * \param vy La liste des coordonnées en Y des différents sommets du polygone. + * \param nb_points Le nombre de sommets du polygone. + * \param color La couleur du tracé. + * \param image L'image dans laquelle la figure est dessinée. + */ +void MLV_draw_filled_polygon_on_image( + const int* vx, const int* vy, int nb_points, MLV_Color color, MLV_Image* image +); + +/** \~french + * \brief Dessine une courbe de Bézier à partir d'une liste de sommets dans une + * image. + * + * \param vx La liste des coordonnées en X des différents sommets de la courbe. + * \param vy La liste des coordonnées en Y des différents sommets de la courbe. + * \param nb_points Le nombre de sommets disponibles pour dessiner la courbe de + * Bézier. + * \param color La couleur du tracé. + * \param image image dans laquelle la figure est dessinée + */ +void MLV_draw_bezier_curve_on_image( + const int* vx, const int* vy, int nb_points, MLV_Color color, MLV_Image* image +); + +/** \~french + * \brief Dessine un polygone plein à partir d'une liste de sommets dans une + * image. + * + * \param vx La liste des coordonnées en X des différents sommets du polygone. + * \param vy La liste des coordonnées en Y des différents sommets du polygone. + * \param nb_points Le nombre de sommets du polygone. + * \param color La couleur du tracé. + * \param image L'image dans laquelle la figure est dessinée + */ +void MLV_draw_filled_polygon_on_image( + const int* vx, const int* vy, int nb_points, MLV_Color color, MLV_Image* image +); + +/** \~french + * \brief Dessine un rectangle dont la taille, la couleur et la position du + * sommet Nord-Ouest sont données en paramètres dans une image. + * + * \param x La coordonnée en X du sommet Nord-Ouest du rectangle. + * \param y La coordonnée en Y du sommet Nord-Ouest du rectangle. + * \param width La largeur du rectangle. + * \param height La hauteur du rectangle. + * \param color La couleur du rectangle. + * \param image L'image dans laquelle la figure est dessinée . + */ +void MLV_draw_rectangle_on_image( + int x, int y, int width, int height, MLV_Color color, MLV_Image* image +); + +/** \~french + * \brief Dessine un rectangle dont la taille, la couleur et la position du + * sommet Nord-Ouest sont données en paramètres dans une image. + * + * \param x La coordonnée en X du sommet Nord-Ouest du rectangle. + * \param y La coordonnée en Y du sommet Nord-Ouest du rectangle. + * \param width La largeur du rectangle. + * \param height La hauteur du rectangle. + * \param color La couleur du rectangle. + * \param image L'image dans laquelle la figure est dessinée. + */ +void MLV_draw_rectangle_on_image( + int x, int y, int width, int height, MLV_Color color, MLV_Image* image +); + +/** \~french + * \brief Dessine un rectangle plein dont la taille, la couleur et la position + * du sommet Nord-Ouest sont données en paramètres dans une image. + * + * \param x La coordonnée en X du sommet Nord-Ouest du rectangle. + * \param y La coordonnée en Y du sommet Nord-Ouest du rectangle. + * \param width La largeur du rectangle. + * \param height La hauteur du rectangle. + * \param color La couleur du rectangle. + * \param image L'image dans laquelle la figure est dessinée. + */ +void MLV_draw_filled_rectangle_on_image( + int x, int y, int width, int height, MLV_Color color, MLV_Image* image +); + +/** \~french + * \brief Dessine une ligne dans une image. + * + * \param x1 La coordonnée en X de la première extrémité de la ligne. + * \param y1 La coordonnée en Y de la première extrémité de la ligne. + * \param x2 La coordonnée en X de la deuxième extrémité de la ligne. + * \param y2 La coordonnée en Y de la deuxième extrémité de la ligne. + * \param color La couleur du tracé. + * \param image L'image dans laquelle la figure est dessinée. + */ +void MLV_draw_line_on_image( + int x1, int y1, int x2, int y2, MLV_Color color, MLV_Image* image +); + +/** \~french + * \brief Dessine un pixel dont les coordonnées sont passées en paramètres dans + * une image. + * + * \param x Coordonnée en X du pixel + * \param y Coordonnée en Y du pixel + * \param color Couleur du tracé + * \param image image dans laquelle la figure est dessinée + */ +void MLV_draw_pixel_on_image(int x, int y, MLV_Color color, MLV_Image* image); + +/** \~french + * \brief Dessine un point dont les coordonnées sont passées en paramètres. + * Cette fonction est identique à MLV_draw_pixel dans une image. + * + * \param x La coordonnée en X du point. + * \param y La coordonnée en Y du point. + * \param color La couleur du tracé. + * \param image L'image dans laquelle la figure est dessinée. + */ +void MLV_draw_point_on_image(int x, int y, MLV_Color color, MLV_Image* image); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MLV/MLV_text.h b/MLV/MLV_text.h new file mode 100644 index 0000000..a23c471 --- /dev/null +++ b/MLV/MLV_text.h @@ -0,0 +1,489 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_text.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit les différents prototypes des fonctions permmettant + * d'afficher du texte et des boîtes de dialogues. + */ + +#ifndef __MLV__MLV_TEXT_H__ +#define __MLV__MLV_TEXT_H__ + +#include "MLV_color.h" +#include "MLV_image.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Énumère les différents types de justification du texte. + */ +typedef enum { + MLV_TEXT_CENTER, /**< \~french Le texte est justifié au centre. */ + MLV_TEXT_LEFT, /**< \~french Le texte est justifié sur la gauche. */ + MLV_TEXT_RIGHT /**< \~french Le texte est justifié sur la doite. */ +} MLV_Text_justification; + +/** \~french + * \brief Énumère les différents types de position horizontale du texte dans une boîte. + */ +typedef enum { + MLV_HORIZONTAL_CENTER, /**< \~french Le texte est centrée horizontalement + * dans la boîte. */ + MLV_HORIZONTAL_LEFT, /**< \~french Le texte est positioné sur la droite de + * la boîte. */ + MLV_HORIZONTAL_RIGHT /**< \~french Le texte est positioné sur la gauche de + * la boîte. */ +} MLV_Horizontal_position; + +/** \~french + * \brief Énumère les différents types de positions verticales du texte dans une boîte. + */ +typedef enum { + MLV_VERTICAL_CENTER, /**< \~french Le texte est centré horizonatalement + * dans la boîte. */ + MLV_VERTICAL_TOP, /**< \~french Le texte est positionné en haut de la + * boîte. */ + MLV_VERTICAL_BOTTOM /**< \~french Le texte est positionné en bas de la + * boîte. */ +} MLV_Vertical_position; + +/** \~french + * Ce type code une fonte de caractères. + */ +typedef struct _MLV_Font MLV_Font; + +/** \~french + * \brief Cette fonction charge en mémoire une fonte de caractères de standard + * "TrueType" (fichiers ayant une extension .ttf). + * + * La fonte de caractères chargée est configurée avec une taille de fonte + * donnée en paramètre. + * + * \param file_font Le chemin d'accés où se trouve le fichier contenant la + * fonte de caractères. + * \param size La taille de la fonte de caractères. + * \return La structure de donnée MLV contenant la fonte de caractères. + */ +MLV_Font* MLV_load_font( const char* file_font, int size ); + +/** \~french + * \brief Cette fonction libère la mémoire d'une fonte de caractères + * précédement chargée. + * + * \param font L'adresse de la fonte de caractères à libérer. + */ +void MLV_free_font( MLV_Font* font ); + +/** \~french + * \brief Cette fonction calcule la taille du texte qui sera affiché sur + * l'écran à l'aide de la fonction MLV_draw_text(). + * + * \param text Le texte qui doit être affiché. + * \param width La largeur du texte. + * \param height La hauteur du texte. + */ +void MLV_get_size_of_text( const char *text, int *width, int *height, ... ); + +/** \~french + * \brief Cette fonction calcule la taille du texte qui sera affiché sur + * l'écran à l'aide de la fonction MLV_draw_text_with_font(). + * + * \param text Le texte qui doit être affiché. + * \param width La largeur du texte. + * \param height La hauteur du texte. + * \param font La fonte de caractères utilisée pour afficher le texte. + */ +void MLV_get_size_of_text_with_font( + const char *text, int *width, int *height, const MLV_Font* font, ... +); + +/** \~french + * \brief Imprime un texte donné à une position et une couleur données. + * + * Le texte est imprimé à l'aide de la fonte de caractères par default de la + * bibliothèque MLV. + * + * \param x Coordonnée en X du coin Nord-Ouest du texte + * \param y Coordonnée en Y du coin Nord-Ouest du texte + * \param text texte à afficher + * \param color couleur du tracé + */ +void MLV_draw_text( int x, int y, const char *text, MLV_Color color, ... ); + +/** \~french + * \brief Écrit du texte sur l'écran en utilisant une couleur et une fonte de + * caractères données en paramètres. + * + * \param x La coordonnée en X du coin Nord-Ouest du texte. + * \param y La coordonnée en Y du coin Nord-Ouest du texte. + * \param text Le texte à afficher. + * \param color La couleur du tracé. + * \param font La fonte de caractères utilisée pour dessiner le texte. + */ +void MLV_draw_text_with_font( + int x, int y, const char *text, const MLV_Font* font, MLV_Color color, ... +); + +/** \~french + * \brief Écrit sur une image un texte donné à une position et une couleur + * données. + * + * Le texte est imprimé à l'aide de la fonte de caractères par default de la + * bibliothèque MLV. + * + * \param x La coordonnée en X du coin Nord-Ouest du texte. + * \param y La coordonnée en Y du coin Nord-Ouest du texte. + * \param text Le texte à afficher. + * \param color La couleur du tracé. + * \param image L'image sur laquel le texte doit être ecrit. + */ +void MLV_draw_text_on_image( + int x, int y, const char *text, MLV_Color color, MLV_Image* image, ... +); + +/** \~french + * \brief Écrit du texte sur une image en utilisant une couleur et une fonte de + * caractères données en paramètres. + * + * \param x La coordonnée en X du coin Nord-Ouest du texte. + * \param y La coordonnée en Y du coin Nord-Ouest du texte. + * \param text Le texte à afficher. + * \param color La couleur du tracé. + * \param font La fonte de caractères utilisée pour dessiner le texte. + * \param image L'image sur laquel le texte doit être ecrit. + */ +void MLV_draw_text_with_font_on_image( + int x, int y, const char *text, const MLV_Font* font, MLV_Color color, + MLV_Image* image, ... +); + +/** \~french + * \brief Dessine une boîte contenant du texte. + * + * La taille de la boîte dessinée s'adapte à la + * taille du texte. + * Les différentes couleurs de la boîte et du texte, + * ainsi que la taille de l'interligne du texte sont + * paramétrables. + * + * Il est possible de préciser la justification du texte à l'aide du + * paramètre "text_justification". + * + * \param x La coordonnée en X de la position du coin Nord-Ouest de la boîte. + * \param y La coordonnée en Y de la position du coin Nord-Ouest de la boîte. + * \param message Le texte à afficher. + * \param borderColor La couleur des bordures. + * \param sizeInterligne La taille de l'interligne. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond de la boîte. + * \param text_justification La justification du texte. + */ +void MLV_draw_adapted_text_box( + int x, int y, + const char* message, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, ... +); + +/** \~french + * \brief Même chose que MLV_draw_adapted_text_box() mis à part que le texte est + * rendu avec une fonte de caractères donnée en paramètre. + * + * \param x La coordonnée en X de la position du coin Nord-Ouest de la boîte. + * \param y La coordonnée en Y de la position du coin Nord-Ouest de la boîte. + * \param message Le texte à afficher. + * \param borderColor La couleur des bordures. + * \param sizeInterligne La taille de l'interligne. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond de la boîte. + * \param text_justification La justification du texte. + * \param image L'image sur laquel le texte doit être ecrit. + */ +void MLV_draw_adapted_text_box_on_image( + int x, int y, + const char* message, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Image* image, ... +); + +/** \~french + * \brief Cette fonction calcule la taille de la boîte de texte qui serait + * obtenue si vous utilisez la fonction : MLV_draw_adapted_text_box(). + * + * \param message Le texte qui sera affiché lorsque vous utiliserez + * MLV_draw_adapted_text_box(). + * \param sizeInterligne La taille de l'interligne. + * \param result_width La largeur de la boîte que vous obtiendrez en + * utilisant MLV_draw_adapted_text_box(). + * \param result_height La hauteur de la boîte que vous obtiendrez en + * utilisant MLV_draw_adapted_text_box(). + * + * \return La fonction renvoie la taille de la boîte de texte. + */ +int MLV_get_size_of_adapted_text_box( + const char* message, + int sizeInterligne, + int *result_width, int *result_height, + ... +); + +/** \~french + * \brief Même chose que MLV_draw_adapted_text_box() mis à part que le texte est + * rendu avec une fonte de caractères donnée en paramètre. + * + * \param x La coordonnée en X de la position du coin Nord-Ouest de la boîte. + * \param y La coordonnée en Y de la position du coin Nord-Ouest de la boîte. + * \param message Le texte à afficher. + * \param font La fonte de caractères utilisée pour dessiner le texte. + * \param borderColor La couleur des bordures. + * \param sizeInterligne La taille de l'interligne. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond de la boîte. + * \param text_justification La justification du texte. + */ +void MLV_draw_adapted_text_box_with_font( + int x, int y, + const char* message, + const MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, ... +); + +/** \~french + * \brief Même chose que MLV_draw_adapted_text_box_with_font() mis à part que + * le texte est rendu sur une image et non directement à l'écran. + * + * \param x La coordonnée en X de la position du coin Nord-Ouest de la boîte. + * \param y La coordonnée en Y de la position du coin Nord-Ouest de la boîte. + * \param message Le texte à afficher. + * \param font La fonte de caractères utilisée pour dessiner le texte. + * \param borderColor La couleur des bordures. + * \param sizeInterligne Le taille de l'interligne. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond de la boîte. + * \param text_justification La justification du texte. + * \param image L'image sur laquel le texte doit être ecrit. + */ +void MLV_draw_adapted_text_box_with_font_on_image( + int x, int y, + const char* message, + const MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Image* image, ... +); + + +/** \~french + * \brief Cette fonction calcule la taille de la boîte de texte qui serait + * obtenue si vous utilisez la fonction : + * MLV_draw_adapted_text_box_with_font(). + * + * \param message Le texte qui sera affiché lorsque vous utiliserez + * MLV_draw_adapted_text_box_with_font(). + * \param font La fonte de caractères utilisée pour dessiner le texte. + * \param sizeInterligne La taille de l'interligne. + * \param result_width La largeur de la boîte que vous obtiendrez en utilisant + * MLV_draw_adapted_text_box_with_font(). + * \param result_height La hauteur de la boîte que vous obtiendrez en utilisant + * MLV_draw_adapted_text_box_with_font(). + * + * \return La fonction renvoie la taille de la boîte de texte. + */ +int MLV_get_size_of_adapted_text_box_with_font( + const char* message, + const MLV_Font* font, + int sizeInterligne, + int *result_width, int *result_height, + ... +); + +/** \~french + * \brief Dessine une boîte de taille donnée par l'utilisateur et contenant un + * texte donné par l'utilisateur. + * +* Le texte est déssiné à l'interieur d'une boîte. Le texte est imprimé sur +* plusieurs lignes en respectant les retours à la ligne présents dans le texte. + * + * Les différentes couleurs de la boîte et du texte, ainsi que la taille de + * l'interligne du texte sont paramétrables. + * + * Il est possible de préciser la justification du texte contenu dans la boîte. + * + * De même , il est possible de préciser la position du texte à l'intérieur de + * la boîte. + * + * Cette fonction ne remet pas en forme le texte. Cela veux dire que si le texte + * est trop grand, alors il dépassera de la boîte et les parties qui depassent + * ne seront pas affichées. + * + * \param x La coordonnée en X de la position du coin Nord-Ouest de la boîte. + * \param y La coordonnée en Y de la position du coin Nord-Ouest de la boîte. + * \param width La largeur de la boîte. + * \param height La hauteur de la boîte. + * \param message Le texte à afficher. + * \param sizeInterligne La taille de l'interligne. + * \param borderColor La couleur des bordures. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond de la boîte. + * \param text_justification La justification du texte. + * \param horizontal_position La position horizontale du texte dans la boîte. + * \param vertical_position La position verticale du texte dans la boîte. + */ +void MLV_draw_text_box( + int x, int y, + int width, int height, + const char* message , + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + ... +); + +/** \~french + * \brief Même chose que MLV_draw_text_box() mis à part que le texte n'est pas + * écrit directement sur l'écran, mais sur une image à la place. + * + * \param x La coordonnée en X de la position du coin Nord-Ouest de la boîte. + * \param y La coordonnée en Y de la position du coin Nord-Ouest de la boîte. + * \param width La largeur de la boîte. + * \param height La hauteur de la boîte. + * \param message Le texte à afficher. + * \param sizeInterligne La taille de l'interligne. + * \param borderColor La couleur des bordures. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond de la boîte. + * \param text_justification La justification du texte. + * \param horizontal_position La position horizontale du texte dans la boîte. + * \param vertical_position La position verticale du texte dans la boîte. + * \param image L'image sur laquel le texte doit être ecrit. + */ +void MLV_draw_text_box_on_image( + int x, int y, + int width, int height, + const char* message , + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + MLV_Image* image, + ... +); + +/** \~french + * \brief Même chose que la fonction MLV_draw_text_box() mis à part que le texte + * est rendu avec une fonte de caractères donnée en paramètre par + * l'utilisateur. + * + * \param x La coordonnée en X de la position du coin Nord-Ouest de la boîte. + * \param y La coordonnée en Y de la position du coin Nord-Ouest de la boîte. + * \param width La largeur de la boîte. + * \param height La hauteur de la boîte. + * \param message Le texte à afficher. + * \param font La fonte de caractères utilisée pour dessiner le texte. + * \param sizeInterligne La taille de l'interligne. + * \param borderColor La couleur des bordures. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond de la boîte. + * \param text_justification La justification du texte. + * \param horizontal_position La position horizontale du texte dans la boîte. + * \param vertical_position La position verticale du texte dans la boîte. + */ +void MLV_draw_text_box_with_font( + int x, int y, + int width, int height, + const char* message , + const MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + ... +); + +/** \~french + * \brief Même chose que la fonction MLV_draw_text_box_with_font() mis à part que + * le texte n'est pas dessinné directement sur l'ecran, mais sur une + * une image. + * + * \param x La coordonnée en X de la position du coin Nord-Ouest de la boîte. + * \param y La coordonnée en Y de la position du coin Nord-Ouest de la boîte. + * \param width La largeur de la boîte. + * \param height La hauteur de la boîte. + * \param message Le texte à afficher. + * \param font La fonte caractères utilisée pour dessiner le texte. + * \param sizeInterligne La taille de l'interligne. + * \param borderColor La couleur des bordures. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond de la boîte. + * \param text_justification La justification du texte. + * \param horizontal_position La position horizontale du texte dans la boîte. + * \param vertical_position La position verticale du texte dans la boîte. + * \param image L'image sur laquel le texte doit être ecrit. + */ +void MLV_draw_text_box_with_font_on_image( + int x, int y, + int width, int height, + const char* message , + MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + MLV_Image* image, + ... +); + +/** \~french + * \brief Transforme un caractère en format unicode en chaîne de caractères + * compatible avec le codage local (codage utilisé par la machine qui + * exécute le programme). + * + * Après utilisation, vous devez libérer l'espace mémoire de la chaîne de + * caractères renvoyée par la fonction. + * + * \param unicode Le caractère en format unicode. + * \return Un pointeur vers une nouvelle chaîne de caractères. + */ +char* MLV_convert_unicode_to_string( int unicode ); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/MLV/MLV_text_va.h b/MLV/MLV_text_va.h new file mode 100644 index 0000000..9eb2fce --- /dev/null +++ b/MLV/MLV_text_va.h @@ -0,0 +1,516 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2013-2014 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_text_va.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit différents prototypes des fonctions permmettant + * d'afficher du texte et des boîtes de dialogues. + */ + +#ifndef __MLV__MLV_TEXT_VA_H__ +#define __MLV__MLV_TEXT_VA_H__ + +#include "MLV_color.h" +#include "MLV_image.h" +#include "MLV_text.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Imprime un texte donné à une position et une couleur données. + * + * Cette fonction est équivalente à la fonction MLV_draw_text() à l'exception + * qu'elle est apellée avec un paramètre de type va_list à la place d'une + * nombre variable d'arguments. + * + * Pour plus de détail sur la fonction, aller voir la documentation de + * MLV_draw_text() + * + * \param x Coordonnée en X du coin Nord-Ouest du texte + * \param y Coordonnée en Y du coin Nord-Ouest du texte + * \param text texte à afficher + * \param color couleur du tracé + * \param pile Une liste d'arguments supplémentaires + */ +void MLV_draw_text_va( + int x, int y, const char *text, MLV_Color color, va_list pile +); + + +/** \~french + * \brief Écrit du texte sur l'écran en utilisant une couleur et une fonte de + * caractères données en paramètres. + * + * Cette fonction est équivalente à la fonction MLV_draw_text_wih_font() à + * l'exception qu'elle est apellée avec un paramètre de type va_list à la + * place d'une nombre variable d'arguments. + * + * Pour plus de détail sur la fonction, aller voir la documentation de + * MLV_draw_text_with_font() + * + * \param x La coordonnée en X du coin Nord-Ouest du texte. + * \param y La coordonnée en Y du coin Nord-Ouest du texte. + * \param text Le texte à afficher. + * \param color La couleur du tracé. + * \param font La fonte de caractères utilisée pour dessiner le texte. + * \param pile Une liste d'arguments supplémentaires + */ +void MLV_draw_text_with_font_va( + int x, int y, const char *text, const MLV_Font* font, MLV_Color color, + va_list pile +); + +/** \~french + * \brief Écrit du texte sur une image en utilisant une couleur et une fonte de + * caractères données en paramètres. + * + * Cette fonction est équivalente à la fonction + * MLV_draw_text_with_font_on_image() à l'exception qu'elle est apellée + * avec un paramètre de type va_list à la place d'une nombre variable + * d'arguments. + * + * Pour plus de détail sur la fonction, aller voir la documentation de + * MLV_draw_text_with_font_on_image() + * + * \param x La coordonnée en X du coin Nord-Ouest du texte. + * \param y La coordonnée en Y du coin Nord-Ouest du texte. + * \param text Le texte à afficher. + * \param font La fonte de caractères utilisée pour dessiner le texte. + * \param color La couleur du tracé. + * \param image L'image sur laquel le texte doit être ecrit. + * \param pile Une liste d'arguments supplémentaires + */ +void MLV_draw_text_with_font_on_image_va( + int x, int y, const char *text, const MLV_Font* font, MLV_Color color, + MLV_Image* image, va_list pile +); + +/** \~french + * \brief Cette fonction calcule la taille du texte qui sera affiché sur + * l'écran à l'aide de la fonction MLV_draw_text(). + * + * Cette fonction est équivalente à la fonction + * MLV_get_size_of_text() à l'exception qu'elle est apellée + * avec un paramètre de type va_list à la place d'une nombre variable + * d'arguments. + * + * Pour plus de détail sur la fonction, aller voir la documentation de + * MLV_get_size_of_text() + * + * \param text Le texte qui doit être affiché. + * \param width La largeur du texte. + * \param height La hauteur du texte. + * \param pile Une liste d'arguments supplémentaires + */ +void MLV_get_size_of_text_va( + const char *text, int *width, int *height, va_list pile +); + +/** \~french + * \brief Cette fonction calcule la taille du texte qui sera affiché sur + * l'écran à l'aide de la fonction MLV_draw_text_with_font(). + * + * Cette fonction est équivalente à la fonction + * MLV_get_size_of_text_with_font() à l'exception qu'elle est apellée + * avec un paramètre de type va_list à la place d'une nombre variable + * d'arguments. + * + * Pour plus de détail sur la fonction, aller voir la documentation de + * MLV_get_size_of_text_with_font() + * + * \param text Le texte qui doit être affiché. + * \param width La largeur du texte. + * \param height La hauteur du texte. + * \param font La fonte de caractères utilisée pour afficher le texte. + * \param pile Une liste d'arguments supplémentaires + */ +void MLV_get_size_of_text_with_font_va( + const char *text, int *width, int *height, const MLV_Font* font, + va_list pile +); + + +/** \~french + * \brief Même chose que MLV_draw_adapted_text_box() mis à part que le texte est + * rendu avec une fonte de caractères donnée en paramètre. + * + * Cette fonction est équivalente à la fonction + * MLV_draw_adapted_text_box_with_font() à l'exception qu'elle est apellée + * avec un paramètre de type va_list à la place d'une nombre variable + * d'arguments. + * + * Pour plus de détail sur la fonction, aller voir la documentation de + * MLV_draw_adapted_text_box_with_font() + * + * \param x La coordonnée en X de la position du coin Nord-Ouest de la boîte. + * \param y La coordonnée en Y de la position du coin Nord-Ouest de la boîte. + * \param message Le texte à afficher. + * \param font La fonte de caractères utilisée pour dessiner le texte. + * \param borderColor La couleur des bordures. + * \param sizeInterligne La taille de l'interligne. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond de la boîte. + * \param text_justification La justification du texte. + * \param pile Une liste d'arguments supplémentaires + */ +void MLV_draw_adapted_text_box_with_font_va( + int x, int y, + const char* message, + const MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + va_list pile +); + +/** \~french + * \brief Dessine une boîte contenant du texte. + * + * Cette fonction est équivalente à la fonction + * MLV_draw_adapted_text_box() à l'exception qu'elle est apellée + * avec un paramètre de type va_list à la place d'une nombre variable + * d'arguments. + * + * Pour plus de détail sur la fonction, aller voir la documentation de + * MLV_draw_adapted_text_box() + * + * \param x La coordonnée en X de la position du coin Nord-Ouest de la boîte. + * \param y La coordonnée en Y de la position du coin Nord-Ouest de la boîte. + * \param message Le texte à afficher. + * \param borderColor La couleur des bordures. + * \param sizeInterligne La taille de l'interligne. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond de la boîte. + * \param text_justification La justification du texte. + * \param pile Une liste d'arguments supplémentaires + */ +void MLV_draw_adapted_text_box_va( + int x, int y, + const char* message, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, va_list pile +); + +/** \~french + * \brief Même chose que MLV_draw_adapted_text_box() mis à part que le texte est + * rendu avec une fonte de caractères donnée en paramètre. + * + * Cette fonction est équivalente à la fonction + * MLV_draw_adapted_text_box_on_image() à l'exception qu'elle est apellée + * avec un paramètre de type va_list à la place d'une nombre variable + * d'arguments. + * + * Pour plus de détail sur la fonction, aller voir la documentation de + * MLV_draw_adapted_text_box_on_image() + * + * \param x La coordonnée en X de la position du coin Nord-Ouest de la boîte. + * \param y La coordonnée en Y de la position du coin Nord-Ouest de la boîte. + * \param message Le texte à afficher. + * \param borderColor La couleur des bordures. + * \param sizeInterligne La taille de l'interligne. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond de la boîte. + * \param text_justification La justification du texte. + * \param image L'image sur laquel le texte doit être ecrit. + * \param pile Une liste d'arguments supplémentaires + */ +void MLV_draw_adapted_text_box_on_image_va( + int x, int y, + const char* message, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Image* image, va_list pile +); + +/** \~french + * \brief Même chose que MLV_draw_adapted_text_box_with_font() mis à part que + * le texte est rendu sur une image et non directement à l'écran. + * + * Cette fonction est équivalente à la fonction + * MLV_draw_adapted_text_box_with_font_on_image() à l'exception qu'elle est + * apellée avec un paramètre de type va_list à la place d'une nombre variable + * d'arguments. + * + * Pour plus de détail sur la fonction, aller voir la documentation de + * MLV_draw_adapted_text_box_with_font_on_image() + * + * \param x La coordonnée en X de la position du coin Nord-Ouest de la boîte. + * \param y La coordonnée en Y de la position du coin Nord-Ouest de la boîte. + * \param message Le texte à afficher. + * \param font La fonte de caractères utilisée pour dessiner le texte. + * \param borderColor La couleur des bordures. + * \param sizeInterligne Le taille de l'interligne. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond de la boîte. + * \param text_justification La justification du texte. + * \param image L'image sur laquel le texte doit être ecrit. + * \param pile Une liste d'arguments supplémentaires + */ +void MLV_draw_adapted_text_box_with_font_on_image_va( + int x, int y, + const char* message, + const MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Image* image, va_list pile +); + +/** \~french + * \brief Cette fonction calcule la taille de la boîte de texte qui serait + * obtenue si vous utilisez la fonction : MLV_draw_adapted_text_box(). + * + * Cette fonction est équivalente à la fonction + * MLV_get_size_of_adapted_text_box() à l'exception qu'elle est + * apellée avec un paramètre de type va_list à la place d'une nombre variable + * d'arguments. + * + * Pour plus de détail sur la fonction, aller voir la documentation de + * MLV_get_size_of_adapted_text_box() + * + * \param message Le texte qui sera affiché lorsque vous utiliserez + * MLV_draw_adapted_text_box(). + * \param sizeInterligne La taille de l'interligne. + * \param result_width La largeur de la boîte que vous obtiendrez en + * utilisant MLV_draw_adapted_text_box(). + * \param result_height La hauteur de la boîte que vous obtiendrez en + * utilisant MLV_draw_adapted_text_box(). + * \param pile Une liste d'arguments supplémentaires + * + * \return La fonction renvoie la taille de la boîte de texte. + */ +int MLV_get_size_of_adapted_text_box_va( + const char* message, + int sizeInterligne, + int *result_width, int *result_height, + va_list pile +); + +/** \~french + * \brief Cette fonction calcule la taille de la boîte de texte qui serait + * obtenue si vous utilisez la fonction : + * MLV_draw_adapted_text_box_with_font(). + * + * Cette fonction est équivalente à la fonction + * MLV_get_size_of_adapted_text_box_with_font() à l'exception qu'elle est + * apellée avec un paramètre de type va_list à la place d'une nombre variable + * d'arguments. + * + * Pour plus de détail sur la fonction, aller voir la documentation de + * MLV_get_size_of_adapted_text_box_with_font() + * + * \param message Le texte qui sera affiché lorsque vous utiliserez + * MLV_draw_adapted_text_box_with_font(). + * \param font La fonte de caractères utilisée pour dessiner le texte. + * \param sizeInterligne La taille de l'interligne. + * \param result_width La largeur de la boîte que vous obtiendrez en utilisant + * MLV_draw_adapted_text_box_with_font(). + * \param result_height La hauteur de la boîte que vous obtiendrez en utilisant + * MLV_draw_adapted_text_box_with_font(). + * \param pile Une liste d'arguments supplémentaires + * + * \return La fonction renvoie la taille de la boîte de texte. + */ +int MLV_get_size_of_adapted_text_box_with_font_va( + const char* message, + const MLV_Font* font, + int sizeInterligne, + int *result_width, int *result_height, + va_list pile +); + + +/** \~french + * \brief Même chose que la fonction MLV_draw_text_box() mis à part que le texte + * est rendu avec une fonte de caractères donnée en paramètre par + * l'utilisateur. + * + * Cette fonction est équivalente à la fonction + * MLV_draw_text_box_with_font() à l'exception qu'elle est + * apellée avec un paramètre de type va_list à la place d'une nombre variable + * d'arguments. + * + * Pour plus de détail sur la fonction, aller voir la documentation de + * MLV_draw_text_box_with_font() + * + * \param x La coordonnée en X de la position du coin Nord-Ouest de la boîte. + * \param y La coordonnée en Y de la position du coin Nord-Ouest de la boîte. + * \param width La largeur de la boîte. + * \param height La hauteur de la boîte. + * \param message Le texte à afficher. + * \param font La fonte de caractères utilisée pour dessiner le texte. + * \param sizeInterligne La taille de l'interligne. + * \param borderColor La couleur des bordures. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond de la boîte. + * \param text_justification La justification du texte. + * \param horizontal_position La position horizontale du texte dans la boîte. + * \param vertical_position La position verticale du texte dans la boîte. + * \param pile Une liste d'arguments supplémentaires + */ +void MLV_draw_text_box_with_font_va( + int x, int y, + int width, int height, + const char* message , + const MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + va_list pile +); + +/** \~french + * \brief Dessine une boîte de taille donnée par l'utilisateur et contenant un + * texte donné par l'utilisateur. + * + * + * Cette fonction est équivalente à la fonction + * MLV_draw_text_box() à l'exception qu'elle est + * apellée avec un paramètre de type va_list à la place d'une nombre variable + * d'arguments. + * + * Pour plus de détail sur la fonction, aller voir la documentation de + * MLV_draw_text_box() + * + * \param x La coordonnée en X de la position du coin Nord-Ouest de la boîte. + * \param y La coordonnée en Y de la position du coin Nord-Ouest de la boîte. + * \param width La largeur de la boîte. + * \param height La hauteur de la boîte. + * \param message Le texte à afficher. + * \param sizeInterligne La taille de l'interligne. + * \param borderColor La couleur des bordures. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond de la boîte. + * \param text_justification La justification du texte. + * \param horizontal_position La position horizontale du texte dans la boîte. + * \param vertical_position La position verticale du texte dans la boîte. + * \param pile Une liste d'arguments supplémentaires + */ +void MLV_draw_text_box_va( + int x, int y, + int width, int height, + const char* message , + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + va_list pile +); + +/** \~french + * \brief Même chose que la fonction MLV_draw_text_box_with_font() mis à part que + * le texte n'est pas dessinné directement sur l'ecran, mais sur une + * une image. + * + * Cette fonction est équivalente à la fonction + * MLV_draw_text_box_with_font_on_image() à l'exception qu'elle est + * apellée avec un paramètre de type va_list à la place d'une nombre variable + * d'arguments. + * + * Pour plus de détail sur la fonction, aller voir la documentation de + * MLV_draw_text_box_with_font_on_image() + * + * \param x La coordonnée en X de la position du coin Nord-Ouest de la boîte. + * \param y La coordonnée en Y de la position du coin Nord-Ouest de la boîte. + * \param width La largeur de la boîte. + * \param height La hauteur de la boîte. + * \param message Le texte à afficher. + * \param font La fonte caractères utilisée pour dessiner le texte. + * \param sizeInterligne La taille de l'interligne. + * \param borderColor La couleur des bordures. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond de la boîte. + * \param text_justification La justification du texte. + * \param horizontal_position La position horizontale du texte dans la boîte. + * \param vertical_position La position verticale du texte dans la boîte. + * \param image L'image sur laquel le texte doit être ecrit. + * \param pile Une liste d'arguments supplémentaires + */ +void MLV_draw_text_box_with_font_on_image_va( + int x, int y, + int width, int height, + const char* message , + MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + MLV_Image* image, + va_list pile +); + +/** \~french + * \brief Même chose que MLV_draw_text_box() mis à part que le texte n'est pas + * écrit directement sur l'écran, mais sur une image à la place. + * + * Cette fonction est équivalente à la fonction + * MLV_draw_text_box_on_image() à l'exception qu'elle est + * apellée avec un paramètre de type va_list à la place d'une nombre variable + * d'arguments. + * + * Pour plus de détail sur la fonction, aller voir la documentation de + * MLV_draw_text_box_on_image() + * + * \param x La coordonnée en X de la position du coin Nord-Ouest de la boîte. + * \param y La coordonnée en Y de la position du coin Nord-Ouest de la boîte. + * \param width La largeur de la boîte. + * \param height La hauteur de la boîte. + * \param message Le texte à afficher. + * \param sizeInterligne La taille de l'interligne. + * \param borderColor La couleur des bordures. + * \param textColor La couleur du texte. + * \param backgroundColor La couleur du fond de la boîte. + * \param text_justification La justification du texte. + * \param horizontal_position La position horizontale du texte dans la boîte. + * \param vertical_position La position verticale du texte dans la boîte. + * \param image L'image sur laquel le texte doit être ecrit. + * \param pile Une liste d'arguments supplémentaires + */ +void MLV_draw_text_box_on_image_va( + int x, int y, + int width, int height, + const char* message , + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + MLV_Image* image, + va_list pile +); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/MLV/MLV_time.h b/MLV/MLV_time.h new file mode 100755 index 0000000..91a049f --- /dev/null +++ b/MLV/MLV_time.h @@ -0,0 +1,119 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_time.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit tous les prototypes des fonctions concernant la + * gestion du temps. + * + */ + +#ifndef __MLV__MLV_TIME_H__ +#define __MLV__MLV_TIME_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Le programme s'intérompt pendant un nombre de milli-secondes donné + * en paramètre. + * + * \param milliseconds Le nombre de milli-secondes à attendre. + */ +void MLV_wait_milliseconds(int milliseconds); + +/** \~french + * \brief Le programme s'intérompt pendant un nombre de secondes. + * + * \param seconds Le nombre de secondes à attendre. + */ +void MLV_wait_seconds(int seconds); + +/** \~french + * \brief Renvoie le nombre de millisecondes écoulées depuis le début de + * l'initialisation de la bibliothèque MLV ( avec MLV_create_window ). + * \return Le temps écoulé depuis l'initialisation de la bibliothèque MLV. + */ +int MLV_get_time(); + +/** \~french + * \brief Donne la date du jour (seconde/heure/jour/mois/annee). + * + * L'année est donnée depuis l'an 0. + * + * Une valeur nulle peut être passée en paramètre de la fonction. Dans ce cas, + * le paramètre est ignoré par la fonction. + * + * \param seconds Le nombre de secondes écoulées depuis le dernier changement de + * minute. + * \param minutes Le nombre de minutes écoulées depuis le dernier changement + * d'heure + * \param hours Le nombre d'heures écoulées depuis minuit. + * \param day Le quantième du mois. + * \param month Le nombre de mois écoulés depuis le début de l'année. + * \param year Le nombre d'années depuis l'an 0. + * \param day_of_the_week Le jour de la semaine ( 0: Lundi, 1:Mardi, ..., + * 6:Dimanche). + * \return Renvoie 1 si le décalage heure d'hivers et heure d'été a été + * pris en compte, 0 si il ne l'a pas été et -1 si l'information + * n'est pas disponible. + */ +int MLV_get_date( + int* seconds, int* minutes, int* hours, + int* day, int* month, int* year, + int* day_of_the_week +); + +/** \~french + * \brief Configure la fréquence de rafraichissement en Hz. + * + * La fréquence de rafraîchissement par defaut est de 100 Hz. Cela signifie + * que si l'on utilise MLV_delay_according_to_frame_rate() entre chaque + * rafraîchissement de la fenêtre graphique, on obtient un rafraichissement + * de 100 images par secondes. + * + * \param rate Fréquence de rafraîchissement. + */ +void MLV_change_frame_rate( int rate ); + +/** \~french + * \brief Donne la fréquence de rafraîchissement courante. + * + * \return La fréquence de rafraîchissement courante. + */ +int MLV_get_frame_rate( ); + +/** \~french + * \brief Suspend l'exécution du programme de façon à ce que le temps écoulé + * depuis le drenier appel à cette fonction, soit égale à la période de + * la fréquence de rafraîchissement configuré par MLV_change_frame_rate. + */ +void MLV_delay_according_to_frame_rate( ); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MLV/MLV_window.h b/MLV/MLV_window.h new file mode 100644 index 0000000..9ef53f4 --- /dev/null +++ b/MLV/MLV_window.h @@ -0,0 +1,306 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_window.h + * \brief Ce fichier définit les prototypes des fonctions permettant de créer, + * initialiser et fermer des fenêtres. + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + */ + + +#ifndef __MLV__MLV_WINDOW_H__ +#define __MLV__MLV_WINDOW_H__ + +#include "MLV_color.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Créé une fenêtre dont la taille, et les différents noms sont passés en + * paramètres. + * + * Cette fonction initialise la bibliothèque MLV. + * Un programme donné ne peut pas ouvrir plus d'une fenêtre à la + * fois. + * Les paramètres largeur et hauteur peuvent éventuellement prendre des valeurs + * négatives. Dans ce cas, la fenêtre est dessinée en plein écran. + * + * \bug BOGUES WINDOWS ET MACOSX UNIQUEMENT\n\n + * Sous Windows uniquement, la fenêtre crée ne peut pas toujours être + * fermée à l'aide de la croix. En effet, la bibliothèque MLV implémente + * une fermeture automatique de la fenêtre lorsque l'utilisateur utilise + * la croix. Or, ce mécanisme utilise les threads SDL qui ne sont + * malheureusement pas bien supportés sous Windows et MacOSX.\n\n + * En fait, la bibliothèque MLV utilise un second thread pour + * récuperer en permanance tous les évènements SDL de la pile et pour les + * traiter au fur et à mesure de leurs apparitions. OR, sous Windos et + * Mac OS X, comme les threads ne fonctionnent pas, la bibliothèque ne peux + * pas lire les évènements systèmes comme ceux de la fermeture de la + * fenêtre. + * Elle n'est donc plus informée de ce qui ce passe. + * Pour permettre à la bibliothèque de récupérer ces informations, il vous + * suffit de demander un évènement à l'aide de la fonction : + * MLV_get_event(). + * Cela obligera la bibliothèque MLV à dépiler et à traiter tous les + * évènements SDL de la pile. Cela aura pour conséquence de traiter + * l'évènement système de la fermeture de la fenêtre. + * Dans l'implémentation des fonctions : MLV_wait_keyboard(), + * MLV_wait_mouse(), etc ..., nous utilisons la fonction MLV_get_event(). + * C'est pourquoi, la croix fonctionne correctement lorsque le programme + * est en attente d'une information provenant de l'utilisateur. + * + * \param window_name Le nom de la fenêtre. + * \param icone_name Le nom de l'icône de la fenêtre. + * \param width La largeur de la fenêtre. + * \param height La hauteur de la fenêtre. + */ +void MLV_create_window( + const char* window_name, const char* icone_name, + unsigned int width, unsigned int height +); + + +/** \~french + * \brief Même chose que MLV_create_window(), mais en utilisant une fonte + * de caractères particulière. + * + * \bug Même bogues que la fonction MLV_create_window(). + * + * \param window_name Le nom de la fenêtre. + * \param icone_name Le nom de l'icône de la fenêtre. + * \param width La largeur de la fenêtre. + * \param height La hauteur de la fenêtre. + * \param path_to_font Le chemin d'accès vers une fonte de caratères au standard + * 'TrueType' (fichiers d'extension .ttf). + * \param size_font La taille de la fonte de caractères. la hauteur de la fenêtre. + */ +void MLV_create_window_with_default_font( + const char* window_name, const char* icone_name, + unsigned int width, unsigned int height, + const char* path_to_font, unsigned int size_font +); + +/** \~french + * \brief Change la fonte de caractères par défault de la bibliothèque MLV. + * + * Cette fonction change la fonte de caractères par défault de la bibliothèque. + * Cette fonction ne peux s'exécuter qu'après avoir initialisé la bibliothèque + * MLV en créant une fenêtre à l'aide de la fonction MLV_create_window(). + * Cette fonction n'a pas de sens si vous ne souhaitez pas changer de fontes + * plusieurs fois durant l'exécution de votre programme. + * Si vous n'utilisez qu'une seule fonte de caractères, il vaut mieux + * l'indiquer à la bibliothèque MLV lors de la création de la fenêtre en utilisant + * la fonction: MLV_create_window_with_default_font(). + * + * \param path_to_font Le chemin d'accès vers une fonte de caratères au + * standard "TrueType" (fichiers d'extension .ttf). + * \param size_font La taille de la fonte de caractères. + */ +void MLV_change_default_font( const char* path_to_font, unsigned int size_font ); + +/** \~french + * \brief Même chose que MLV_create_window(), mais configure la fenêtre en + * mode plein écran. + * + * \bug Même bogues que MLV_create_window(). + * + * \param window_name Le nom de la fenêtre. + * \param icone_name Le nom de l'icône de la fenêtre. + * \param width La largeur de la fenêtre ( en mode plein écran, cette valeur + * correspond à la coordonnée en X de la résolution de l'image ). + * \param height La hauteur de la fenêtre ( en mode plein écran, cela + * correspond à la coordonnée en Y de la résolution de l'image ). + */ +void MLV_create_full_screen_window( + const char* window_name, const char* icone_name, + unsigned int width, unsigned int height +); + +/** \~french + * \brief Même chose que MLV_create_window(), mais configure la fenêtre en + * mode plein écran. + * + * \bug Même bogues que MLV_create_window(). + * + * \param window_name Le nom de la fenêtre. + * \param icone_name Le nom de l'icône de la fenêtre. + * \param width La largeur de la fenêtre ( en mode plein écran, cette valeur + * correspond à la coordonnée en X de la résolution de l'image ). + * \param height La hauteur de la fenêtre ( en mode plein écran, cela + * correspond à la coordonnée en Y de la résolution de l'image ). + * \param path_to_font Le chemin d'accès vers une fonte de caratères au + * standard "TrueType" (fichiers d'extension .ttf). + * \param size_font La taille de la fonte de caractères. + */ +void MLV_create_full_screen_window_with_default_font( + const char* window_name, const char* icone_name, + unsigned int width, unsigned int height, + const char* path_to_font, unsigned int size_font +); + + +/** \~french + * \brief Affiche la fenêtre en plein ecran. + * + * La résolution de l'image est donnée alors par la taille de l'image. + * Pour que l'application soit en plein écran, il faut que la taille de la + * fenêtre soit compatible avec la résolution de l'écran. + */ +void MLV_enable_full_screen(); + +/** \~french + * \brief Désactve le mode plein écran de la fenêtre. + */ +void MLV_disable_full_screen(); + +/** \~french + * \brief Test si l'affichage est en mode plein écran ou en mode fenêtre. + * + * \return Renvoie 1 si l'affichage est en mode plein écran, 0 sinon. + */ +int MLV_is_full_screen(); + +/** \~french + * \brief Change la taille de la fenêtre. + * + * Si la fenêtre est configurée en mode plein ecran, l'application reste alors + * en mode plein écran. + * Pour que l'application soit en plein écran, il faut que la taille de la + * fenêtre soit compatible avec la résolution de l'écran. + * De plus, en mode plein écran, la taille de la fenêtre correspond à la + * résolution de l'image sur l'écran. + * + * \param width la largeur de la fenêtre + * \param height la hauteur de la fenêtre + */ +void MLV_change_window_size( unsigned int width, unsigned int height ); + +/** \~french + * \brief Change les intitulés de la fenêtre principale. + * + * \param window_name Intitulé apparaissaissant sur la barre de la fenêtre. + * \param icone_name Intitulé apparaissaissant dans la barre des tâches. + */ +void MLV_change_window_caption( + const char* window_name, const char* icone_name +); + +/** \~french + * \brief Renvoie dans les paramètres, la hauteur et la largeur de la fentre. + * + * \param width La largeur de la fenêtre. + * \param height La hauteur de la fenêtre. + */ +void MLV_get_window_size( unsigned int* width, unsigned int* height ); + +/** \~french + * \brief Retourne la hauteur de la fenêtre. + */ +int MLV_get_window_height( ); + +/** \~french + * \brief Retourne la largeur de la fenêtre. + */ +int MLV_get_window_width( ); + +/** \~french + * \brief Éfface la fenêtre et la remplace par un monochrome de la couleur + * donnée en paramètre. + * + * \param color La couleur du fond de la fênetre. + */ +void MLV_clear_window( MLV_Color color ); + +/** \~french + * \brief Ferme la fenêtre de la bibliothèque MLV. + * + * Cette fonction libère correctement toutes les données qui ont été crées par la + * bibliothèque MLV + * + */ +void MLV_free_window(); + +/** \~french + * \brief Actualise l'affichage de la fenêtre. + * + * Vois La fonction MLV_update_window + * + * Lorsque vous utilisez des fonctions de dessins, les différents changements + * effectués ne sont pas visibles. Pour les afficher vous devez utiliser cette + * fonction. + */ +void MLV_actualise_window(); + +/** \~french + * \brief Met à jour l'affichage de la fenêtre. + * + * Lorsque vous utilisez des fonctions de dessins, les différents changements + * effectués ne sont pas visibles. Pour les afficher vous devez utiliser cette + * fonction. + */ +void MLV_update_window(); + +/** \~french + * \brief Exécute la fonction de call back donnée en paramètre lorsque le système + * envoie un signal d'arrêt, ou lorsque l'utilisateur clique sur la croix de la + * fenêtre. + * + * La fonction de call back est alors exécutée avec en + * paramêtre un pointeur vers une structure de donnée qui + * est aussi donné en paramètre à la fonction + * MLV_execute_at_exit(). + * + * \param function Le pointeur de la fonction de call back qui doit être exécutée. + * \param data La Donnée à passer en paramètre à la fonction de call back lors de + * son exécution. + */ +void MLV_execute_at_exit( void (*function)(void*), void* data ); + +/** \~french + * \brief Renvoie dans les paramètres, la hauteur et la largeur de + * l'environement de bureau de l'ordinateur. + * + * \param width La largeur du bureau. + * \param height La hauteur du bureau. + */ +void MLV_get_desktop_size( unsigned int* width, unsigned int* height ); + +/** \~french + * \brief Renvoie la hauteur de l'environement de bureau de l'ordinateur. + */ +int MLV_get_desktop_height( ); + +/** \~french + * \brief Renvoie la largeur de l'environement de bureau de l'ordinateur. + */ +int MLV_get_desktop_width( ); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MLV/MLV_xml.h b/MLV/MLV_xml.h new file mode 100644 index 0000000..4968558 --- /dev/null +++ b/MLV/MLV_xml.h @@ -0,0 +1,217 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_xml.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit les prototypes des fonctions permettant de lire des + * fichiers xml. + * + * Les fichiers xml sont utilisés pour stocker les données nécessaires au + * fonctionnement d'un programme. Ils permettent de modifier facilement + * l'exécution du programme sans avoir à le modifier. En effet, ils sont + * lisibles par l'homme et par la machine en même temps. + * Ils constituent donc une interface pratique entre l'ordinateur et + * l'utilisateur. + * + */ + +#ifndef __MLV__MLV_XML_H__ +#define __MLV__MLV_XML_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Définit le type de donnée stockée au format xml dans la bibliothèque MLV. + */ +typedef struct _MLV_Xml MLV_Xml; + +/** \~french + * \brief Charge en mémoire un fichier au format xml. + * + * Cette fonction renvoi NULL, lorsque le fichier n'a pas pu être correctement + * chargé. + * + * \param xml_file_path Chemin d'accès du fichier xml. + * \return Le fichier xml lu, analysé et chargé. + */ +MLV_Xml* MLV_load_xml( const char* xml_file_path ); + +/** \~french + * \brief Libère la mémoire utilisée par les données du fichier xml. + * + * \param xml_data Les données xml a supprimer. + */ +void MLV_free_xml( MLV_Xml* xml_data ); + +/** \~french + * \brief Énumère les différents codes d'erreurs que l'on peut rencontrer + * lorsque l'ordinateur lit un document xml. + */ +typedef enum { + MLV_XML_NONE, /**< \~french Aucune erreur detectée. */ + MLV_XML_THE_FIELD_DOESNT_EXIST, /**< \~french Le champs n'existe pas dans le document xml. */ + MLV_XML_THE_FIELD_IS_NOT_A_REAL, /**< \~french Le champs ne contient pas une chaîne de caractères codant un reel. */ + MLV_XML_THE_FIELD_IS_NOT_AN_INTEGER, /**< \~french Le champs ne contient pas un chaîne de caractères codant un entier. */ + MLV_XML_THE_FIELD_IS_TOO_BIG /**< \~french La chaîne code un réel/entier trop long pour être stocké dans la variable. */ +} MLV_Xml_error; + +/** \~french + * \brief Permet d'accéder à l'interieur d'un champs donné du fichier xml. + * + * Cette fonction peut contenir un nombre variable de paramètres. + * Comme avec la fonction printf les paramètres suplémentaires, + * situées après le paramètre xpath, permettent de construire des + * requêtes xpath évolué. + * + * Par exemple, + + * \code + * int id_batiment = 2; + * char * type_salle = "informatique" + * int id_salle = 4; + * char* nom_salle; + * MLV_get_string_value_from_xml( + * xml_data, &(nom_salle), + * "/batiment[%d]/salle[type=%s][%d]/nom", + * id_batiment, type_salle, id_salle + * ) + * free( nom_salle ); // on oublie pas de libérer la mémoire après avoir + * // utilisé nom_salle + * \endcode + * + * permet de recupérer le contenu du champs "nom" situé dans la 4eme salle + * informatique du 2eme batiment. + * + * Attention: Il ne faut pas oublier de libérer la mémoire associée au champs + * result. + * + * \param xml_data Les données xml. + * \param result Un pointeur vers une addresse vide qui contiendra l'addresse de la chaîne de caractères correspondant au résultat de la fonction. + * \param xpath Le chemin d'accès. + * \return renvoie un code d'erreur si la fonction n'a pa reussie à extraire la donnée souhaitée du document xml. + */ +MLV_Xml_error MLV_get_string_value_from_xml( + const MLV_Xml* xml_data, char** result , const char* xpath, ... +); + +/** \~french + * \brief Permet de récupérer l'entier d'un champs donné du fichier xml. + * + * Tout comme la fonction MLV_get_string_value_from_xml(), cette fonction peut + * contenir un nombre variable de paramètres. + * Pour plus d'informations, veuillez lire la documentation de la fonction + * MLV_get_string_value_from_xml(). + * + * \param xml_data Les données xml. + * \param result Un pointeur vers un entier dans lequel le résultat de la fonction sera enregistré. + * \param xpath Le chemin d'accès. + * \return renvoie un code d'erreur si la fonction n'a pa reussie à extraire la donnée souhaitée du document xml. + */ +MLV_Xml_error MLV_get_integer_value_from_xml( + const MLV_Xml* xml_data, int* result, const char* xpath, ... +); + +/** \~french + * \brief Permet de récupérer le reel d'un champs donné du fichier xml. + * + * Tout comme la fonction MLV_get_string_value_from_xml(), cette fonction peut + * contenir un nombre variable de paramètres. + * Pour plus d'informations, veuillez lire la documentation de la fonction + * MLV_get_string_value_from_xml(). + * + * \param xml_data Les données xml. + * \param result Un pointeur vers un réel dans lequel le résultat de la fonction sera enregistré. + * \param xpath Le chemin d'accès. + * \return renvoie un code d'erreur (voir MLV_Xml_error) si la fonction n'a pas reussie à extraire la donnée souhaitée du document xml. + */ +MLV_Xml_error MLV_get_double_value_from_xml( + const MLV_Xml* xml_data, double* result, const char* xpath, ... +); + +/** \~french + * \brief Permet de récupérer le réel d'un champs donné du fichier xml. + * + * Tout comme la fonction MLV_get_string_value_from_xml(), cette fonction peut + * contenir un nombre variable de paramètres. + * Pour plus d'informations, veuillez lire la documentation de la fonction + * MLV_get_string_value_from_xml(). + * + * \param xml_data Les données xml. + * \param result Un pointeur vers un réel dans lequel le résultat de la fonction sera enregistré. + * \param xpath Le chemin d'accès. + * \return renvoie un code d'erreur (voir MLV_Xml_error) si la fonction n'a pas reussie à extraire la donnée souhaitée du document xml. + */ +MLV_Xml_error MLV_get_float_value_from_xml( + const MLV_Xml* xml_data, float* result, const char* xpath, ... +); + + +/** \~french + * \brief Compte le nombre d'objets présents dans le fichier xml verifiant + * un certain nombre de critères passés en paramètre de la fonction. + * + * \param xml_data Les données xml. + * \param xpath Le chemin d'accès. + * \param ... Les paramètres de la fonction. + * + * \return Cette fonction renvoie le nombre d'objet ayant pour chemin d'accès + * "xpath". + */ +int MLV_get_number_of_objects_from_xml( + const MLV_Xml* xml_data, const char* xpath, ... +); + +/** \~french + * \brief Permet de récupérer un noeud interne de l'arbre représentant le + * fichier XML. + * + * Cette fonction n'est pas encore implémentée. + * + * \param xml_data Les données xml. + * \param xpath Le chemin d'accès. + * \param ... Les paramètres de la fonction. + * + * \return Un noeud interne de l'arbre XML. + */ +MLV_Xml* MLV_get_xml_object_of( const MLV_Xml* xml_data, const char* xpath, ... ); + +/** \~french + * \brief Écrit sur le terminal le contenu d'un fichier xml. + * + * Cette fonction n'est pas encore implémentée. + * + * \param xml_data Les données xml. + * \param ... Les paramètres de la fonction. + */ +void MLV_print_xml( const MLV_Xml* xml_data ); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MLV/MLV_xml_va.h b/MLV/MLV_xml_va.h new file mode 100644 index 0000000..1378c8c --- /dev/null +++ b/MLV/MLV_xml_va.h @@ -0,0 +1,155 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2013-2014 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +/** \~french + * \file MLV_xml_va.h + * + * \author Adrien Boussicault + * \author Marc Zipstein + * + * \brief Ce fichier définit les même prototypes des fonctions que MLV_xml.h + * mais en utilisant en argument sulémentaire une liste de type va_list. + * + * Les fichiers xml sont utilisés pour stocker les données nécessaires au + * fonctionnement d'un programme. Ils permettent de modifier facilement + * l'exécution du programme sans avoir à le modifier. En effet, ils sont + * lisibles par l'homme et par la machine en même temps. + * Ils constituent donc une interface pratique entre l'ordinateur et + * l'utilisateur. + * + */ + +#ifndef __MLV__MLV_XML_VA_H__ +#define __MLV__MLV_XML_VA_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** \~french + * \brief Permet d'accéder à l'interieur d'un champs donné du fichier xml. + * + * Attention: Il ne faut pas oublier de libérer la mémoire associée au + * champs result. + * + * \param xml_data Les données xml. + * \param result Un pointeur vers une addresse vide qui contiendra l'addresse de la chaîne de caractères correspondant au résultat de la fonction. + * \param xpath Le chemin d'accès. + * \param pile La pile des complements de paramètres comme dans vaprintf. + * \return renvoie un code d'erreur si la fonction n'a pa reussie à extraire la donnée souhaitée du document xml. + */ +MLV_Xml_error MLV_get_string_value_from_xml_va( + const MLV_Xml* xml_data, char** result, const char* xpath, va_list pile +); + + +/** \~french + * \brief Permet de récupérer l'entier d'un champs donné du fichier xml. + * + * Tout comme la fonction MLV_get_string_value_from_xml(), cette fonction peut + * contenir un nombre variable de paramètres. + * Pour plus d'informations, veuillez lire la documentation de la fonction + * MLV_get_string_value_from_xml(). + * + * \param xml_data Les données xml. + * \param result Un pointeur vers un entier dans lequel le résultat de la fonction sera enregistré. + * \param xpath Le chemin d'accès. + * \param pile La pile des complements de paramètres comme dans vaprintf. + * \return renvoie un code d'erreur si la fonction n'a pa reussie à extraire la donnée souhaitée du document xml. + */ +MLV_Xml_error MLV_get_integer_value_from_xml_va( + const MLV_Xml* xml_data, int* result, const char* xpath, va_list pile +); + +/** \~french + * \brief Permet de récupérer le reel d'un champs donné du fichier xml. + * + * Tout comme la fonction MLV_get_string_value_from_xml(), cette fonction peut + * contenir un nombre variable de paramètres. + * Pour plus d'informations, veuillez lire la documentation de la fonction + * MLV_get_string_value_from_xml(). + * + * \param xml_data Les données xml. + * \param result Un pointeur vers un réel dans lequel le résultat de la fonction sera enregistré. + * \param xpath Le chemin d'accès. + * \param pile La pile des complements de paramètres comme dans vaprintf. + * \return renvoie un code d'erreur (voir MLV_Xml_error) si la fonction n'a pas reussie à extraire la donnée souhaitée du document xml. + */ +MLV_Xml_error MLV_get_double_value_from_xml_va( + const MLV_Xml* xml_data, double* result, const char* xpath, va_list pile +); + +/** \~french + * \brief Permet de récupérer le réel d'un champs donné du fichier xml. + * + * Tout comme la fonction MLV_get_string_value_from_xml(), cette fonction peut + * contenir un nombre variable de paramètres. + * Pour plus d'informations, veuillez lire la documentation de la fonction + * MLV_get_string_value_from_xml(). + * + * \param xml_data Les données xml. + * \param result Un pointeur vers un réel dans lequel le résultat de la fonction sera enregistré. + * \param xpath Le chemin d'accès. + * \param pile La pile des complements de paramètres comme dans vaprintf. + * \return renvoie un code d'erreur (voir MLV_Xml_error) si la fonction n'a pas reussie à extraire la donnée souhaitée du document xml. + */ +MLV_Xml_error MLV_get_float_value_from_xml_va( + const MLV_Xml* xml_data, float* result, const char* xpath, va_list pile +); + + +/** \~french + * \brief Compte le nombre d'objets présents dans le fichier xml verifiant + * un certain nombre de critères passés en paramètre de la fonction. + * + * \param xml_data Les données xml. + * \param xpath Le chemin d'accès. + * \param pile La pile des complements de paramètres comme dans vaprintf. + * + * \return Cette fonction renvoie le nombre d'objet ayant pour chemin d'accès + * "xpath". + */ +int MLV_get_number_of_objects_from_xml_va( + const MLV_Xml* xml_data, const char* xpath, va_list pile +); + +/** \~french + * \brief Permet de récupérer un noeud interne de l'arbre représentant le + * fichier XML. + * + * Cette fonction n'est pas encore implémentée. + * + * \param xml_data Les données xml. + * \param xpath Le chemin d'accès. + * \param pile La pile des complements de paramètres comme dans vaprintf. + * + * \return Un noeud interne de l'arbre XML. + */ +MLV_Xml* MLV_get_xml_object_of_va( + const MLV_Xml* xml_data, const char* xpath, va_list pile +); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MLV/Makefile.am b/MLV/Makefile.am new file mode 100644 index 0000000..74f990b --- /dev/null +++ b/MLV/Makefile.am @@ -0,0 +1,118 @@ +# +# This file is part of the MLV Library. +# +# Copyright (C) 2010 Adrien Boussicault, Marc Zipstein +# +# +# This library is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this Library. If not, see . +# + +mlv_includedir=${includedir}/MLV + +if OS_IS_APPLE +lib_LTLIBRARIES = libMLV.la libMLVMain.la +else +lib_LTLIBRARIES = libMLV.la +endif + +libMLV_la_SOURCES = \ + animation.c \ + audio.c \ + color.c \ + event.c \ + shapes.c \ + image.c \ + informations.c \ + keyboard.c \ + mouse.c \ + path.c \ + playlist.c \ + input_box.c \ + input_box_wait.c \ + random.c \ + sdlkeyboardtochar.c \ + text.c \ + time.c \ + xml.c \ + list.c \ + mathematics.c \ + key.c \ + tree_set.c \ + tree_map.c \ + window.c + +if OS_IS_APPLE +libMLVMain_la_SOURCES = \ + SDLMain.m +endif + +if MEMORY_DEBUG +libMLV_la_SOURCES += memory_debug.c +endif + +if MEMORY_DEBUG +libMLV_la_CFLAGS = ${libxml_CFLAGS} ${glib_CFLAGS} -DDATA_PATH=\"${DATA_PATH}\" +libMLV_la_LIBADD = ${libxml_LIBS} ${glib_LIBS} +else +libMLV_la_CFLAGS = ${sdl_CFLAGS} ${sdlttf_CFLAGS} ${sdlimage_CFLAGS} ${sdlmixer_CFLAGS} ${libxml_CFLAGS} ${glib_CFLAGS} -DDATA_PATH=\"${DATA_PATH}\" +libMLV_la_LIBADD = ${sdl_LIBS} ${libxml_LIBS} ${glib_LIBS} ${sdlttf_LIBS} ${sdlgfx_LIBS} ${sdlimage_LIBS} ${sdlmixer_LIBS} +endif +libMLV_la_LDFLAGS = -version-info $(MLV_CURRENT):$(MLV_REVISION):$(MLV_AGE) + +# To Compile .DLL +if RELATIVEPATH +libMLV_la_LDFLAGS += -no-undefined +endif + +mlv_include_HEADERS = \ + MLV_audio.h \ + MLV_all.h \ + MLV_animation.h \ + MLV_color.h \ + MLV_device_with_buttons.h \ + MLV_event.h \ + MLV_shape.h \ + MLV_image.h \ + MLV_information.h \ + MLV_input_box_va.h \ + MLV_keyboard.h \ + MLV_mouse.h \ + MLV_path.h \ + MLV_playlist.h \ + MLV_input_box.h \ + MLV_random.h \ + MLV_text.h \ + MLV_text_va.h \ + MLV_time.h \ + MLV_xml.h \ + MLV_xml_va.h \ + MLV_window.h + +noinst_HEADERS = \ + image.h \ + data_structure.h \ + memory_debug.h \ + memory_management.h \ + platform.h \ + input_box.h \ + sdlkeyboardtochar.h \ + text.h \ + warning_error.h \ + mathematics.h \ + list.h \ + key.h \ + tree_set.h \ + tree_map.h \ + SDLMain.h + diff --git a/MLV/Makefile.in b/MLV/Makefile.in new file mode 100644 index 0000000..745362d --- /dev/null +++ b/MLV/Makefile.in @@ -0,0 +1,1138 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# +# This file is part of the MLV Library. +# +# Copyright (C) 2010 Adrien Boussicault, Marc Zipstein +# +# +# This library is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this Library. If not, see . +# + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@MEMORY_DEBUG_TRUE@am__append_1 = memory_debug.c + +# To Compile .DLL +@RELATIVEPATH_TRUE@am__append_2 = -no-undefined +subdir = MLV +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/m4/libtool.m4 \ + $(top_srcdir)/config/m4/ltoptions.m4 \ + $(top_srcdir)/config/m4/ltsugar.m4 \ + $(top_srcdir)/config/m4/ltversion.m4 \ + $(top_srcdir)/config/m4/lt~obsolete.m4 \ + $(top_srcdir)/config/m4/ax_prog_doxygen.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(mlv_include_HEADERS) \ + $(noinst_HEADERS) $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(mlv_includedir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +@MEMORY_DEBUG_FALSE@libMLV_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +@MEMORY_DEBUG_FALSE@ $(am__DEPENDENCIES_1) \ +@MEMORY_DEBUG_FALSE@ $(am__DEPENDENCIES_1) \ +@MEMORY_DEBUG_FALSE@ $(am__DEPENDENCIES_1) \ +@MEMORY_DEBUG_FALSE@ $(am__DEPENDENCIES_1) \ +@MEMORY_DEBUG_FALSE@ $(am__DEPENDENCIES_1) \ +@MEMORY_DEBUG_FALSE@ $(am__DEPENDENCIES_1) +@MEMORY_DEBUG_TRUE@libMLV_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +@MEMORY_DEBUG_TRUE@ $(am__DEPENDENCIES_1) +am__libMLV_la_SOURCES_DIST = animation.c audio.c color.c event.c \ + shapes.c image.c informations.c keyboard.c mouse.c path.c \ + playlist.c input_box.c input_box_wait.c random.c \ + sdlkeyboardtochar.c text.c time.c xml.c list.c mathematics.c \ + key.c tree_set.c tree_map.c window.c memory_debug.c +@MEMORY_DEBUG_TRUE@am__objects_1 = libMLV_la-memory_debug.lo +am_libMLV_la_OBJECTS = libMLV_la-animation.lo libMLV_la-audio.lo \ + libMLV_la-color.lo libMLV_la-event.lo libMLV_la-shapes.lo \ + libMLV_la-image.lo libMLV_la-informations.lo \ + libMLV_la-keyboard.lo libMLV_la-mouse.lo libMLV_la-path.lo \ + libMLV_la-playlist.lo libMLV_la-input_box.lo \ + libMLV_la-input_box_wait.lo libMLV_la-random.lo \ + libMLV_la-sdlkeyboardtochar.lo libMLV_la-text.lo \ + libMLV_la-time.lo libMLV_la-xml.lo libMLV_la-list.lo \ + libMLV_la-mathematics.lo libMLV_la-key.lo \ + libMLV_la-tree_set.lo libMLV_la-tree_map.lo \ + libMLV_la-window.lo $(am__objects_1) +libMLV_la_OBJECTS = $(am_libMLV_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libMLV_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libMLV_la_CFLAGS) \ + $(CFLAGS) $(libMLV_la_LDFLAGS) $(LDFLAGS) -o $@ +@OS_IS_APPLE_FALSE@am_libMLV_la_rpath = -rpath $(libdir) +@OS_IS_APPLE_TRUE@am_libMLV_la_rpath = -rpath $(libdir) +libMLVMain_la_LIBADD = +am__libMLVMain_la_SOURCES_DIST = SDLMain.m +@OS_IS_APPLE_TRUE@am_libMLVMain_la_OBJECTS = SDLMain.lo +libMLVMain_la_OBJECTS = $(am_libMLVMain_la_OBJECTS) +@OS_IS_APPLE_TRUE@am_libMLVMain_la_rpath = -rpath $(libdir) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +OBJCCOMPILE = $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) +LTOBJCCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_OBJCFLAGS) $(OBJCFLAGS) +AM_V_OBJC = $(am__v_OBJC_@AM_V@) +am__v_OBJC_ = $(am__v_OBJC_@AM_DEFAULT_V@) +am__v_OBJC_0 = @echo " OBJC " $@; +am__v_OBJC_1 = +OBJCLD = $(OBJC) +OBJCLINK = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_OBJCLD = $(am__v_OBJCLD_@AM_V@) +am__v_OBJCLD_ = $(am__v_OBJCLD_@AM_DEFAULT_V@) +am__v_OBJCLD_0 = @echo " OBJCLD " $@; +am__v_OBJCLD_1 = +SOURCES = $(libMLV_la_SOURCES) $(libMLVMain_la_SOURCES) +DIST_SOURCES = $(am__libMLV_la_SOURCES_DIST) \ + $(am__libMLVMain_la_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(mlv_include_HEADERS) $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ + $(LISP)config.h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/config/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPILE_DEBUG_VERSION_FOR_WINDOW = @COMPILE_DEBUG_VERSION_FOR_WINDOW@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATA_PATH = @DATA_PATH@ +DEFAULT_LANGUAGE = @DEFAULT_LANGUAGE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +DX_CONFIG = @DX_CONFIG@ +DX_DOCDIR = @DX_DOCDIR@ +DX_DOT = @DX_DOT@ +DX_DOXYGEN = @DX_DOXYGEN@ +DX_DVIPS = @DX_DVIPS@ +DX_EGREP = @DX_EGREP@ +DX_ENV = @DX_ENV@ +DX_FLAG_chi = @DX_FLAG_chi@ +DX_FLAG_chm = @DX_FLAG_chm@ +DX_FLAG_doc = @DX_FLAG_doc@ +DX_FLAG_dot = @DX_FLAG_dot@ +DX_FLAG_html = @DX_FLAG_html@ +DX_FLAG_man = @DX_FLAG_man@ +DX_FLAG_pdf = @DX_FLAG_pdf@ +DX_FLAG_ps = @DX_FLAG_ps@ +DX_FLAG_rtf = @DX_FLAG_rtf@ +DX_FLAG_xml = @DX_FLAG_xml@ +DX_HHC = @DX_HHC@ +DX_LANGUAGE = @DX_LANGUAGE@ +DX_LATEX = @DX_LATEX@ +DX_MAKEINDEX = @DX_MAKEINDEX@ +DX_PDFLATEX = @DX_PDFLATEX@ +DX_PERL = @DX_PERL@ +DX_PROJECT = @DX_PROJECT@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_LANGUAGE = @INSTALL_LANGUAGE@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LANGUAGES = @LANGUAGES@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAIL_ADRIEN_BOUSSICAULT = @MAIL_ADRIEN_BOUSSICAULT@ +MAIL_MARC_ZIPSTEIN = @MAIL_MARC_ZIPSTEIN@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MLV_AGE = @MLV_AGE@ +MLV_CODEBLOCKS_32_PACKAGE = @MLV_CODEBLOCKS_32_PACKAGE@ +MLV_CPPFLAGS = @MLV_CPPFLAGS@ +MLV_CURRENT = @MLV_CURRENT@ +MLV_DEBIAN_32_BINARY_PACKAGE = @MLV_DEBIAN_32_BINARY_PACKAGE@ +MLV_DEBIAN_32_DEV_PACKAGE = @MLV_DEBIAN_32_DEV_PACKAGE@ +MLV_DEBIAN_64_BINARY_PACKAGE = @MLV_DEBIAN_64_BINARY_PACKAGE@ +MLV_DEBIAN_64_DEV_PACKAGE = @MLV_DEBIAN_64_DEV_PACKAGE@ +MLV_DEBIAN_VERSION = @MLV_DEBIAN_VERSION@ +MLV_DEBIAN_X_BINARY_PACKAGE = @MLV_DEBIAN_X_BINARY_PACKAGE@ +MLV_DEBIAN_X_DEV_PACKAGE = @MLV_DEBIAN_X_DEV_PACKAGE@ +MLV_DEVCPP_32_PACKAGE = @MLV_DEVCPP_32_PACKAGE@ +MLV_FEDORA_32_BINARY_PACKAGE = @MLV_FEDORA_32_BINARY_PACKAGE@ +MLV_FEDORA_32_DEV_PACKAGE = @MLV_FEDORA_32_DEV_PACKAGE@ +MLV_FEDORA_32_SOURCE_PACKAGE = @MLV_FEDORA_32_SOURCE_PACKAGE@ +MLV_FEDORA_32_STATIC_PACKAGE = @MLV_FEDORA_32_STATIC_PACKAGE@ +MLV_FEDORA_64_BINARY_PACKAGE = @MLV_FEDORA_64_BINARY_PACKAGE@ +MLV_FEDORA_64_DEV_PACKAGE = @MLV_FEDORA_64_DEV_PACKAGE@ +MLV_FEDORA_64_SOURCE_PACKAGE = @MLV_FEDORA_64_SOURCE_PACKAGE@ +MLV_FEDORA_64_STATIC_PACKAGE = @MLV_FEDORA_64_STATIC_PACKAGE@ +MLV_FEDORA_CODE_VERSION = @MLV_FEDORA_CODE_VERSION@ +MLV_FEDORA_KEY_PACKAGE = @MLV_FEDORA_KEY_PACKAGE@ +MLV_FEDORA_VERSION = @MLV_FEDORA_VERSION@ +MLV_LIBADD = @MLV_LIBADD@ +MLV_MACOSX_PACKAGE = @MLV_MACOSX_PACKAGE@ +MLV_MACOSX_VERSION = @MLV_MACOSX_VERSION@ +MLV_MAJOR_VERSION = @MLV_MAJOR_VERSION@ +MLV_MINOR_VERSION = @MLV_MINOR_VERSION@ +MLV_PACKAGE_REPOSITORY = @MLV_PACKAGE_REPOSITORY@ +MLV_RCS_REVISION = @MLV_RCS_REVISION@ +MLV_REPOSITORY = @MLV_REPOSITORY@ +MLV_REVISION = @MLV_REVISION@ +MLV_SOURCE_REPOSITORY = @MLV_SOURCE_REPOSITORY@ +MLV_URL = @MLV_URL@ +MLV_WIN_32_BINARIES = @MLV_WIN_32_BINARIES@ +MLV_WIN_64_BINARIES = @MLV_WIN_64_BINARIES@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +doxygendir = @doxygendir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +glib_CFLAGS = @glib_CFLAGS@ +glib_LIBS = @glib_LIBS@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libsdl_found = @libsdl_found@ +libsdlgfx_found = @libsdlgfx_found@ +libsdlimage_found = @libsdlimage_found@ +libsdlmixer_found = @libsdlmixer_found@ +libsdlttf_found = @libsdlttf_found@ +libxml_CFLAGS = @libxml_CFLAGS@ +libxml_LIBS = @libxml_LIBS@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +os_LIBS = @os_LIBS@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sdl_CFLAGS = @sdl_CFLAGS@ +sdl_LIBS = @sdl_LIBS@ +sdlgfx_LIBS = @sdlgfx_LIBS@ +sdlimage_CFLAGS = @sdlimage_CFLAGS@ +sdlimage_LIBS = @sdlimage_LIBS@ +sdlmixer_CFLAGS = @sdlmixer_CFLAGS@ +sdlmixer_LIBS = @sdlmixer_LIBS@ +sdlttf_CFLAGS = @sdlttf_CFLAGS@ +sdlttf_LIBS = @sdlttf_LIBS@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +mlv_includedir = ${includedir}/MLV +@OS_IS_APPLE_FALSE@lib_LTLIBRARIES = libMLV.la +@OS_IS_APPLE_TRUE@lib_LTLIBRARIES = libMLV.la libMLVMain.la +libMLV_la_SOURCES = animation.c audio.c color.c event.c shapes.c \ + image.c informations.c keyboard.c mouse.c path.c playlist.c \ + input_box.c input_box_wait.c random.c sdlkeyboardtochar.c \ + text.c time.c xml.c list.c mathematics.c key.c tree_set.c \ + tree_map.c window.c $(am__append_1) +@OS_IS_APPLE_TRUE@libMLVMain_la_SOURCES = \ +@OS_IS_APPLE_TRUE@ SDLMain.m + +@MEMORY_DEBUG_FALSE@libMLV_la_CFLAGS = ${sdl_CFLAGS} ${sdlttf_CFLAGS} ${sdlimage_CFLAGS} ${sdlmixer_CFLAGS} ${libxml_CFLAGS} ${glib_CFLAGS} -DDATA_PATH=\"${DATA_PATH}\" +@MEMORY_DEBUG_TRUE@libMLV_la_CFLAGS = ${libxml_CFLAGS} ${glib_CFLAGS} -DDATA_PATH=\"${DATA_PATH}\" +@MEMORY_DEBUG_FALSE@libMLV_la_LIBADD = ${sdl_LIBS} ${libxml_LIBS} ${glib_LIBS} ${sdlttf_LIBS} ${sdlgfx_LIBS} ${sdlimage_LIBS} ${sdlmixer_LIBS} +@MEMORY_DEBUG_TRUE@libMLV_la_LIBADD = ${libxml_LIBS} ${glib_LIBS} +libMLV_la_LDFLAGS = -version-info \ + $(MLV_CURRENT):$(MLV_REVISION):$(MLV_AGE) $(am__append_2) +mlv_include_HEADERS = \ + MLV_audio.h \ + MLV_all.h \ + MLV_animation.h \ + MLV_color.h \ + MLV_device_with_buttons.h \ + MLV_event.h \ + MLV_shape.h \ + MLV_image.h \ + MLV_information.h \ + MLV_input_box_va.h \ + MLV_keyboard.h \ + MLV_mouse.h \ + MLV_path.h \ + MLV_playlist.h \ + MLV_input_box.h \ + MLV_random.h \ + MLV_text.h \ + MLV_text_va.h \ + MLV_time.h \ + MLV_xml.h \ + MLV_xml_va.h \ + MLV_window.h + +noinst_HEADERS = \ + image.h \ + data_structure.h \ + memory_debug.h \ + memory_management.h \ + platform.h \ + input_box.h \ + sdlkeyboardtochar.h \ + text.h \ + warning_error.h \ + mathematics.h \ + list.h \ + key.h \ + tree_set.h \ + tree_map.h \ + SDLMain.h + +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .m .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu MLV/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu MLV/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status MLV/config.h +$(srcdir)/config.h.in: $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libMLV.la: $(libMLV_la_OBJECTS) $(libMLV_la_DEPENDENCIES) $(EXTRA_libMLV_la_DEPENDENCIES) + $(AM_V_CCLD)$(libMLV_la_LINK) $(am_libMLV_la_rpath) $(libMLV_la_OBJECTS) $(libMLV_la_LIBADD) $(LIBS) + +libMLVMain.la: $(libMLVMain_la_OBJECTS) $(libMLVMain_la_DEPENDENCIES) $(EXTRA_libMLVMain_la_DEPENDENCIES) + $(AM_V_OBJCLD)$(OBJCLINK) $(am_libMLVMain_la_rpath) $(libMLVMain_la_OBJECTS) $(libMLVMain_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SDLMain.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-animation.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-audio.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-color.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-event.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-image.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-informations.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-input_box.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-input_box_wait.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-key.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-keyboard.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-list.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-mathematics.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-memory_debug.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-mouse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-path.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-playlist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-random.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-sdlkeyboardtochar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-shapes.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-text.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-time.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-tree_map.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-tree_set.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-window.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMLV_la-xml.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libMLV_la-animation.lo: animation.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-animation.lo -MD -MP -MF $(DEPDIR)/libMLV_la-animation.Tpo -c -o libMLV_la-animation.lo `test -f 'animation.c' || echo '$(srcdir)/'`animation.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-animation.Tpo $(DEPDIR)/libMLV_la-animation.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='animation.c' object='libMLV_la-animation.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-animation.lo `test -f 'animation.c' || echo '$(srcdir)/'`animation.c + +libMLV_la-audio.lo: audio.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-audio.lo -MD -MP -MF $(DEPDIR)/libMLV_la-audio.Tpo -c -o libMLV_la-audio.lo `test -f 'audio.c' || echo '$(srcdir)/'`audio.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-audio.Tpo $(DEPDIR)/libMLV_la-audio.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='audio.c' object='libMLV_la-audio.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-audio.lo `test -f 'audio.c' || echo '$(srcdir)/'`audio.c + +libMLV_la-color.lo: color.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-color.lo -MD -MP -MF $(DEPDIR)/libMLV_la-color.Tpo -c -o libMLV_la-color.lo `test -f 'color.c' || echo '$(srcdir)/'`color.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-color.Tpo $(DEPDIR)/libMLV_la-color.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='color.c' object='libMLV_la-color.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-color.lo `test -f 'color.c' || echo '$(srcdir)/'`color.c + +libMLV_la-event.lo: event.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-event.lo -MD -MP -MF $(DEPDIR)/libMLV_la-event.Tpo -c -o libMLV_la-event.lo `test -f 'event.c' || echo '$(srcdir)/'`event.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-event.Tpo $(DEPDIR)/libMLV_la-event.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='event.c' object='libMLV_la-event.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-event.lo `test -f 'event.c' || echo '$(srcdir)/'`event.c + +libMLV_la-shapes.lo: shapes.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-shapes.lo -MD -MP -MF $(DEPDIR)/libMLV_la-shapes.Tpo -c -o libMLV_la-shapes.lo `test -f 'shapes.c' || echo '$(srcdir)/'`shapes.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-shapes.Tpo $(DEPDIR)/libMLV_la-shapes.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='shapes.c' object='libMLV_la-shapes.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-shapes.lo `test -f 'shapes.c' || echo '$(srcdir)/'`shapes.c + +libMLV_la-image.lo: image.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-image.lo -MD -MP -MF $(DEPDIR)/libMLV_la-image.Tpo -c -o libMLV_la-image.lo `test -f 'image.c' || echo '$(srcdir)/'`image.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-image.Tpo $(DEPDIR)/libMLV_la-image.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='image.c' object='libMLV_la-image.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-image.lo `test -f 'image.c' || echo '$(srcdir)/'`image.c + +libMLV_la-informations.lo: informations.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-informations.lo -MD -MP -MF $(DEPDIR)/libMLV_la-informations.Tpo -c -o libMLV_la-informations.lo `test -f 'informations.c' || echo '$(srcdir)/'`informations.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-informations.Tpo $(DEPDIR)/libMLV_la-informations.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='informations.c' object='libMLV_la-informations.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-informations.lo `test -f 'informations.c' || echo '$(srcdir)/'`informations.c + +libMLV_la-keyboard.lo: keyboard.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-keyboard.lo -MD -MP -MF $(DEPDIR)/libMLV_la-keyboard.Tpo -c -o libMLV_la-keyboard.lo `test -f 'keyboard.c' || echo '$(srcdir)/'`keyboard.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-keyboard.Tpo $(DEPDIR)/libMLV_la-keyboard.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='keyboard.c' object='libMLV_la-keyboard.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-keyboard.lo `test -f 'keyboard.c' || echo '$(srcdir)/'`keyboard.c + +libMLV_la-mouse.lo: mouse.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-mouse.lo -MD -MP -MF $(DEPDIR)/libMLV_la-mouse.Tpo -c -o libMLV_la-mouse.lo `test -f 'mouse.c' || echo '$(srcdir)/'`mouse.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-mouse.Tpo $(DEPDIR)/libMLV_la-mouse.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mouse.c' object='libMLV_la-mouse.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-mouse.lo `test -f 'mouse.c' || echo '$(srcdir)/'`mouse.c + +libMLV_la-path.lo: path.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-path.lo -MD -MP -MF $(DEPDIR)/libMLV_la-path.Tpo -c -o libMLV_la-path.lo `test -f 'path.c' || echo '$(srcdir)/'`path.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-path.Tpo $(DEPDIR)/libMLV_la-path.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='path.c' object='libMLV_la-path.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-path.lo `test -f 'path.c' || echo '$(srcdir)/'`path.c + +libMLV_la-playlist.lo: playlist.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-playlist.lo -MD -MP -MF $(DEPDIR)/libMLV_la-playlist.Tpo -c -o libMLV_la-playlist.lo `test -f 'playlist.c' || echo '$(srcdir)/'`playlist.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-playlist.Tpo $(DEPDIR)/libMLV_la-playlist.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='playlist.c' object='libMLV_la-playlist.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-playlist.lo `test -f 'playlist.c' || echo '$(srcdir)/'`playlist.c + +libMLV_la-input_box.lo: input_box.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-input_box.lo -MD -MP -MF $(DEPDIR)/libMLV_la-input_box.Tpo -c -o libMLV_la-input_box.lo `test -f 'input_box.c' || echo '$(srcdir)/'`input_box.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-input_box.Tpo $(DEPDIR)/libMLV_la-input_box.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='input_box.c' object='libMLV_la-input_box.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-input_box.lo `test -f 'input_box.c' || echo '$(srcdir)/'`input_box.c + +libMLV_la-input_box_wait.lo: input_box_wait.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-input_box_wait.lo -MD -MP -MF $(DEPDIR)/libMLV_la-input_box_wait.Tpo -c -o libMLV_la-input_box_wait.lo `test -f 'input_box_wait.c' || echo '$(srcdir)/'`input_box_wait.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-input_box_wait.Tpo $(DEPDIR)/libMLV_la-input_box_wait.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='input_box_wait.c' object='libMLV_la-input_box_wait.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-input_box_wait.lo `test -f 'input_box_wait.c' || echo '$(srcdir)/'`input_box_wait.c + +libMLV_la-random.lo: random.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-random.lo -MD -MP -MF $(DEPDIR)/libMLV_la-random.Tpo -c -o libMLV_la-random.lo `test -f 'random.c' || echo '$(srcdir)/'`random.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-random.Tpo $(DEPDIR)/libMLV_la-random.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='random.c' object='libMLV_la-random.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-random.lo `test -f 'random.c' || echo '$(srcdir)/'`random.c + +libMLV_la-sdlkeyboardtochar.lo: sdlkeyboardtochar.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-sdlkeyboardtochar.lo -MD -MP -MF $(DEPDIR)/libMLV_la-sdlkeyboardtochar.Tpo -c -o libMLV_la-sdlkeyboardtochar.lo `test -f 'sdlkeyboardtochar.c' || echo '$(srcdir)/'`sdlkeyboardtochar.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-sdlkeyboardtochar.Tpo $(DEPDIR)/libMLV_la-sdlkeyboardtochar.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sdlkeyboardtochar.c' object='libMLV_la-sdlkeyboardtochar.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-sdlkeyboardtochar.lo `test -f 'sdlkeyboardtochar.c' || echo '$(srcdir)/'`sdlkeyboardtochar.c + +libMLV_la-text.lo: text.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-text.lo -MD -MP -MF $(DEPDIR)/libMLV_la-text.Tpo -c -o libMLV_la-text.lo `test -f 'text.c' || echo '$(srcdir)/'`text.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-text.Tpo $(DEPDIR)/libMLV_la-text.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='text.c' object='libMLV_la-text.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-text.lo `test -f 'text.c' || echo '$(srcdir)/'`text.c + +libMLV_la-time.lo: time.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-time.lo -MD -MP -MF $(DEPDIR)/libMLV_la-time.Tpo -c -o libMLV_la-time.lo `test -f 'time.c' || echo '$(srcdir)/'`time.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-time.Tpo $(DEPDIR)/libMLV_la-time.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='time.c' object='libMLV_la-time.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-time.lo `test -f 'time.c' || echo '$(srcdir)/'`time.c + +libMLV_la-xml.lo: xml.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-xml.lo -MD -MP -MF $(DEPDIR)/libMLV_la-xml.Tpo -c -o libMLV_la-xml.lo `test -f 'xml.c' || echo '$(srcdir)/'`xml.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-xml.Tpo $(DEPDIR)/libMLV_la-xml.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xml.c' object='libMLV_la-xml.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-xml.lo `test -f 'xml.c' || echo '$(srcdir)/'`xml.c + +libMLV_la-list.lo: list.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-list.lo -MD -MP -MF $(DEPDIR)/libMLV_la-list.Tpo -c -o libMLV_la-list.lo `test -f 'list.c' || echo '$(srcdir)/'`list.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-list.Tpo $(DEPDIR)/libMLV_la-list.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='list.c' object='libMLV_la-list.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-list.lo `test -f 'list.c' || echo '$(srcdir)/'`list.c + +libMLV_la-mathematics.lo: mathematics.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-mathematics.lo -MD -MP -MF $(DEPDIR)/libMLV_la-mathematics.Tpo -c -o libMLV_la-mathematics.lo `test -f 'mathematics.c' || echo '$(srcdir)/'`mathematics.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-mathematics.Tpo $(DEPDIR)/libMLV_la-mathematics.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mathematics.c' object='libMLV_la-mathematics.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-mathematics.lo `test -f 'mathematics.c' || echo '$(srcdir)/'`mathematics.c + +libMLV_la-key.lo: key.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-key.lo -MD -MP -MF $(DEPDIR)/libMLV_la-key.Tpo -c -o libMLV_la-key.lo `test -f 'key.c' || echo '$(srcdir)/'`key.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-key.Tpo $(DEPDIR)/libMLV_la-key.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='key.c' object='libMLV_la-key.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-key.lo `test -f 'key.c' || echo '$(srcdir)/'`key.c + +libMLV_la-tree_set.lo: tree_set.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-tree_set.lo -MD -MP -MF $(DEPDIR)/libMLV_la-tree_set.Tpo -c -o libMLV_la-tree_set.lo `test -f 'tree_set.c' || echo '$(srcdir)/'`tree_set.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-tree_set.Tpo $(DEPDIR)/libMLV_la-tree_set.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tree_set.c' object='libMLV_la-tree_set.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-tree_set.lo `test -f 'tree_set.c' || echo '$(srcdir)/'`tree_set.c + +libMLV_la-tree_map.lo: tree_map.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-tree_map.lo -MD -MP -MF $(DEPDIR)/libMLV_la-tree_map.Tpo -c -o libMLV_la-tree_map.lo `test -f 'tree_map.c' || echo '$(srcdir)/'`tree_map.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-tree_map.Tpo $(DEPDIR)/libMLV_la-tree_map.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tree_map.c' object='libMLV_la-tree_map.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-tree_map.lo `test -f 'tree_map.c' || echo '$(srcdir)/'`tree_map.c + +libMLV_la-window.lo: window.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-window.lo -MD -MP -MF $(DEPDIR)/libMLV_la-window.Tpo -c -o libMLV_la-window.lo `test -f 'window.c' || echo '$(srcdir)/'`window.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-window.Tpo $(DEPDIR)/libMLV_la-window.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='window.c' object='libMLV_la-window.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-window.lo `test -f 'window.c' || echo '$(srcdir)/'`window.c + +libMLV_la-memory_debug.lo: memory_debug.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -MT libMLV_la-memory_debug.lo -MD -MP -MF $(DEPDIR)/libMLV_la-memory_debug.Tpo -c -o libMLV_la-memory_debug.lo `test -f 'memory_debug.c' || echo '$(srcdir)/'`memory_debug.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libMLV_la-memory_debug.Tpo $(DEPDIR)/libMLV_la-memory_debug.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='memory_debug.c' object='libMLV_la-memory_debug.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMLV_la_CFLAGS) $(CFLAGS) -c -o libMLV_la-memory_debug.lo `test -f 'memory_debug.c' || echo '$(srcdir)/'`memory_debug.c + +.m.o: +@am__fastdepOBJC_TRUE@ $(AM_V_OBJC)$(OBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepOBJC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ $(AM_V_OBJC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepOBJC_FALSE@ $(AM_V_OBJC@am__nodep@)$(OBJCCOMPILE) -c -o $@ $< + +.m.obj: +@am__fastdepOBJC_TRUE@ $(AM_V_OBJC)$(OBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepOBJC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ $(AM_V_OBJC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepOBJC_FALSE@ $(AM_V_OBJC@am__nodep@)$(OBJCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.m.lo: +@am__fastdepOBJC_TRUE@ $(AM_V_OBJC)$(LTOBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepOBJC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ $(AM_V_OBJC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepOBJC_FALSE@ $(AM_V_OBJC@am__nodep@)$(LTOBJCCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-mlv_includeHEADERS: $(mlv_include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(mlv_include_HEADERS)'; test -n "$(mlv_includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(mlv_includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(mlv_includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(mlv_includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(mlv_includedir)" || exit $$?; \ + done + +uninstall-mlv_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(mlv_include_HEADERS)'; test -n "$(mlv_includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(mlv_includedir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(mlv_includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-mlv_includeHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES uninstall-mlv_includeHEADERS + +.MAKE: all install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libLTLIBRARIES \ + install-man install-mlv_includeHEADERS install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES \ + uninstall-mlv_includeHEADERS + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/MLV/SDLMain.h b/MLV/SDLMain.h new file mode 100644 index 0000000..6511fe3 --- /dev/null +++ b/MLV/SDLMain.h @@ -0,0 +1,33 @@ +/* SDLMain.m - main entry point for our Cocoa-ized SDL app + * + * Copyright (C) + * Initial Version: Darrell Walisser + * Non-NIB-Code & other changes: Max Horn + * Change "Feel free to customize this file to suit your needs" to a + * GPL licence for the MLV Library : Adrien Boussicault (2013) + * + * This file is part of the MLV Library. + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . +*/ + +#ifndef _SDLMain_h_ +#define _SDLMain_h_ + +#import + +@interface SDLMain : NSObject +@end + +#endif /* _SDLMain_h_ */ diff --git a/MLV/SDLMain.m b/MLV/SDLMain.m new file mode 100644 index 0000000..8d6199a --- /dev/null +++ b/MLV/SDLMain.m @@ -0,0 +1,398 @@ +/* SDLMain.m - main entry point for our Cocoa-ized SDL app + * + * Copyright (C) + * Initial Version: Darrell Walisser + * Non-NIB-Code & other changes: Max Horn + * Change "Feel free to customize this file to suit your needs" to a + * GPL licence for the MLV Library : Adrien Boussicault (2013) + * + * This file is part of the MLV Library. + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . +*/ + +#include "SDL/SDL.h" +#include "SDLMain.h" +#include /* for MAXPATHLEN */ +#include + +/* For some reaon, Apple removed setAppleMenu from the headers in 10.4, + but the method still is there and works. To avoid warnings, we declare + it ourselves here. */ +@interface NSApplication(SDL_Missing_Methods) +- (void)setAppleMenu:(NSMenu *)menu; +@end + +/* Use this flag to determine whether we use SDLMain.nib or not */ +#define SDL_USE_NIB_FILE 0 + +/* Use this flag to determine whether we use CPS (docking) or not */ +#define SDL_USE_CPS 1 +#ifdef SDL_USE_CPS +/* Portions of CPS.h */ +typedef struct CPSProcessSerNum +{ + UInt32 lo; + UInt32 hi; +} CPSProcessSerNum; + +extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); +extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); + +#endif /* SDL_USE_CPS */ + +static int gArgc; +static char **gArgv; +static BOOL gFinderLaunch; +static BOOL gCalledAppMainline = FALSE; + +static NSString *getApplicationName(void) +{ + const NSDictionary *dict; + NSString *appName = 0; + + /* Determine the application name */ + dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle()); + if (dict) + appName = [dict objectForKey: @"CFBundleName"]; + + if (![appName length]) + appName = [[NSProcessInfo processInfo] processName]; + + return appName; +} + +#if SDL_USE_NIB_FILE +/* A helper category for NSString */ +@interface NSString (ReplaceSubString) +- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString; +@end +#endif + +@interface NSApplication (SDLApplication) +@end + +@implementation NSApplication (SDLApplication) +/* Invoked from the Quit menu item */ +- (void)terminate:(id)sender +{ + /* Post a SDL_QUIT event */ + SDL_Event event; + event.type = SDL_QUIT; + SDL_PushEvent(&event); +} +@end + +/* The main class of the application, the application's delegate */ +@implementation SDLMain + +/* Set the working directory to the .app's parent directory */ +- (void) setupWorkingDirectory:(BOOL)shouldChdir +{ + if (shouldChdir) + { + char parentdir[MAXPATHLEN]; + CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); + CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url); + if (CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, MAXPATHLEN)) { + chdir(parentdir); /* chdir to the binary app's parent */ + } + CFRelease(url); + CFRelease(url2); + } +} + +#if SDL_USE_NIB_FILE + +/* Fix menu to contain the real app name instead of "SDL App" */ +- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName +{ + NSRange aRange; + NSEnumerator *enumerator; + NSMenuItem *menuItem; + + aRange = [[aMenu title] rangeOfString:@"SDL App"]; + if (aRange.length != 0) + [aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]]; + + enumerator = [[aMenu itemArray] objectEnumerator]; + while ((menuItem = [enumerator nextObject])) + { + aRange = [[menuItem title] rangeOfString:@"SDL App"]; + if (aRange.length != 0) + [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]]; + if ([menuItem hasSubmenu]) + [self fixMenu:[menuItem submenu] withAppName:appName]; + } +} + +#else + +static void setApplicationMenu(void) +{ + /* warning: this code is very odd */ + NSMenu *appleMenu; + NSMenuItem *menuItem; + NSString *title; + NSString *appName; + + appName = getApplicationName(); + appleMenu = [[NSMenu alloc] initWithTitle:@""]; + + /* Add menu items */ + title = [@"About " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; + + [appleMenu addItem:[NSMenuItem separatorItem]]; + + title = [@"Hide " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; + + menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; + [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; + + [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; + + [appleMenu addItem:[NSMenuItem separatorItem]]; + + title = [@"Quit " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; + + + /* Put menu into the menubar */ + menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; + [menuItem setSubmenu:appleMenu]; + [[NSApp mainMenu] addItem:menuItem]; + + /* Tell the application object that this is now the application menu */ + [NSApp setAppleMenu:appleMenu]; + + /* Finally give up our references to the objects */ + [appleMenu release]; + [menuItem release]; +} + +/* Create a window menu */ +static void setupWindowMenu(void) +{ + NSMenu *windowMenu; + NSMenuItem *windowMenuItem; + NSMenuItem *menuItem; + + windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; + + /* "Minimize" item */ + menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; + [windowMenu addItem:menuItem]; + [menuItem release]; + + /* Put menu into the menubar */ + windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; + [windowMenuItem setSubmenu:windowMenu]; + [[NSApp mainMenu] addItem:windowMenuItem]; + + /* Tell the application object that this is now the window menu */ + [NSApp setWindowsMenu:windowMenu]; + + /* Finally give up our references to the objects */ + [windowMenu release]; + [windowMenuItem release]; +} + +/* Replacement for NSApplicationMain */ +static void CustomApplicationMain (int argc, char **argv) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + SDLMain *sdlMain; + + /* Ensure the application object is initialised */ + [NSApplication sharedApplication]; + +#ifdef SDL_USE_CPS + { + CPSProcessSerNum PSN; + /* Tell the dock about us */ + if (!CPSGetCurrentProcess(&PSN)) + if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) + if (!CPSSetFrontProcess(&PSN)) + [NSApplication sharedApplication]; + } +#endif /* SDL_USE_CPS */ + + /* Set up the menubar */ + [NSApp setMainMenu:[[NSMenu alloc] init]]; + setApplicationMenu(); + setupWindowMenu(); + + /* Create SDLMain and make it the app delegate */ + sdlMain = [[SDLMain alloc] init]; + [NSApp setDelegate:sdlMain]; + + /* Start the main event loop */ + [NSApp run]; + + [sdlMain release]; + [pool release]; +} + +#endif + + +/* + * Catch document open requests...this lets us notice files when the app + * was launched by double-clicking a document, or when a document was + * dragged/dropped on the app's icon. You need to have a + * CFBundleDocumentsType section in your Info.plist to get this message, + * apparently. + * + * Files are added to gArgv, so to the app, they'll look like command line + * arguments. Previously, apps launched from the finder had nothing but + * an argv[0]. + * + * This message may be received multiple times to open several docs on launch. + * + * This message is ignored once the app's mainline has been called. + */ +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename +{ + const char *temparg; + size_t arglen; + char *arg; + char **newargv; + + if (!gFinderLaunch) /* MacOS is passing command line args. */ + return FALSE; + + if (gCalledAppMainline) /* app has started, ignore this document. */ + return FALSE; + + temparg = [filename UTF8String]; + arglen = SDL_strlen(temparg) + 1; + arg = (char *) SDL_malloc(arglen); + if (arg == NULL) + return FALSE; + + newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2)); + if (newargv == NULL) + { + SDL_free(arg); + return FALSE; + } + gArgv = newargv; + + SDL_strlcpy(arg, temparg, arglen); + gArgv[gArgc++] = arg; + gArgv[gArgc] = NULL; + return TRUE; +} + + +/* Called when the internal event loop has just started running */ +- (void) applicationDidFinishLaunching: (NSNotification *) note +{ + int status; + + /* Set the working directory to the .app's parent directory */ + [self setupWorkingDirectory:gFinderLaunch]; + +#if SDL_USE_NIB_FILE + /* Set the main menu to contain the real app name instead of "SDL App" */ + [self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()]; +#endif + + /* Hand off to main application code */ + gCalledAppMainline = TRUE; + status = SDL_main (gArgc, gArgv); + + /* We're done, thank you for playing */ + exit(status); +} +@end + + +@implementation NSString (ReplaceSubString) + +- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString +{ + unsigned int bufferSize; + unsigned int selfLen = [self length]; + unsigned int aStringLen = [aString length]; + unichar *buffer; + NSRange localRange; + NSString *result; + + bufferSize = selfLen + aStringLen - aRange.length; + buffer = (unichar *)NSAllocateMemoryPages(bufferSize*sizeof(unichar)); + + /* Get first part into buffer */ + localRange.location = 0; + localRange.length = aRange.location; + [self getCharacters:buffer range:localRange]; + + /* Get middle part into buffer */ + localRange.location = 0; + localRange.length = aStringLen; + [aString getCharacters:(buffer+aRange.location) range:localRange]; + + /* Get last part into buffer */ + localRange.location = aRange.location + aRange.length; + localRange.length = selfLen - localRange.location; + [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange]; + + /* Build output string */ + result = [NSString stringWithCharacters:buffer length:bufferSize]; + + NSDeallocateMemoryPages(buffer, bufferSize); + + return result; +} + +@end + + + +#ifdef main +# undef main +#endif + + +/* Main entry point to executable - should *not* be SDL_main! */ +int main (int argc, char **argv) +{ + /* Copy the arguments into a global variable */ + /* This is passed if we are launched by double-clicking */ + if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) { + gArgv = (char **) SDL_malloc(sizeof (char *) * 2); + gArgv[0] = argv[0]; + gArgv[1] = NULL; + gArgc = 1; + gFinderLaunch = YES; + } else { + int i; + gArgc = argc; + gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1)); + for (i = 0; i <= argc; i++) + gArgv[i] = argv[i]; + gFinderLaunch = NO; + } + +#if SDL_USE_NIB_FILE + NSApplicationMain (argc, argv); +#else + CustomApplicationMain (argc, argv); +#endif + return 0; +} + diff --git a/MLV/animation.c b/MLV/animation.c new file mode 100644 index 0000000..b592053 --- /dev/null +++ b/MLV/animation.c @@ -0,0 +1,1116 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include + +#include "platform.h" + +#ifdef OS_WINDOWS +extern int asprintf (char **, const char *, ...); +#endif + +#include "MLV_animation.h" +#include "MLV_path.h" + +#include "warning_error.h" +#include "memory_management.h" +#include "tree_map.h" + +#include "MLV_xml.h" + +//////////////////////////////////////////////// +// Animation structures +/////////////////////////////////////////////// + +typedef struct { + MLV_Image** images; // Layer of images + MLV_Sound** sounds; // Layer of images + unsigned int delay; +} Animation_frame; + +struct _MLV_Animation { + unsigned int max_frames; + unsigned int nb_frames; + unsigned int nb_layers; + unsigned int nb_channels; + Animation_frame * frames; +}; + +struct _MLV_Animation_player { + int* state_sound; + int* sounds_are_being_played; + float* volume; + const MLV_Animation * animation; + enum { STOP, PLAY, PLAY_REVERT } status; + unsigned int current_frame; + unsigned int counter; +}; + + +//////////////////////////////////////////////// +// Animation data +/////////////////////////////////////////////// + +MLV_Animation* MLV_create_animation( + unsigned int max_frames, unsigned int nb_layers, unsigned int nb_channels +){ + MLV_Animation* result = MLV_MALLOC( 1, MLV_Animation ); + result->nb_frames = 0; + result->max_frames = max_frames; + result->nb_layers = nb_layers; + result->nb_channels = nb_channels; + result->frames = MLV_MALLOC( max_frames, Animation_frame ); + int i,j; + for( i=0; i0 ){ + result->frames[i].images = MLV_MALLOC( nb_layers, MLV_Image* ); + for( j=0; jframes[i].images[j] = NULL; + } + }else{ + result->frames[i].images = NULL; + } + if( nb_channels>0 ){ + result->frames[i].sounds = MLV_MALLOC( nb_channels, MLV_Sound* ); + for( j=0; jframes[i].sounds[j] = NULL; + } + }else{ + result->frames[i].sounds = NULL; + } + } + return result; +} + +void MLV_free_animation( MLV_Animation* animation ){ + int i; + for( i=0; inb_frames; i++ ){ + MLV_FREE( animation->frames[i].images, MLV_Image* ); + MLV_FREE( animation->frames[i].sounds, MLV_Image* ); + } + MLV_FREE( animation->frames, Animation_frame ); + MLV_FREE( animation, MLV_Animation ); +} + +void user_is_modifying_animation( + MLV_Animation* animation, unsigned int position +){ + if( position < animation->max_frames ){ + if( position >= animation->nb_frames ){ + animation->nb_frames = position+1; + } + }else{ + char* text; + int error = asprintf( + &text, + "Tou can-t add or modify an image at the position %d, you have created an animation with only %d images.", + position, animation->max_frames + ); + if( error==-1){ + ERROR_FULL("Allocation memoy problem."); + } + ERROR( text ); + MLV_FREE(text, char); + } +} + +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 +){ + user_is_modifying_animation( animation, position ); + if( array_of_images ){ + int layer; + for( layer=0; layernb_layers; layer ++){ + animation->frames[ + position + ].images[layer] = array_of_images[layer]; + } + } + if( array_of_sounds ){ + int channel; + for( channel=0; channelnb_channels; channel++ ){ + animation->frames[ + position + ].sounds[channel] = array_of_sounds[channel]; + } + } + animation->frames[position].delay = delay; +} + +void MLV_add_frame_in_animation( + MLV_Image** array_of_images, MLV_Sound** array_of_sounds, unsigned int delay, + MLV_Animation* animation +){ + MLV_change_frame_in_animation( + array_of_images, array_of_sounds, delay, animation, + animation->nb_frames + ); +} + +void MLV_change_frame_image_in_animation( + MLV_Image* image, MLV_Animation* animation, + unsigned int position, unsigned int layer +){ + user_is_modifying_animation( animation, position ); + animation->frames[position].images[layer] = image; +} + +void MLV_change_frame_sound_in_animation( + MLV_Sound* sound, MLV_Animation* animation, + unsigned int position, unsigned int channel +){ + user_is_modifying_animation( animation, position ); + animation->frames[position].sounds[channel] = sound; +} + +void MLV_change_frame_delay_in_animation( + unsigned int delay, MLV_Animation* animation, + unsigned int position +){ + user_is_modifying_animation( animation, position ); + animation->frames[position].delay = delay; +} + +void MLV_get_frame_from_animation( + MLV_Animation* animation, unsigned int position, unsigned int layer, + MLV_Image** image, unsigned int* delay +){ + TODO +} + +int MLV_get_frame_delay_from_animation( + MLV_Animation* animation, unsigned int position +){ + return animation->frames[position].delay; +} + +MLV_Image* MLV_get_frame_image_from_animation( + MLV_Animation* animation, unsigned int position, + unsigned int layer +){ + return animation->frames[position].images[layer]; +} + + +//////////////////////////////////////////////// +// Animation engine +/////////////////////////////////////////////// + +MLV_Animation_player* MLV_create_animation_player( + MLV_Animation* animation +){ + int nb_channels = animation->nb_channels; + MLV_Animation_player* result = MLV_MALLOC( 1, MLV_Animation_player ); + if( nb_channels>0 ){ + result->volume = MLV_MALLOC( nb_channels, float ); + result->state_sound = MLV_MALLOC( nb_channels, int ); + result->sounds_are_being_played = MLV_MALLOC( nb_channels, int ); + int channel; + for( channel=0; channelvolume[channel]=0; + result->state_sound[channel] = 0; + result->sounds_are_being_played[channel] = 0; + } + }else{ + result->volume = NULL; + result->state_sound = NULL; + result->sounds_are_being_played = NULL; + } + result->animation = animation; + MLV_rewind_animation_player( result ); + return result; +} +void MLV_free_animation_player( MLV_Animation_player* animation_player ){ + MLV_FREE( animation_player->volume, float ); + MLV_FREE( animation_player->state_sound, int ); + MLV_FREE( animation_player->sounds_are_being_played, int ); + MLV_FREE( animation_player, MLV_Animation_player ); +} + +void MLV_play_animation_player( MLV_Animation_player* animation_player ){ + animation_player->status = PLAY; +} +void MLV_play_revert_animation_player( MLV_Animation_player* animation_player ){ + animation_player->status = PLAY_REVERT; +} +void MLV_stop_animation_player( MLV_Animation_player* animation_player ){ + animation_player->status = STOP; +} +void MLV_rewind_animation_player( MLV_Animation_player* animation_player ){ + animation_player->current_frame = 0; + animation_player->counter = 0; + MLV_stop_animation_player( animation_player ); +} +void MLV_next_frame( MLV_Animation_player* animation_player ){ + /* Retour à la frame 0 si nous sommes à la dernière */ + if( + ++animation_player->current_frame == + animation_player->animation->nb_frames + ){ + animation_player->current_frame = 0; + } + animation_player->counter = 0; +} +void MLV_previous_frame( + MLV_Animation_player* animation_player +){ + /* Retour à la frame 0 si nous sommes à la dernière */ + if ( --animation_player->current_frame == -1 ){ + animation_player->current_frame = + animation_player->animation->nb_frames-1; + } + animation_player->counter = 0; +} + +void MLV_update_animation_player( MLV_Animation_player* animation_player ){ + const Animation_frame * frame; + + if( animation_player->status == STOP ) return; + + frame = &animation_player->animation->frames[ + animation_player->current_frame + ]; + + if (frame->delay == 0) return; + + // Passage à la frame suivante + if( ++animation_player->counter == frame->delay ){ + switch( animation_player->status ){ + case PLAY: + MLV_next_frame(animation_player); + break; + case PLAY_REVERT: + MLV_previous_frame(animation_player); + break; + default: + return; + } + // Remise à 0 de l'état des sons qui ont déjà été joués. + int channel; + if( animation_player->sounds_are_being_played ){ + for( + channel=0; channel < animation_player->animation->nb_channels; + channel++ + ){ + animation_player->sounds_are_being_played[channel] = 0; + } + } + } +} + + +void MLV_change_sound_volume_of_animation_player( + MLV_Animation_player* animation_player, unsigned int channel, float volume +){ + animation_player->volume[channel]=volume; +} + + +void MLV_turn_off_sound_of_animation_player( + MLV_Animation_player* animation_player, unsigned int channel +){ + animation_player->state_sound[channel]=0; +} + +void MLV_turn_on_sound_of_animation_player( + MLV_Animation_player* animation_player, unsigned int channel +){ + animation_player->state_sound[channel]=1; +} + + +//////////////////////////////////////////////// +// Drawing animation +/////////////////////////////////////////////// + +void MLV_draw_image_from_animation_player( + MLV_Animation_player* animation_player, unsigned int layer, + int x, int y +){ + MLV_draw_image( + animation_player->animation->frames[ + animation_player->current_frame + ].images[layer], + x,y + ); +} + +void MLV_draw_image_from_animation_player_on_image( + MLV_Animation_player* animation_player, unsigned int layer, + MLV_Image* image, + int x, int y +){ + MLV_draw_image_on_image( + animation_player->animation->frames[ + animation_player->current_frame + ].images[layer], + image, + x,y + ); +} + +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 +){ + MLV_draw_partial_image_on_image( + animation_player->animation->frames[ + animation_player->current_frame + ].images[layer], + source_x, source_y, source_width, source_height, + image, + x, y + ); +} + +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 +){ + MLV_draw_partial_image( + animation_player->animation->frames[ + animation_player->current_frame + ].images[layer], + source_x, source_y, source_width, source_height, + x, y + ); +} + +//////////////////////////////////////////////// +// Playing sounds of animation +/////////////////////////////////////////////// + +void MLV_play_sound_from_animation_player( + MLV_Animation_player* animation_player, unsigned int channel +){ + const Animation_frame* frame = &animation_player->animation->frames[ + animation_player->current_frame + ]; + if( + animation_player->sounds_are_being_played && + ! animation_player->sounds_are_being_played[channel] + ){ + MLV_Sound* sound = frame->sounds[channel]; + if( animation_player->state_sound[channel] && sound ){ + MLV_play_sound( sound, animation_player->volume[channel] ); + } + animation_player->sounds_are_being_played[channel] = 1; + } +} + +void MLV_play_sounds_from_animation_player( + MLV_Animation_player* animation_player, + ... +){ + va_list pile; + va_start( pile, animation_player ); + + int layer; + layer = va_arg( pile, int ); + while( layer >= 0 ) { + MLV_play_sound_from_animation_player( + animation_player, layer + ); + layer = va_arg( pile, int ); + } + + va_end( pile ); +} + +void MLV_play_list_of_sounds_from_animation_player( + MLV_Animation_player* animation_player, unsigned int* layers, + unsigned int nb_layers +){ + int i; + for( i=0; i< nb_layers; i++ ){ + MLV_play_sound_from_animation_player( + animation_player, layers[i] + ); + } +} + + + + +//////////////////////////////////////////////// +// Loading animations from files +// stored in animation books. +/////////////////////////////////////////////// + +typedef struct _Animation_book_sound { + char* name; + MLV_Sound** channels; +} Animation_book_sound; + +typedef struct _Animation_book_page { + int width; + int height; + int columns; + MLV_Image** layers; +} Animation_book_page; + +struct _MLV_Animation_book { + char* xml_file; + + int nb_channels; + MLV_TreeMap* channel_name_to_id; + char** channel_names; + + int nb_layers; + MLV_TreeMap* layer_name_to_id; + char** layer_names; + + int nb_pages; + MLV_TreeMap* page_name_to_id; + char** page_names; + Animation_book_page* pages; + + int nb_sounds; + MLV_TreeMap* sound_name_to_id; + char** sound_names; + Animation_book_sound* sounds; + + int nb_animations; + MLV_TreeMap* animation_name_to_id; + char** animation_names; + MLV_Animation** animations; + +}; + +int MLV_get_number_of_animations( + MLV_Animation_book* animation_book +){ + return animation_book->nb_animations; +} + +void destroy_int( void* data ){ + int* ptr = (int*) data; + MLV_FREE( ptr, int ); +} + +void insert_data_in_map( MLV_TreeMap* map, char* name, int identifiant ){ + int* id = MLV_MALLOC( 1, int ); + *id = identifiant; + MLV_add_data_in_tree_map( + MLV_string_to_key(name), id, destroy_int, map + ); +} + +MLV_Animation_book* MLV_load_animation_book( + const char* xml_file, + const char* image_directory, + const char* sound_directory +){ + int i; + MLV_Animation_book* result; + + if( ! MLV_path_exists( xml_file ) ){ + fprintf( + stderr, + "The xml file %s doesn't exists.\n", + xml_file + ); + return NULL; + } + if( + image_directory && + ( ! strcmp( image_directory, "" ) ) && + MLV_path_exists( image_directory ) + ){ + fprintf( + stderr, + "The image directory %s doesn't exists.\n", + image_directory + ); + return NULL; + } + if( + sound_directory && + ( ! strcmp( sound_directory, "" ) ) && + MLV_path_exists( sound_directory ) + ){ + fprintf( + stderr, + "The sound directory %s doesn't exists.\n", + sound_directory + ); + return NULL; + } + + char* dirname = MLV_get_directory_name( xml_file ); + + MLV_Xml* xml = MLV_load_xml( xml_file ); + + if( !xml ) return NULL; + + result = MLV_MALLOC( 1, MLV_Animation_book ); + + result->nb_animations = MLV_get_number_of_objects_from_xml( + xml, "/animation_book/animation" + ); + result->animations = MLV_MALLOC( + result->nb_animations, MLV_Animation* + ); + result->animation_names = MLV_MALLOC( + result->nb_animations, char* + ); + result->animation_name_to_id = MLV_create_tree_map(); + for( i=0; inb_animations; i++ ){ + if( MLV_get_string_value_from_xml( + xml, + &(result->animation_names[i]), + "/animation_book/animation[%d]/name", i+1 + ) ){ + fprintf( + stderr, + "The animation book xml is corrupted. The Field /animation_book/animation[%d]/name doesn't exist.\n", + i+1 + ); + exit(0); + }; + insert_data_in_map( + result->animation_name_to_id, result->animation_names[i], i + ); + } + + result->nb_layers = MLV_get_number_of_objects_from_xml( + xml, "/animation_book/layers/layer" + ); + result->layer_names = MLV_MALLOC( + result->nb_layers, char* + ); + result->layer_name_to_id = MLV_create_tree_map(); + for( i=0; inb_layers; i++ ){ + if( + MLV_get_string_value_from_xml( + xml, &(result->layer_names[i]), "/animation_book/layers/layer[%d]", i+1 + ) + ){ + fprintf( + stderr, + "The animation book xml is corrupted. The Field /animation_book/layers/layer[%d] doesn't exist.\n", + i+1 + ); + exit(0); + } + insert_data_in_map( + result->layer_name_to_id, result->layer_names[i], i + ); + } + + result->nb_channels = MLV_get_number_of_objects_from_xml( + xml, "/animation_book/channels/channel" + ); + result->channel_names = MLV_MALLOC( + result->nb_channels, char* + ); + result->channel_name_to_id = MLV_create_tree_map(); + for( i=0; inb_channels; i++ ){ + if( + MLV_get_string_value_from_xml( + xml, + &(result->channel_names[i]), + "/animation_book/channels/channel[%d]", i+1 + ) + ){ + fprintf( + stderr, + "The animation book xml is corrupted. The Field /animation_book/channels/channel[%d] doesn't exist.\n", + i+1 + ); + exit(0); + }; + insert_data_in_map( + result->channel_name_to_id, result->channel_names[i], i + ); + } + + + result->nb_pages = MLV_get_number_of_objects_from_xml( + xml, "/animation_book/page" + ); + result->page_names = MLV_MALLOC( + result->nb_pages, char* + ); + result->page_name_to_id = MLV_create_tree_map(); + for( i=0; inb_pages; i++ ){ + if( + MLV_get_string_value_from_xml( + xml, &(result->page_names[i]),"/animation_book/page[%d]/name", i+1 + ) + ){ + fprintf( + stderr, + "The animation book xml is corrupted. The Field /animation_book/page[%d]/name doesn't exist.\n", + i+1 + ); + exit(0); + }; + insert_data_in_map( + result->page_name_to_id, result->page_names[i], i + ); + } + result->pages = MLV_MALLOC( + result->nb_pages, Animation_book_page + ); + + result->nb_sounds = MLV_get_number_of_objects_from_xml( + xml, "/animation_book/sound" + ); + result->sound_names = MLV_MALLOC( + result->nb_sounds, char* + ); + result->sound_name_to_id = MLV_create_tree_map(); + for( i=0; inb_sounds; i++ ){ + if( + MLV_get_string_value_from_xml( + xml, &(result->sound_names[i]), "/animation_book/sound[%d]/name", i+1 + ) + ){ + fprintf( + stderr, + "The animation book xml is corrupted. The Field /animation_book/sound[%d]/name doesn't exist.\n", + i+1 + ); + exit(0); + } + insert_data_in_map( + result->sound_name_to_id, result->sound_names[i], i + ); + } + result->sounds = MLV_MALLOC( + result->nb_sounds, Animation_book_sound + ); + + int nb_layers = result->nb_layers; + int nb_channels = result->nb_channels; + int nb_pages = result->nb_pages; + int nb_sounds = result->nb_sounds; + int nb_animations = result->nb_animations; + + int id_page; + for( id_page=0; id_pagepages[id_page].width), "/animation_book/page[%d]/width", id_page+1 + ) || + MLV_get_integer_value_from_xml( + xml, &(result->pages[id_page].height), "/animation_book/page[%d]/height", id_page+1 + ) || + MLV_get_integer_value_from_xml( + xml, &(result->pages[id_page].columns), "/animation_book/page[%d]/columns", id_page+1 + ) + ){ + fprintf( + stderr, + "The animation book xml is corrupted. One of those fields /animation_book/page[%d]/width or /animation_book/page[%d]/height or /animation_book/page[%d]/columns are missing or are not integers.\n", + id_page+1, + id_page+1, + id_page+1 + ); + exit(0); + }; + result->pages[id_page].layers = MLV_MALLOC( nb_layers, MLV_Image* ); + for( i=0; i < nb_layers; i++ ){ + result->pages[id_page].layers[i] = NULL; + } + + int nb_images = MLV_get_number_of_objects_from_xml( + xml, "/animation_book/page[%d]/image", id_page+1 + ); + int image; + for( image=0; image < nb_images; image++ ){ + char* layer; + char* file; + if( + MLV_get_string_value_from_xml( + xml, &(layer), "/animation_book/page[%d]/image[%d]/layer", id_page+1, + image+1 + ) || + MLV_get_string_value_from_xml( + xml, &(file), "/animation_book/page[%d]/image[%d]/file", id_page+1, + image+1 + ) + ){ + fprintf( + stderr, + "The animation book xml is corrupted. One of those Fields : /animation_book/page[%d]/image[%d]/layer or /animation_book/page[%d]/image[%d]/file are missing.\n", + id_page+1, image+1, + id_page+1, image+1 + ); + exit(0); + } + MLV_Key* key = MLV_string_to_key( layer ); + int id_layer = *( + (int*) MLV_get_data_from_tree_map( + key, result->layer_name_to_id + ) + ); + MLV_free_key( key ); + + char* full_path; + if( MLV_path_is_absolute( file ) ){ + full_path = MLV_build_path( + file, NULL + ); + }else{ + if( image_directory ){ + full_path = MLV_build_path( + image_directory, file, NULL + ); + }else{ + full_path = MLV_build_path( dirname, file, NULL ); + } + } + if( ! MLV_path_exists( full_path ) ){ + fprintf( + stderr, + "The file %s doesn't exist.\n", + full_path + ); + exit(0); + } + MLV_Image* image = MLV_load_image( full_path ); + if( ! image ){ + fprintf( + stderr, + "The file %s is an unknow image or is corrupted.\n", + full_path + ); + exit(0); + } + result->pages[id_page].layers[ id_layer ] = image; + MLV_FREE( full_path, char ); + + MLV_FREE( layer, char ); + MLV_FREE( file, char ); + } + + } + + + int id_sound; + for( id_sound=0; id_soundsounds[id_sound].channels = MLV_MALLOC( nb_channels, MLV_Sound* ); + for( i=0; i < nb_channels; i++ ){ + result->sounds[id_sound].channels[i] = NULL; + } + + int nb_samples = MLV_get_number_of_objects_from_xml( + xml, "/animation_book/sound[%d]/sample", id_sound+1 + ); + int sample; + for( sample=0; sample < nb_samples; sample++ ){ + char* channel; + char* file; + if( + MLV_get_string_value_from_xml( + xml, &(channel), "/animation_book/sound[%d]/sample[%d]/channel", id_sound+1, + sample+1 + ) || + MLV_get_string_value_from_xml( + xml, &(file), "/animation_book/sound[%d]/sample[%d]/file", id_sound+1, + sample+1 + ) + ){ + fprintf( + stderr, + "The animation book xml is corrupted. One of those Fields : /animation_book/sound[%d]/sample[%d]/channel or /animation_book/sound[%d]/sample[%d]/file are missing.\n", + id_sound+1, sample+1, + id_sound+1, sample+1 + ); + exit(0); + } + MLV_Key* key = MLV_string_to_key( channel ); + int id_channel = *( + (int*) MLV_get_data_from_tree_map( + key, result->channel_name_to_id + ) + ); + MLV_free_key( key ); + + + char* full_path; + if( MLV_path_is_absolute( file ) ){ + full_path = MLV_build_path( + file, NULL + ); + }else{ + if( sound_directory ){ + full_path = MLV_build_path( + sound_directory, file, NULL + ); + }else{ + full_path = MLV_build_path( dirname, file, NULL ); + } + } + if( ! MLV_path_exists( full_path ) ){ + fprintf( + stderr, + "The file %s doesn't exist.\n", + full_path + ); + exit(0); + } + MLV_Sound* sound = MLV_load_sound( full_path ); + if( ! sound ){ + fprintf( + stderr, + "The sound file %s are unknwon or corrupted.\n", + full_path + ); + exit(0); + } + result->sounds[id_sound].channels[ id_channel ] = sound; + MLV_FREE( full_path, char ); + + MLV_FREE( channel, char ); + MLV_FREE( file, char ); + } + } + + + int id_animation; + for( id_animation=0; id_animationpage_name_to_id + ) + ); + MLV_free_key( key ); + int width = result->pages[id_page].width; + int height = result->pages[id_page].height; + int columns = result->pages[id_page].columns; + int nb_frames = MLV_get_number_of_objects_from_xml( + xml, "/animation_book/animation[%d]/frame", id_animation+1 + ); + result->animations[ + id_animation + ] = MLV_create_animation( nb_frames, nb_layers, nb_channels ); + int id_frame; + for( id_frame=0; id_frame < nb_frames; id_frame++ ){ + MLV_Sound** sounds = NULL; + MLV_Image** images = NULL; + char* sound; + MLV_get_string_value_from_xml( + xml, &(sound), "/animation_book/animation[%d]/frame[%d]/sound", + id_animation+1, id_frame+1 + ); + if( sound ){ + MLV_Key* key = MLV_string_to_key( sound ); + int id_sound = *( + (int*) MLV_get_data_from_tree_map( + key, result->sound_name_to_id + ) + ); + MLV_free_key( key ); + sounds = result->sounds[id_sound].channels; + } + int panel; + if( + MLV_get_integer_value_from_xml( + xml, &(panel), "/animation_book/animation[%d]/frame[%d]/panel", + id_animation+1, id_frame+1 + ) + ){ + fprintf( + stderr, + "The animation book xml is corrupted. The field : /animation_book/animation[%d]/frame[%d]/panel is missing or is not an integer.\n", + id_animation+1, id_frame+1 + ); + exit(0); + } + images = MLV_MALLOC( nb_layers ,MLV_Image* ); + int id_layer; + for( id_layer=0; id_layerpages[id_page].layers[id_layer]){ + images[id_layer] = MLV_copy_partial_image( + result->pages[id_page].layers[id_layer], + x, y, width, height + ); + }else{ + images[id_layer] = NULL; + } + } + int time; + if( + MLV_get_integer_value_from_xml( + xml, &(time), "/animation_book/animation[%d]/frame[%d]/time", + id_animation+1, id_frame+1 + ) + ){ + fprintf( + stderr, + "The animation book xml is corrupted. The field : /animation_book/animation[%d]/frame[%d]/time is missing or is not an integer.\n", + id_animation+1, id_frame+1 + ); + exit(0); + }; + MLV_add_frame_in_animation( + images, sounds, time, result->animations[id_animation] + ); + MLV_FREE( images, MLV_Image* ); + MLV_FREE( sound, char ); + } + } + + MLV_FREE( dirname, char ); + MLV_free_xml( xml ); + + return result; +} + +void MLV_free_animation_book( + MLV_Animation_book* animation_book +){ + if( !animation_book ) return; + + int i; + + int id_animation; + for( id_animation=0; id_animation < animation_book->nb_animations; + id_animation++ + ){ + MLV_Animation* animation; + animation = animation_book->animations[id_animation]; + int id_frame; + for( id_frame=0; id_frame < animation->nb_frames; id_frame++ ){ + int id_layer; + MLV_Image** images = animation->frames[id_frame].images; + for( id_layer=0; id_layernb_layers; id_layer++ ){ + if( images[id_layer] ){ + MLV_free_image( images[id_layer] ); + } + } + } + MLV_free_animation( animation ); + } + + + int id_sound; + for( id_sound=0; id_sound< animation_book->nb_sounds; id_sound++ ){ + int id_channel; + for( + id_channel=0; id_channel < animation_book->nb_channels; + id_channel++ + ){ + if( animation_book->sounds[id_sound].channels[ id_channel ] ){ + MLV_free_sound( + animation_book->sounds[id_sound].channels[id_channel] + ); + } + } + MLV_FREE( animation_book->sounds[id_sound].channels, MLV_Image* ); + } + MLV_free_tree_map( animation_book->sound_name_to_id ); + for( i=0; inb_sounds; i++ ){ + MLV_FREE( animation_book->sound_names[i], char ); + } + MLV_FREE( animation_book->sound_names, char* ); + MLV_FREE( animation_book->sounds, Animation_book_sound ); + + int id_page; + for( id_page=0; id_page< animation_book->nb_pages; id_page++ ){ + int id_layer; + for( id_layer=0; id_layer < animation_book->nb_layers; id_layer++ ){ + if( animation_book->pages[id_page].layers[ id_layer ] ){ + MLV_free_image( + animation_book->pages[id_page].layers[id_layer] + ); + } + } + MLV_FREE( animation_book->pages[id_page].layers, MLV_Image* ); + } + MLV_free_tree_map( animation_book->page_name_to_id ); + for( i=0; inb_pages; i++ ){ + MLV_FREE( animation_book->page_names[i], char ); + } + MLV_FREE( animation_book->page_names, char* ); + MLV_FREE( animation_book->pages, Animation_book_page ); + + MLV_free_tree_map( animation_book->channel_name_to_id ); + for( i=0; inb_channels; i++ ){ + MLV_FREE( animation_book->channel_names[i], char ); + } + MLV_FREE( animation_book->channel_names, char* ); + + MLV_free_tree_map( animation_book->layer_name_to_id ); + for( i=0; inb_layers; i++ ){ + MLV_FREE( animation_book->layer_names[i], char ); + } + MLV_FREE( animation_book->layer_names, char* ); + + MLV_free_tree_map( animation_book->animation_name_to_id ); + for( i=0; inb_animations; i++ ){ + MLV_FREE( animation_book->animation_names[i], char ); + } + MLV_FREE( animation_book->animation_names, char* ); + MLV_FREE( animation_book->animations, MLV_Animation* ); + + MLV_FREE( animation_book, MLV_Animation_book ); +} + +MLV_Animation* MLV_get_animation_from_id( + MLV_Animation_book* animation_book, + int id +){ + return animation_book->animations[id]; +} + +MLV_Animation* MLV_get_animation_from_name( + MLV_Animation_book* animation_book, + const char* name +){ + MLV_Key* key = MLV_string_to_key( name ); + int* id_ptr =(int*) MLV_get_data_from_tree_map( + key, animation_book->animation_name_to_id + ); + MLV_free_key( key ); + if( !id_ptr ) return NULL; + return MLV_get_animation_from_id( animation_book, *id_ptr ); +} + +const char* MLV_get_name_from_id_animation( + MLV_Animation_book* animation_book, int id_animation +){ + return animation_book->animation_names[ id_animation ]; +} + diff --git a/MLV/audio.c b/MLV/audio.c new file mode 100644 index 0000000..73ba016 --- /dev/null +++ b/MLV/audio.c @@ -0,0 +1,149 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "MLV_audio.h" + +#include "warning_error.h" + +#include "memory_management.h" + +#include "data_structure.h" + +#include "platform.h" + +#if defined( OS_WINDOWS ) +# include +#elif defined( OS_APPLE ) +# include +#else +# include +#endif + +#include + +extern DataMLV* MLV_data; + +struct _MLV_Music { + Mix_Music* music; +}; + +struct _MLV_Sound { + Mix_Chunk* sample; +}; + +struct _MLV_Playlist { + GList* list_music; +}; + +#define MLV_AUDIO_BUFFER_SIZE 1024 +#define MLV_AUDIO_STEREO 2 +#define MLV_AUDIO_NUMBER_OF_MIXING_CHANEL 16 + +int init_audio( int buffer_size ){ + int result = Mix_OpenAudio( + MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, MLV_AUDIO_STEREO, buffer_size + ); + if( !result ){ + Mix_AllocateChannels(MLV_AUDIO_NUMBER_OF_MIXING_CHANEL); + } + return result; +} + +void MLV_change_number_of_parallel_sounds( unsigned int n ){ + if( ! n ){ + fprintf( stderr, "Incorrect parameter for MLV_change_number_playing_parallel_sounds. The number of parrallel sound can't be null." ); + exit(1); + } + Mix_AllocateChannels( n ); +} + +int MLV_init_audio(){ + return init_audio( MLV_AUDIO_BUFFER_SIZE ); // If the sound are not well + // former, increse this value. + // If the sound have some lags, the you have + // to decrease this value. +} + +int MLV_change_audio_buffer_size( int buffer_size ){ + MLV_free_audio(); + return init_audio( buffer_size ); +} + +void MLV_free_audio(){ + Mix_HaltChannel(-1); + Mix_HaltMusic(); + Mix_CloseAudio(); +} + +MLV_Music* MLV_load_music( const char* file_music ){ + MLV_Music* result = MLV_MALLOC( 1, MLV_Music ); + result->music= Mix_LoadMUS( file_music ); + if(! result->music) { + MLV_FREE( result, MLV_Music ); + result = NULL; + } + return result; +} + +void MLV_free_music( MLV_Music* music ){ + if( music ){ + Mix_FreeMusic( music->music ); + MLV_FREE( music, MLV_Music ); + } +} + +void MLV_play_music( const MLV_Music* music, float volume, int loop ){ + Mix_VolumeMusic( volume * MIX_MAX_VOLUME ); + MLV_stop_music(); + if( loop ) Mix_PlayMusic( music->music, loop-1 ); +} + +void MLV_stop_music(){ + Mix_HaltMusic(); +} + +MLV_Sound* MLV_load_sound( const char* file_sound ){ + MLV_Sound* result = MLV_MALLOC( 1, MLV_Sound ); + result->sample = Mix_LoadWAV( file_sound ); + if(! result->sample ){ + MLV_FREE( result, MLV_Sound ); + result = NULL; + }else{ + Mix_VolumeChunk( result->sample, MIX_MAX_VOLUME ); + } + return result; +} + +void MLV_free_sound( MLV_Sound* sound ){ + if( sound ){ + Mix_FreeChunk( sound->sample ); + MLV_FREE( sound, MLV_Sound ); + } +} + +void MLV_play_sound( const MLV_Sound* sound, float volume ){ + int channel = Mix_PlayChannel( -1, sound->sample, 0 ); + Mix_Volume(channel, volume * MIX_MAX_VOLUME); +} + +void MLV_stop_all_sounds(){ + Mix_HaltChannel(-1); +} + diff --git a/MLV/color.c b/MLV/color.c new file mode 100644 index 0000000..0a8f81b --- /dev/null +++ b/MLV/color.c @@ -0,0 +1,4589 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "MLV_color.h" + +#include "memory_management.h" + +#include "warning_error.h" + +/******************************************************************************/ +/* RGBA : Converti une couleur RGBA encodee à l'aide de 4 entiers 8 bits en */ +/* en une couleur encodee a l'aide d'1 entier 16 bits. */ +/* */ +/* Dans la bibliothèque SDL_GFX les couleurs sont encodées sur */ +/* 32 bits : 8 bits pour la composante en rouge de */ +/* l'image (R), 8 bits pour la composante verte (G), 8 bit */ +/* pour la composante bleu (B) et enfin 8 bits pour la */ +/* composante alpha qui correspond a la transparence (A) */ +/* */ +/* MLV_Color Couleur codee sur un entier 32 bits */ +/* rgba ( */ +/* Uint8 red, Composante rouge de la couleur */ +/* Uint8 greene, Composante verte de la couleur */ +/* Uint8 blue, Composante bleu de la couleur */ +/* Uint8 alpha) Transparence de la couleur */ +/******************************************************************************/ +MLV_Color MLV_rgba( + Uint8 red, + Uint8 green, + Uint8 blue, + Uint8 alpha +){ + return (((((( (MLV_Color) red) << 8) + green) << 8) + blue) << 8) + alpha; +} + +MLV_Color MLV_convert_rgba_to_color( + Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha +){ + return MLV_rgba( red, green, blue, alpha ); +} + +void MLV_convert_color_to_rgba( + MLV_Color color, Uint8* red, Uint8* green, Uint8* blue, Uint8* alpha +){ + *alpha = color; + color = color >> 8; *blue = color; + color = color >> 8; *green = color; + color = color >> 8; *red = color; +} + +const char* MLV_convert_color_to_string( MLV_Color color ){ + if( color == MLV_COLOR_SNOW ){ + return "MLV_COLOR_SNOW"; + } + if( color == MLV_COLOR_GHOST_WHITE ){ + return "MLV_COLOR_GHOST_WHITE"; + } + if( color == MLV_COLOR_GHOSTWHITE ){ + return "MLV_COLOR_GHOSTWHITE"; + } + if( color == MLV_COLOR_WHITE_SMOKE ){ + return "MLV_COLOR_WHITE_SMOKE"; + } + if( color == MLV_COLOR_WHITESMOKE ){ + return "MLV_COLOR_WHITESMOKE"; + } + if( color == MLV_COLOR_GAINSBORO ){ + return "MLV_COLOR_GAINSBORO"; + } + if( color == MLV_COLOR_FLORAL_WHITE ){ + return "MLV_COLOR_FLORAL_WHITE"; + } + if( color == MLV_COLOR_FLORALWHITE ){ + return "MLV_COLOR_FLORALWHITE"; + } + if( color == MLV_COLOR_OLD_LACE ){ + return "MLV_COLOR_OLD_LACE"; + } + if( color == MLV_COLOR_OLDLACE ){ + return "MLV_COLOR_OLDLACE"; + } + if( color == MLV_COLOR_LINEN ){ + return "MLV_COLOR_LINEN"; + } + if( color == MLV_COLOR_ANTIQUE_WHITE ){ + return "MLV_COLOR_ANTIQUE_WHITE"; + } + if( color == MLV_COLOR_ANTIQUEWHITE ){ + return "MLV_COLOR_ANTIQUEWHITE"; + } + if( color == MLV_COLOR_PAPAYA_WHIP ){ + return "MLV_COLOR_PAPAYA_WHIP"; + } + if( color == MLV_COLOR_PAPAYAWHIP ){ + return "MLV_COLOR_PAPAYAWHIP"; + } + if( color == MLV_COLOR_BLANCHED_ALMOND ){ + return "MLV_COLOR_BLANCHED_ALMOND"; + } + if( color == MLV_COLOR_BLANCHEDALMOND ){ + return "MLV_COLOR_BLANCHEDALMOND"; + } + if( color == MLV_COLOR_BISQUE ){ + return "MLV_COLOR_BISQUE"; + } + if( color == MLV_COLOR_PEACH_PUFF ){ + return "MLV_COLOR_PEACH_PUFF"; + } + if( color == MLV_COLOR_PEACHPUFF ){ + return "MLV_COLOR_PEACHPUFF"; + } + if( color == MLV_COLOR_NAVAJO_WHITE ){ + return "MLV_COLOR_NAVAJO_WHITE"; + } + if( color == MLV_COLOR_NAVAJOWHITE ){ + return "MLV_COLOR_NAVAJOWHITE"; + } + if( color == MLV_COLOR_MOCCASIN ){ + return "MLV_COLOR_MOCCASIN"; + } + if( color == MLV_COLOR_CORNSILK ){ + return "MLV_COLOR_CORNSILK"; + } + if( color == MLV_COLOR_IVORY ){ + return "MLV_COLOR_IVORY"; + } + if( color == MLV_COLOR_LEMON_CHIFFON ){ + return "MLV_COLOR_LEMON_CHIFFON"; + } + if( color == MLV_COLOR_LEMONCHIFFON ){ + return "MLV_COLOR_LEMONCHIFFON"; + } + if( color == MLV_COLOR_SEASHELL ){ + return "MLV_COLOR_SEASHELL"; + } + if( color == MLV_COLOR_HONEYDEW ){ + return "MLV_COLOR_HONEYDEW"; + } + if( color == MLV_COLOR_MINT_CREAM ){ + return "MLV_COLOR_MINT_CREAM"; + } + if( color == MLV_COLOR_MINTCREAM ){ + return "MLV_COLOR_MINTCREAM"; + } + if( color == MLV_COLOR_AZURE ){ + return "MLV_COLOR_AZURE"; + } + if( color == MLV_COLOR_ALICE_BLUE ){ + return "MLV_COLOR_ALICE_BLUE"; + } + if( color == MLV_COLOR_ALICEBLUE ){ + return "MLV_COLOR_ALICEBLUE"; + } + if( color == MLV_COLOR_LAVENDER ){ + return "MLV_COLOR_LAVENDER"; + } + if( color == MLV_COLOR_LAVENDER_BLUSH ){ + return "MLV_COLOR_LAVENDER_BLUSH"; + } + if( color == MLV_COLOR_LAVENDERBLUSH ){ + return "MLV_COLOR_LAVENDERBLUSH"; + } + if( color == MLV_COLOR_MISTY_ROSE ){ + return "MLV_COLOR_MISTY_ROSE"; + } + if( color == MLV_COLOR_MISTYROSE ){ + return "MLV_COLOR_MISTYROSE"; + } + if( color == MLV_COLOR_WHITE ){ + return "MLV_COLOR_WHITE"; + } + if( color == MLV_COLOR_BLACK ){ + return "MLV_COLOR_BLACK"; + } + if( color == MLV_COLOR_DARK_SLATE_GRAY ){ + return "MLV_COLOR_DARK_SLATE_GRAY"; + } + if( color == MLV_COLOR_DARKSLATEGRAY ){ + return "MLV_COLOR_DARKSLATEGRAY"; + } + if( color == MLV_COLOR_DARK_SLATE_GREY ){ + return "MLV_COLOR_DARK_SLATE_GREY"; + } + if( color == MLV_COLOR_DARKSLATEGREY ){ + return "MLV_COLOR_DARKSLATEGREY"; + } + if( color == MLV_COLOR_DIM_GRAY ){ + return "MLV_COLOR_DIM_GRAY"; + } + if( color == MLV_COLOR_DIMGRAY ){ + return "MLV_COLOR_DIMGRAY"; + } + if( color == MLV_COLOR_DIM_GREY ){ + return "MLV_COLOR_DIM_GREY"; + } + if( color == MLV_COLOR_DIMGREY ){ + return "MLV_COLOR_DIMGREY"; + } + if( color == MLV_COLOR_SLATE_GRAY ){ + return "MLV_COLOR_SLATE_GRAY"; + } + if( color == MLV_COLOR_SLATEGRAY ){ + return "MLV_COLOR_SLATEGRAY"; + } + if( color == MLV_COLOR_SLATE_GREY ){ + return "MLV_COLOR_SLATE_GREY"; + } + if( color == MLV_COLOR_SLATEGREY ){ + return "MLV_COLOR_SLATEGREY"; + } + if( color == MLV_COLOR_LIGHT_SLATE_GRAY ){ + return "MLV_COLOR_LIGHT_SLATE_GRAY"; + } + if( color == MLV_COLOR_LIGHTSLATEGRAY ){ + return "MLV_COLOR_LIGHTSLATEGRAY"; + } + if( color == MLV_COLOR_LIGHT_SLATE_GREY ){ + return "MLV_COLOR_LIGHT_SLATE_GREY"; + } + if( color == MLV_COLOR_LIGHTSLATEGREY ){ + return "MLV_COLOR_LIGHTSLATEGREY"; + } + if( color == MLV_COLOR_GRAY ){ + return "MLV_COLOR_GRAY"; + } + if( color == MLV_COLOR_GREY ){ + return "MLV_COLOR_GREY"; + } + if( color == MLV_COLOR_LIGHT_GREY ){ + return "MLV_COLOR_LIGHT_GREY"; + } + if( color == MLV_COLOR_LIGHTGREY ){ + return "MLV_COLOR_LIGHTGREY"; + } + if( color == MLV_COLOR_LIGHT_GRAY ){ + return "MLV_COLOR_LIGHT_GRAY"; + } + if( color == MLV_COLOR_LIGHTGRAY ){ + return "MLV_COLOR_LIGHTGRAY"; + } + if( color == MLV_COLOR_MIDNIGHT_BLUE ){ + return "MLV_COLOR_MIDNIGHT_BLUE"; + } + if( color == MLV_COLOR_MIDNIGHTBLUE ){ + return "MLV_COLOR_MIDNIGHTBLUE"; + } + if( color == MLV_COLOR_NAVY ){ + return "MLV_COLOR_NAVY"; + } + if( color == MLV_COLOR_NAVY_BLUE ){ + return "MLV_COLOR_NAVY_BLUE"; + } + if( color == MLV_COLOR_NAVYBLUE ){ + return "MLV_COLOR_NAVYBLUE"; + } + if( color == MLV_COLOR_CORNFLOWER_BLUE ){ + return "MLV_COLOR_CORNFLOWER_BLUE"; + } + if( color == MLV_COLOR_CORNFLOWERBLUE ){ + return "MLV_COLOR_CORNFLOWERBLUE"; + } + if( color == MLV_COLOR_DARK_SLATE_BLUE ){ + return "MLV_COLOR_DARK_SLATE_BLUE"; + } + if( color == MLV_COLOR_DARKSLATEBLUE ){ + return "MLV_COLOR_DARKSLATEBLUE"; + } + if( color == MLV_COLOR_SLATE_BLUE ){ + return "MLV_COLOR_SLATE_BLUE"; + } + if( color == MLV_COLOR_SLATEBLUE ){ + return "MLV_COLOR_SLATEBLUE"; + } + if( color == MLV_COLOR_MEDIUM_SLATE_BLUE ){ + return "MLV_COLOR_MEDIUM_SLATE_BLUE"; + } + if( color == MLV_COLOR_MEDIUMSLATEBLUE ){ + return "MLV_COLOR_MEDIUMSLATEBLUE"; + } + if( color == MLV_COLOR_LIGHT_SLATE_BLUE ){ + return "MLV_COLOR_LIGHT_SLATE_BLUE"; + } + if( color == MLV_COLOR_LIGHTSLATEBLUE ){ + return "MLV_COLOR_LIGHTSLATEBLUE"; + } + if( color == MLV_COLOR_MEDIUM_BLUE ){ + return "MLV_COLOR_MEDIUM_BLUE"; + } + if( color == MLV_COLOR_MEDIUMBLUE ){ + return "MLV_COLOR_MEDIUMBLUE"; + } + if( color == MLV_COLOR_ROYAL_BLUE ){ + return "MLV_COLOR_ROYAL_BLUE"; + } + if( color == MLV_COLOR_ROYALBLUE ){ + return "MLV_COLOR_ROYALBLUE"; + } + if( color == MLV_COLOR_BLUE ){ + return "MLV_COLOR_BLUE"; + } + if( color == MLV_COLOR_DODGER_BLUE ){ + return "MLV_COLOR_DODGER_BLUE"; + } + if( color == MLV_COLOR_DODGERBLUE ){ + return "MLV_COLOR_DODGERBLUE"; + } + if( color == MLV_COLOR_DEEP_SKY_BLUE ){ + return "MLV_COLOR_DEEP_SKY_BLUE"; + } + if( color == MLV_COLOR_DEEPSKYBLUE ){ + return "MLV_COLOR_DEEPSKYBLUE"; + } + if( color == MLV_COLOR_SKY_BLUE ){ + return "MLV_COLOR_SKY_BLUE"; + } + if( color == MLV_COLOR_SKYBLUE ){ + return "MLV_COLOR_SKYBLUE"; + } + if( color == MLV_COLOR_LIGHT_SKY_BLUE ){ + return "MLV_COLOR_LIGHT_SKY_BLUE"; + } + if( color == MLV_COLOR_LIGHTSKYBLUE ){ + return "MLV_COLOR_LIGHTSKYBLUE"; + } + if( color == MLV_COLOR_STEEL_BLUE ){ + return "MLV_COLOR_STEEL_BLUE"; + } + if( color == MLV_COLOR_STEELBLUE ){ + return "MLV_COLOR_STEELBLUE"; + } + if( color == MLV_COLOR_LIGHT_STEEL_BLUE ){ + return "MLV_COLOR_LIGHT_STEEL_BLUE"; + } + if( color == MLV_COLOR_LIGHTSTEELBLUE ){ + return "MLV_COLOR_LIGHTSTEELBLUE"; + } + if( color == MLV_COLOR_LIGHT_BLUE ){ + return "MLV_COLOR_LIGHT_BLUE"; + } + if( color == MLV_COLOR_LIGHTBLUE ){ + return "MLV_COLOR_LIGHTBLUE"; + } + if( color == MLV_COLOR_POWDER_BLUE ){ + return "MLV_COLOR_POWDER_BLUE"; + } + if( color == MLV_COLOR_POWDERBLUE ){ + return "MLV_COLOR_POWDERBLUE"; + } + if( color == MLV_COLOR_PALE_TURQUOISE ){ + return "MLV_COLOR_PALE_TURQUOISE"; + } + if( color == MLV_COLOR_PALETURQUOISE ){ + return "MLV_COLOR_PALETURQUOISE"; + } + if( color == MLV_COLOR_DARK_TURQUOISE ){ + return "MLV_COLOR_DARK_TURQUOISE"; + } + if( color == MLV_COLOR_DARKTURQUOISE ){ + return "MLV_COLOR_DARKTURQUOISE"; + } + if( color == MLV_COLOR_MEDIUM_TURQUOISE ){ + return "MLV_COLOR_MEDIUM_TURQUOISE"; + } + if( color == MLV_COLOR_MEDIUMTURQUOISE ){ + return "MLV_COLOR_MEDIUMTURQUOISE"; + } + if( color == MLV_COLOR_TURQUOISE ){ + return "MLV_COLOR_TURQUOISE"; + } + if( color == MLV_COLOR_CYAN ){ + return "MLV_COLOR_CYAN"; + } + if( color == MLV_COLOR_LIGHT_CYAN ){ + return "MLV_COLOR_LIGHT_CYAN"; + } + if( color == MLV_COLOR_LIGHTCYAN ){ + return "MLV_COLOR_LIGHTCYAN"; + } + if( color == MLV_COLOR_CADET_BLUE ){ + return "MLV_COLOR_CADET_BLUE"; + } + if( color == MLV_COLOR_CADETBLUE ){ + return "MLV_COLOR_CADETBLUE"; + } + if( color == MLV_COLOR_MEDIUM_AQUAMARINE ){ + return "MLV_COLOR_MEDIUM_AQUAMARINE"; + } + if( color == MLV_COLOR_MEDIUMAQUAMARINE ){ + return "MLV_COLOR_MEDIUMAQUAMARINE"; + } + if( color == MLV_COLOR_AQUAMARINE ){ + return "MLV_COLOR_AQUAMARINE"; + } + if( color == MLV_COLOR_DARK_GREEN ){ + return "MLV_COLOR_DARK_GREEN"; + } + if( color == MLV_COLOR_DARKGREEN ){ + return "MLV_COLOR_DARKGREEN"; + } + if( color == MLV_COLOR_DARK_OLIVE_GREEN ){ + return "MLV_COLOR_DARK_OLIVE_GREEN"; + } + if( color == MLV_COLOR_DARKOLIVEGREEN ){ + return "MLV_COLOR_DARKOLIVEGREEN"; + } + if( color == MLV_COLOR_DARK_SEA_GREEN ){ + return "MLV_COLOR_DARK_SEA_GREEN"; + } + if( color == MLV_COLOR_DARKSEAGREEN ){ + return "MLV_COLOR_DARKSEAGREEN"; + } + if( color == MLV_COLOR_SEA_GREEN ){ + return "MLV_COLOR_SEA_GREEN"; + } + if( color == MLV_COLOR_SEAGREEN ){ + return "MLV_COLOR_SEAGREEN"; + } + if( color == MLV_COLOR_MEDIUM_SEA_GREEN ){ + return "MLV_COLOR_MEDIUM_SEA_GREEN"; + } + if( color == MLV_COLOR_MEDIUMSEAGREEN ){ + return "MLV_COLOR_MEDIUMSEAGREEN"; + } + if( color == MLV_COLOR_LIGHT_SEA_GREEN ){ + return "MLV_COLOR_LIGHT_SEA_GREEN"; + } + if( color == MLV_COLOR_LIGHTSEAGREEN ){ + return "MLV_COLOR_LIGHTSEAGREEN"; + } + if( color == MLV_COLOR_PALE_GREEN ){ + return "MLV_COLOR_PALE_GREEN"; + } + if( color == MLV_COLOR_PALEGREEN ){ + return "MLV_COLOR_PALEGREEN"; + } + if( color == MLV_COLOR_SPRING_GREEN ){ + return "MLV_COLOR_SPRING_GREEN"; + } + if( color == MLV_COLOR_SPRINGGREEN ){ + return "MLV_COLOR_SPRINGGREEN"; + } + if( color == MLV_COLOR_LAWN_GREEN ){ + return "MLV_COLOR_LAWN_GREEN"; + } + if( color == MLV_COLOR_LAWNGREEN ){ + return "MLV_COLOR_LAWNGREEN"; + } + if( color == MLV_COLOR_GREEN ){ + return "MLV_COLOR_GREEN"; + } + if( color == MLV_COLOR_CHARTREUSE ){ + return "MLV_COLOR_CHARTREUSE"; + } + if( color == MLV_COLOR_MEDIUM_SPRING_GREEN ){ + return "MLV_COLOR_MEDIUM_SPRING_GREEN"; + } + if( color == MLV_COLOR_MEDIUMSPRINGGREEN ){ + return "MLV_COLOR_MEDIUMSPRINGGREEN"; + } + if( color == MLV_COLOR_GREEN_YELLOW ){ + return "MLV_COLOR_GREEN_YELLOW"; + } + if( color == MLV_COLOR_GREENYELLOW ){ + return "MLV_COLOR_GREENYELLOW"; + } + if( color == MLV_COLOR_LIME_GREEN ){ + return "MLV_COLOR_LIME_GREEN"; + } + if( color == MLV_COLOR_LIMEGREEN ){ + return "MLV_COLOR_LIMEGREEN"; + } + if( color == MLV_COLOR_YELLOW_GREEN ){ + return "MLV_COLOR_YELLOW_GREEN"; + } + if( color == MLV_COLOR_YELLOWGREEN ){ + return "MLV_COLOR_YELLOWGREEN"; + } + if( color == MLV_COLOR_FOREST_GREEN ){ + return "MLV_COLOR_FOREST_GREEN"; + } + if( color == MLV_COLOR_FORESTGREEN ){ + return "MLV_COLOR_FORESTGREEN"; + } + if( color == MLV_COLOR_OLIVE_DRAB ){ + return "MLV_COLOR_OLIVE_DRAB"; + } + if( color == MLV_COLOR_OLIVEDRAB ){ + return "MLV_COLOR_OLIVEDRAB"; + } + if( color == MLV_COLOR_DARK_KHAKI ){ + return "MLV_COLOR_DARK_KHAKI"; + } + if( color == MLV_COLOR_DARKKHAKI ){ + return "MLV_COLOR_DARKKHAKI"; + } + if( color == MLV_COLOR_KHAKI ){ + return "MLV_COLOR_KHAKI"; + } + if( color == MLV_COLOR_PALE_GOLDENROD ){ + return "MLV_COLOR_PALE_GOLDENROD"; + } + if( color == MLV_COLOR_PALEGOLDENROD ){ + return "MLV_COLOR_PALEGOLDENROD"; + } + if( color == MLV_COLOR_LIGHT_GOLDENROD_YELLOW ){ + return "MLV_COLOR_LIGHT_GOLDENROD_YELLOW"; + } + if( color == MLV_COLOR_LIGHTGOLDENRODYELLOW ){ + return "MLV_COLOR_LIGHTGOLDENRODYELLOW"; + } + if( color == MLV_COLOR_LIGHT_YELLOW ){ + return "MLV_COLOR_LIGHT_YELLOW"; + } + if( color == MLV_COLOR_LIGHTYELLOW ){ + return "MLV_COLOR_LIGHTYELLOW"; + } + if( color == MLV_COLOR_YELLOW ){ + return "MLV_COLOR_YELLOW"; + } + if( color == MLV_COLOR_GOLD ){ + return "MLV_COLOR_GOLD"; + } + if( color == MLV_COLOR_LIGHT_GOLDENROD ){ + return "MLV_COLOR_LIGHT_GOLDENROD"; + } + if( color == MLV_COLOR_LIGHTGOLDENROD ){ + return "MLV_COLOR_LIGHTGOLDENROD"; + } + if( color == MLV_COLOR_GOLDENROD ){ + return "MLV_COLOR_GOLDENROD"; + } + if( color == MLV_COLOR_DARK_GOLDENROD ){ + return "MLV_COLOR_DARK_GOLDENROD"; + } + if( color == MLV_COLOR_DARKGOLDENROD ){ + return "MLV_COLOR_DARKGOLDENROD"; + } + if( color == MLV_COLOR_ROSY_BROWN ){ + return "MLV_COLOR_ROSY_BROWN"; + } + if( color == MLV_COLOR_ROSYBROWN ){ + return "MLV_COLOR_ROSYBROWN"; + } + if( color == MLV_COLOR_INDIAN_RED ){ + return "MLV_COLOR_INDIAN_RED"; + } + if( color == MLV_COLOR_INDIANRED ){ + return "MLV_COLOR_INDIANRED"; + } + if( color == MLV_COLOR_SADDLE_BROWN ){ + return "MLV_COLOR_SADDLE_BROWN"; + } + if( color == MLV_COLOR_SADDLEBROWN ){ + return "MLV_COLOR_SADDLEBROWN"; + } + if( color == MLV_COLOR_SIENNA ){ + return "MLV_COLOR_SIENNA"; + } + if( color == MLV_COLOR_PERU ){ + return "MLV_COLOR_PERU"; + } + if( color == MLV_COLOR_BURLYWOOD ){ + return "MLV_COLOR_BURLYWOOD"; + } + if( color == MLV_COLOR_BEIGE ){ + return "MLV_COLOR_BEIGE"; + } + if( color == MLV_COLOR_WHEAT ){ + return "MLV_COLOR_WHEAT"; + } + if( color == MLV_COLOR_SANDY_BROWN ){ + return "MLV_COLOR_SANDY_BROWN"; + } + if( color == MLV_COLOR_SANDYBROWN ){ + return "MLV_COLOR_SANDYBROWN"; + } + if( color == MLV_COLOR_TAN ){ + return "MLV_COLOR_TAN"; + } + if( color == MLV_COLOR_CHOCOLATE ){ + return "MLV_COLOR_CHOCOLATE"; + } + if( color == MLV_COLOR_FIREBRICK ){ + return "MLV_COLOR_FIREBRICK"; + } + if( color == MLV_COLOR_BROWN ){ + return "MLV_COLOR_BROWN"; + } + if( color == MLV_COLOR_DARK_SALMON ){ + return "MLV_COLOR_DARK_SALMON"; + } + if( color == MLV_COLOR_DARKSALMON ){ + return "MLV_COLOR_DARKSALMON"; + } + if( color == MLV_COLOR_SALMON ){ + return "MLV_COLOR_SALMON"; + } + if( color == MLV_COLOR_LIGHT_SALMON ){ + return "MLV_COLOR_LIGHT_SALMON"; + } + if( color == MLV_COLOR_LIGHTSALMON ){ + return "MLV_COLOR_LIGHTSALMON"; + } + if( color == MLV_COLOR_ORANGE ){ + return "MLV_COLOR_ORANGE"; + } + if( color == MLV_COLOR_DARK_ORANGE ){ + return "MLV_COLOR_DARK_ORANGE"; + } + if( color == MLV_COLOR_DARKORANGE ){ + return "MLV_COLOR_DARKORANGE"; + } + if( color == MLV_COLOR_CORAL ){ + return "MLV_COLOR_CORAL"; + } + if( color == MLV_COLOR_LIGHT_CORAL ){ + return "MLV_COLOR_LIGHT_CORAL"; + } + if( color == MLV_COLOR_LIGHTCORAL ){ + return "MLV_COLOR_LIGHTCORAL"; + } + if( color == MLV_COLOR_TOMATO ){ + return "MLV_COLOR_TOMATO"; + } + if( color == MLV_COLOR_ORANGE_RED ){ + return "MLV_COLOR_ORANGE_RED"; + } + if( color == MLV_COLOR_ORANGERED ){ + return "MLV_COLOR_ORANGERED"; + } + if( color == MLV_COLOR_RED ){ + return "MLV_COLOR_RED"; + } + if( color == MLV_COLOR_HOT_PINK ){ + return "MLV_COLOR_HOT_PINK"; + } + if( color == MLV_COLOR_HOTPINK ){ + return "MLV_COLOR_HOTPINK"; + } + if( color == MLV_COLOR_DEEP_PINK ){ + return "MLV_COLOR_DEEP_PINK"; + } + if( color == MLV_COLOR_DEEPPINK ){ + return "MLV_COLOR_DEEPPINK"; + } + if( color == MLV_COLOR_PINK ){ + return "MLV_COLOR_PINK"; + } + if( color == MLV_COLOR_LIGHT_PINK ){ + return "MLV_COLOR_LIGHT_PINK"; + } + if( color == MLV_COLOR_LIGHTPINK ){ + return "MLV_COLOR_LIGHTPINK"; + } + if( color == MLV_COLOR_PALE_VIOLET_RED ){ + return "MLV_COLOR_PALE_VIOLET_RED"; + } + if( color == MLV_COLOR_PALEVIOLETRED ){ + return "MLV_COLOR_PALEVIOLETRED"; + } + if( color == MLV_COLOR_MAROON ){ + return "MLV_COLOR_MAROON"; + } + if( color == MLV_COLOR_MEDIUM_VIOLET_RED ){ + return "MLV_COLOR_MEDIUM_VIOLET_RED"; + } + if( color == MLV_COLOR_MEDIUMVIOLETRED ){ + return "MLV_COLOR_MEDIUMVIOLETRED"; + } + if( color == MLV_COLOR_VIOLET_RED ){ + return "MLV_COLOR_VIOLET_RED"; + } + if( color == MLV_COLOR_VIOLETRED ){ + return "MLV_COLOR_VIOLETRED"; + } + if( color == MLV_COLOR_MAGENTA ){ + return "MLV_COLOR_MAGENTA"; + } + if( color == MLV_COLOR_VIOLET ){ + return "MLV_COLOR_VIOLET"; + } + if( color == MLV_COLOR_PLUM ){ + return "MLV_COLOR_PLUM"; + } + if( color == MLV_COLOR_ORCHID ){ + return "MLV_COLOR_ORCHID"; + } + if( color == MLV_COLOR_MEDIUM_ORCHID ){ + return "MLV_COLOR_MEDIUM_ORCHID"; + } + if( color == MLV_COLOR_MEDIUMORCHID ){ + return "MLV_COLOR_MEDIUMORCHID"; + } + if( color == MLV_COLOR_DARK_ORCHID ){ + return "MLV_COLOR_DARK_ORCHID"; + } + if( color == MLV_COLOR_DARKORCHID ){ + return "MLV_COLOR_DARKORCHID"; + } + if( color == MLV_COLOR_DARK_VIOLET ){ + return "MLV_COLOR_DARK_VIOLET"; + } + if( color == MLV_COLOR_DARKVIOLET ){ + return "MLV_COLOR_DARKVIOLET"; + } + if( color == MLV_COLOR_BLUE_VIOLET ){ + return "MLV_COLOR_BLUE_VIOLET"; + } + if( color == MLV_COLOR_BLUEVIOLET ){ + return "MLV_COLOR_BLUEVIOLET"; + } + if( color == MLV_COLOR_PURPLE ){ + return "MLV_COLOR_PURPLE"; + } + if( color == MLV_COLOR_MEDIUM_PURPLE ){ + return "MLV_COLOR_MEDIUM_PURPLE"; + } + if( color == MLV_COLOR_MEDIUMPURPLE ){ + return "MLV_COLOR_MEDIUMPURPLE"; + } + if( color == MLV_COLOR_THISTLE ){ + return "MLV_COLOR_THISTLE"; + } + if( color == MLV_COLOR_SNOW1 ){ + return "MLV_COLOR_SNOW1"; + } + if( color == MLV_COLOR_SNOW2 ){ + return "MLV_COLOR_SNOW2"; + } + if( color == MLV_COLOR_SNOW3 ){ + return "MLV_COLOR_SNOW3"; + } + if( color == MLV_COLOR_SNOW4 ){ + return "MLV_COLOR_SNOW4"; + } + if( color == MLV_COLOR_SEASHELL1 ){ + return "MLV_COLOR_SEASHELL1"; + } + if( color == MLV_COLOR_SEASHELL2 ){ + return "MLV_COLOR_SEASHELL2"; + } + if( color == MLV_COLOR_SEASHELL3 ){ + return "MLV_COLOR_SEASHELL3"; + } + if( color == MLV_COLOR_SEASHELL4 ){ + return "MLV_COLOR_SEASHELL4"; + } + if( color == MLV_COLOR_ANTIQUEWHITE1 ){ + return "MLV_COLOR_ANTIQUEWHITE1"; + } + if( color == MLV_COLOR_ANTIQUEWHITE2 ){ + return "MLV_COLOR_ANTIQUEWHITE2"; + } + if( color == MLV_COLOR_ANTIQUEWHITE3 ){ + return "MLV_COLOR_ANTIQUEWHITE3"; + } + if( color == MLV_COLOR_ANTIQUEWHITE4 ){ + return "MLV_COLOR_ANTIQUEWHITE4"; + } + if( color == MLV_COLOR_BISQUE1 ){ + return "MLV_COLOR_BISQUE1"; + } + if( color == MLV_COLOR_BISQUE2 ){ + return "MLV_COLOR_BISQUE2"; + } + if( color == MLV_COLOR_BISQUE3 ){ + return "MLV_COLOR_BISQUE3"; + } + if( color == MLV_COLOR_BISQUE4 ){ + return "MLV_COLOR_BISQUE4"; + } + if( color == MLV_COLOR_PEACHPUFF1 ){ + return "MLV_COLOR_PEACHPUFF1"; + } + if( color == MLV_COLOR_PEACHPUFF2 ){ + return "MLV_COLOR_PEACHPUFF2"; + } + if( color == MLV_COLOR_PEACHPUFF3 ){ + return "MLV_COLOR_PEACHPUFF3"; + } + if( color == MLV_COLOR_PEACHPUFF4 ){ + return "MLV_COLOR_PEACHPUFF4"; + } + if( color == MLV_COLOR_NAVAJOWHITE1 ){ + return "MLV_COLOR_NAVAJOWHITE1"; + } + if( color == MLV_COLOR_NAVAJOWHITE2 ){ + return "MLV_COLOR_NAVAJOWHITE2"; + } + if( color == MLV_COLOR_NAVAJOWHITE3 ){ + return "MLV_COLOR_NAVAJOWHITE3"; + } + if( color == MLV_COLOR_NAVAJOWHITE4 ){ + return "MLV_COLOR_NAVAJOWHITE4"; + } + if( color == MLV_COLOR_LEMONCHIFFON1 ){ + return "MLV_COLOR_LEMONCHIFFON1"; + } + if( color == MLV_COLOR_LEMONCHIFFON2 ){ + return "MLV_COLOR_LEMONCHIFFON2"; + } + if( color == MLV_COLOR_LEMONCHIFFON3 ){ + return "MLV_COLOR_LEMONCHIFFON3"; + } + if( color == MLV_COLOR_LEMONCHIFFON4 ){ + return "MLV_COLOR_LEMONCHIFFON4"; + } + if( color == MLV_COLOR_CORNSILK1 ){ + return "MLV_COLOR_CORNSILK1"; + } + if( color == MLV_COLOR_CORNSILK2 ){ + return "MLV_COLOR_CORNSILK2"; + } + if( color == MLV_COLOR_CORNSILK3 ){ + return "MLV_COLOR_CORNSILK3"; + } + if( color == MLV_COLOR_CORNSILK4 ){ + return "MLV_COLOR_CORNSILK4"; + } + if( color == MLV_COLOR_IVORY1 ){ + return "MLV_COLOR_IVORY1"; + } + if( color == MLV_COLOR_IVORY2 ){ + return "MLV_COLOR_IVORY2"; + } + if( color == MLV_COLOR_IVORY3 ){ + return "MLV_COLOR_IVORY3"; + } + if( color == MLV_COLOR_IVORY4 ){ + return "MLV_COLOR_IVORY4"; + } + if( color == MLV_COLOR_HONEYDEW1 ){ + return "MLV_COLOR_HONEYDEW1"; + } + if( color == MLV_COLOR_HONEYDEW2 ){ + return "MLV_COLOR_HONEYDEW2"; + } + if( color == MLV_COLOR_HONEYDEW3 ){ + return "MLV_COLOR_HONEYDEW3"; + } + if( color == MLV_COLOR_HONEYDEW4 ){ + return "MLV_COLOR_HONEYDEW4"; + } + if( color == MLV_COLOR_LAVENDERBLUSH1 ){ + return "MLV_COLOR_LAVENDERBLUSH1"; + } + if( color == MLV_COLOR_LAVENDERBLUSH2 ){ + return "MLV_COLOR_LAVENDERBLUSH2"; + } + if( color == MLV_COLOR_LAVENDERBLUSH3 ){ + return "MLV_COLOR_LAVENDERBLUSH3"; + } + if( color == MLV_COLOR_LAVENDERBLUSH4 ){ + return "MLV_COLOR_LAVENDERBLUSH4"; + } + if( color == MLV_COLOR_MISTYROSE1 ){ + return "MLV_COLOR_MISTYROSE1"; + } + if( color == MLV_COLOR_MISTYROSE2 ){ + return "MLV_COLOR_MISTYROSE2"; + } + if( color == MLV_COLOR_MISTYROSE3 ){ + return "MLV_COLOR_MISTYROSE3"; + } + if( color == MLV_COLOR_MISTYROSE4 ){ + return "MLV_COLOR_MISTYROSE4"; + } + if( color == MLV_COLOR_AZURE1 ){ + return "MLV_COLOR_AZURE1"; + } + if( color == MLV_COLOR_AZURE2 ){ + return "MLV_COLOR_AZURE2"; + } + if( color == MLV_COLOR_AZURE3 ){ + return "MLV_COLOR_AZURE3"; + } + if( color == MLV_COLOR_AZURE4 ){ + return "MLV_COLOR_AZURE4"; + } + if( color == MLV_COLOR_SLATEBLUE1 ){ + return "MLV_COLOR_SLATEBLUE1"; + } + if( color == MLV_COLOR_SLATEBLUE2 ){ + return "MLV_COLOR_SLATEBLUE2"; + } + if( color == MLV_COLOR_SLATEBLUE3 ){ + return "MLV_COLOR_SLATEBLUE3"; + } + if( color == MLV_COLOR_SLATEBLUE4 ){ + return "MLV_COLOR_SLATEBLUE4"; + } + if( color == MLV_COLOR_ROYALBLUE1 ){ + return "MLV_COLOR_ROYALBLUE1"; + } + if( color == MLV_COLOR_ROYALBLUE2 ){ + return "MLV_COLOR_ROYALBLUE2"; + } + if( color == MLV_COLOR_ROYALBLUE3 ){ + return "MLV_COLOR_ROYALBLUE3"; + } + if( color == MLV_COLOR_ROYALBLUE4 ){ + return "MLV_COLOR_ROYALBLUE4"; + } + if( color == MLV_COLOR_BLUE1 ){ + return "MLV_COLOR_BLUE1"; + } + if( color == MLV_COLOR_BLUE2 ){ + return "MLV_COLOR_BLUE2"; + } + if( color == MLV_COLOR_BLUE3 ){ + return "MLV_COLOR_BLUE3"; + } + if( color == MLV_COLOR_BLUE4 ){ + return "MLV_COLOR_BLUE4"; + } + if( color == MLV_COLOR_DODGERBLUE1 ){ + return "MLV_COLOR_DODGERBLUE1"; + } + if( color == MLV_COLOR_DODGERBLUE2 ){ + return "MLV_COLOR_DODGERBLUE2"; + } + if( color == MLV_COLOR_DODGERBLUE3 ){ + return "MLV_COLOR_DODGERBLUE3"; + } + if( color == MLV_COLOR_DODGERBLUE4 ){ + return "MLV_COLOR_DODGERBLUE4"; + } + if( color == MLV_COLOR_STEELBLUE1 ){ + return "MLV_COLOR_STEELBLUE1"; + } + if( color == MLV_COLOR_STEELBLUE2 ){ + return "MLV_COLOR_STEELBLUE2"; + } + if( color == MLV_COLOR_STEELBLUE3 ){ + return "MLV_COLOR_STEELBLUE3"; + } + if( color == MLV_COLOR_STEELBLUE4 ){ + return "MLV_COLOR_STEELBLUE4"; + } + if( color == MLV_COLOR_DEEPSKYBLUE1 ){ + return "MLV_COLOR_DEEPSKYBLUE1"; + } + if( color == MLV_COLOR_DEEPSKYBLUE2 ){ + return "MLV_COLOR_DEEPSKYBLUE2"; + } + if( color == MLV_COLOR_DEEPSKYBLUE3 ){ + return "MLV_COLOR_DEEPSKYBLUE3"; + } + if( color == MLV_COLOR_DEEPSKYBLUE4 ){ + return "MLV_COLOR_DEEPSKYBLUE4"; + } + if( color == MLV_COLOR_SKYBLUE1 ){ + return "MLV_COLOR_SKYBLUE1"; + } + if( color == MLV_COLOR_SKYBLUE2 ){ + return "MLV_COLOR_SKYBLUE2"; + } + if( color == MLV_COLOR_SKYBLUE3 ){ + return "MLV_COLOR_SKYBLUE3"; + } + if( color == MLV_COLOR_SKYBLUE4 ){ + return "MLV_COLOR_SKYBLUE4"; + } + if( color == MLV_COLOR_LIGHTSKYBLUE1 ){ + return "MLV_COLOR_LIGHTSKYBLUE1"; + } + if( color == MLV_COLOR_LIGHTSKYBLUE2 ){ + return "MLV_COLOR_LIGHTSKYBLUE2"; + } + if( color == MLV_COLOR_LIGHTSKYBLUE3 ){ + return "MLV_COLOR_LIGHTSKYBLUE3"; + } + if( color == MLV_COLOR_LIGHTSKYBLUE4 ){ + return "MLV_COLOR_LIGHTSKYBLUE4"; + } + if( color == MLV_COLOR_SLATEGRAY1 ){ + return "MLV_COLOR_SLATEGRAY1"; + } + if( color == MLV_COLOR_SLATEGRAY2 ){ + return "MLV_COLOR_SLATEGRAY2"; + } + if( color == MLV_COLOR_SLATEGRAY3 ){ + return "MLV_COLOR_SLATEGRAY3"; + } + if( color == MLV_COLOR_SLATEGRAY4 ){ + return "MLV_COLOR_SLATEGRAY4"; + } + if( color == MLV_COLOR_LIGHTSTEELBLUE1 ){ + return "MLV_COLOR_LIGHTSTEELBLUE1"; + } + if( color == MLV_COLOR_LIGHTSTEELBLUE2 ){ + return "MLV_COLOR_LIGHTSTEELBLUE2"; + } + if( color == MLV_COLOR_LIGHTSTEELBLUE3 ){ + return "MLV_COLOR_LIGHTSTEELBLUE3"; + } + if( color == MLV_COLOR_LIGHTSTEELBLUE4 ){ + return "MLV_COLOR_LIGHTSTEELBLUE4"; + } + if( color == MLV_COLOR_LIGHTBLUE1 ){ + return "MLV_COLOR_LIGHTBLUE1"; + } + if( color == MLV_COLOR_LIGHTBLUE2 ){ + return "MLV_COLOR_LIGHTBLUE2"; + } + if( color == MLV_COLOR_LIGHTBLUE3 ){ + return "MLV_COLOR_LIGHTBLUE3"; + } + if( color == MLV_COLOR_LIGHTBLUE4 ){ + return "MLV_COLOR_LIGHTBLUE4"; + } + if( color == MLV_COLOR_LIGHTCYAN1 ){ + return "MLV_COLOR_LIGHTCYAN1"; + } + if( color == MLV_COLOR_LIGHTCYAN2 ){ + return "MLV_COLOR_LIGHTCYAN2"; + } + if( color == MLV_COLOR_LIGHTCYAN3 ){ + return "MLV_COLOR_LIGHTCYAN3"; + } + if( color == MLV_COLOR_LIGHTCYAN4 ){ + return "MLV_COLOR_LIGHTCYAN4"; + } + if( color == MLV_COLOR_PALETURQUOISE1 ){ + return "MLV_COLOR_PALETURQUOISE1"; + } + if( color == MLV_COLOR_PALETURQUOISE2 ){ + return "MLV_COLOR_PALETURQUOISE2"; + } + if( color == MLV_COLOR_PALETURQUOISE3 ){ + return "MLV_COLOR_PALETURQUOISE3"; + } + if( color == MLV_COLOR_PALETURQUOISE4 ){ + return "MLV_COLOR_PALETURQUOISE4"; + } + if( color == MLV_COLOR_CADETBLUE1 ){ + return "MLV_COLOR_CADETBLUE1"; + } + if( color == MLV_COLOR_CADETBLUE2 ){ + return "MLV_COLOR_CADETBLUE2"; + } + if( color == MLV_COLOR_CADETBLUE3 ){ + return "MLV_COLOR_CADETBLUE3"; + } + if( color == MLV_COLOR_CADETBLUE4 ){ + return "MLV_COLOR_CADETBLUE4"; + } + if( color == MLV_COLOR_TURQUOISE1 ){ + return "MLV_COLOR_TURQUOISE1"; + } + if( color == MLV_COLOR_TURQUOISE2 ){ + return "MLV_COLOR_TURQUOISE2"; + } + if( color == MLV_COLOR_TURQUOISE3 ){ + return "MLV_COLOR_TURQUOISE3"; + } + if( color == MLV_COLOR_TURQUOISE4 ){ + return "MLV_COLOR_TURQUOISE4"; + } + if( color == MLV_COLOR_CYAN1 ){ + return "MLV_COLOR_CYAN1"; + } + if( color == MLV_COLOR_CYAN2 ){ + return "MLV_COLOR_CYAN2"; + } + if( color == MLV_COLOR_CYAN3 ){ + return "MLV_COLOR_CYAN3"; + } + if( color == MLV_COLOR_CYAN4 ){ + return "MLV_COLOR_CYAN4"; + } + if( color == MLV_COLOR_DARKSLATEGRAY1 ){ + return "MLV_COLOR_DARKSLATEGRAY1"; + } + if( color == MLV_COLOR_DARKSLATEGRAY2 ){ + return "MLV_COLOR_DARKSLATEGRAY2"; + } + if( color == MLV_COLOR_DARKSLATEGRAY3 ){ + return "MLV_COLOR_DARKSLATEGRAY3"; + } + if( color == MLV_COLOR_DARKSLATEGRAY4 ){ + return "MLV_COLOR_DARKSLATEGRAY4"; + } + if( color == MLV_COLOR_AQUAMARINE1 ){ + return "MLV_COLOR_AQUAMARINE1"; + } + if( color == MLV_COLOR_AQUAMARINE2 ){ + return "MLV_COLOR_AQUAMARINE2"; + } + if( color == MLV_COLOR_AQUAMARINE3 ){ + return "MLV_COLOR_AQUAMARINE3"; + } + if( color == MLV_COLOR_AQUAMARINE4 ){ + return "MLV_COLOR_AQUAMARINE4"; + } + if( color == MLV_COLOR_DARKSEAGREEN1 ){ + return "MLV_COLOR_DARKSEAGREEN1"; + } + if( color == MLV_COLOR_DARKSEAGREEN2 ){ + return "MLV_COLOR_DARKSEAGREEN2"; + } + if( color == MLV_COLOR_DARKSEAGREEN3 ){ + return "MLV_COLOR_DARKSEAGREEN3"; + } + if( color == MLV_COLOR_DARKSEAGREEN4 ){ + return "MLV_COLOR_DARKSEAGREEN4"; + } + if( color == MLV_COLOR_SEAGREEN1 ){ + return "MLV_COLOR_SEAGREEN1"; + } + if( color == MLV_COLOR_SEAGREEN2 ){ + return "MLV_COLOR_SEAGREEN2"; + } + if( color == MLV_COLOR_SEAGREEN3 ){ + return "MLV_COLOR_SEAGREEN3"; + } + if( color == MLV_COLOR_SEAGREEN4 ){ + return "MLV_COLOR_SEAGREEN4"; + } + if( color == MLV_COLOR_PALEGREEN1 ){ + return "MLV_COLOR_PALEGREEN1"; + } + if( color == MLV_COLOR_PALEGREEN2 ){ + return "MLV_COLOR_PALEGREEN2"; + } + if( color == MLV_COLOR_PALEGREEN3 ){ + return "MLV_COLOR_PALEGREEN3"; + } + if( color == MLV_COLOR_PALEGREEN4 ){ + return "MLV_COLOR_PALEGREEN4"; + } + if( color == MLV_COLOR_SPRINGGREEN1 ){ + return "MLV_COLOR_SPRINGGREEN1"; + } + if( color == MLV_COLOR_SPRINGGREEN2 ){ + return "MLV_COLOR_SPRINGGREEN2"; + } + if( color == MLV_COLOR_SPRINGGREEN3 ){ + return "MLV_COLOR_SPRINGGREEN3"; + } + if( color == MLV_COLOR_SPRINGGREEN4 ){ + return "MLV_COLOR_SPRINGGREEN4"; + } + if( color == MLV_COLOR_GREEN1 ){ + return "MLV_COLOR_GREEN1"; + } + if( color == MLV_COLOR_GREEN2 ){ + return "MLV_COLOR_GREEN2"; + } + if( color == MLV_COLOR_GREEN3 ){ + return "MLV_COLOR_GREEN3"; + } + if( color == MLV_COLOR_GREEN4 ){ + return "MLV_COLOR_GREEN4"; + } + if( color == MLV_COLOR_CHARTREUSE1 ){ + return "MLV_COLOR_CHARTREUSE1"; + } + if( color == MLV_COLOR_CHARTREUSE2 ){ + return "MLV_COLOR_CHARTREUSE2"; + } + if( color == MLV_COLOR_CHARTREUSE3 ){ + return "MLV_COLOR_CHARTREUSE3"; + } + if( color == MLV_COLOR_CHARTREUSE4 ){ + return "MLV_COLOR_CHARTREUSE4"; + } + if( color == MLV_COLOR_OLIVEDRAB1 ){ + return "MLV_COLOR_OLIVEDRAB1"; + } + if( color == MLV_COLOR_OLIVEDRAB2 ){ + return "MLV_COLOR_OLIVEDRAB2"; + } + if( color == MLV_COLOR_OLIVEDRAB3 ){ + return "MLV_COLOR_OLIVEDRAB3"; + } + if( color == MLV_COLOR_OLIVEDRAB4 ){ + return "MLV_COLOR_OLIVEDRAB4"; + } + if( color == MLV_COLOR_DARKOLIVEGREEN1 ){ + return "MLV_COLOR_DARKOLIVEGREEN1"; + } + if( color == MLV_COLOR_DARKOLIVEGREEN2 ){ + return "MLV_COLOR_DARKOLIVEGREEN2"; + } + if( color == MLV_COLOR_DARKOLIVEGREEN3 ){ + return "MLV_COLOR_DARKOLIVEGREEN3"; + } + if( color == MLV_COLOR_DARKOLIVEGREEN4 ){ + return "MLV_COLOR_DARKOLIVEGREEN4"; + } + if( color == MLV_COLOR_KHAKI1 ){ + return "MLV_COLOR_KHAKI1"; + } + if( color == MLV_COLOR_KHAKI2 ){ + return "MLV_COLOR_KHAKI2"; + } + if( color == MLV_COLOR_KHAKI3 ){ + return "MLV_COLOR_KHAKI3"; + } + if( color == MLV_COLOR_KHAKI4 ){ + return "MLV_COLOR_KHAKI4"; + } + if( color == MLV_COLOR_LIGHTGOLDENROD1 ){ + return "MLV_COLOR_LIGHTGOLDENROD1"; + } + if( color == MLV_COLOR_LIGHTGOLDENROD2 ){ + return "MLV_COLOR_LIGHTGOLDENROD2"; + } + if( color == MLV_COLOR_LIGHTGOLDENROD3 ){ + return "MLV_COLOR_LIGHTGOLDENROD3"; + } + if( color == MLV_COLOR_LIGHTGOLDENROD4 ){ + return "MLV_COLOR_LIGHTGOLDENROD4"; + } + if( color == MLV_COLOR_LIGHTYELLOW1 ){ + return "MLV_COLOR_LIGHTYELLOW1"; + } + if( color == MLV_COLOR_LIGHTYELLOW2 ){ + return "MLV_COLOR_LIGHTYELLOW2"; + } + if( color == MLV_COLOR_LIGHTYELLOW3 ){ + return "MLV_COLOR_LIGHTYELLOW3"; + } + if( color == MLV_COLOR_LIGHTYELLOW4 ){ + return "MLV_COLOR_LIGHTYELLOW4"; + } + if( color == MLV_COLOR_YELLOW1 ){ + return "MLV_COLOR_YELLOW1"; + } + if( color == MLV_COLOR_YELLOW2 ){ + return "MLV_COLOR_YELLOW2"; + } + if( color == MLV_COLOR_YELLOW3 ){ + return "MLV_COLOR_YELLOW3"; + } + if( color == MLV_COLOR_YELLOW4 ){ + return "MLV_COLOR_YELLOW4"; + } + if( color == MLV_COLOR_GOLD1 ){ + return "MLV_COLOR_GOLD1"; + } + if( color == MLV_COLOR_GOLD2 ){ + return "MLV_COLOR_GOLD2"; + } + if( color == MLV_COLOR_GOLD3 ){ + return "MLV_COLOR_GOLD3"; + } + if( color == MLV_COLOR_GOLD4 ){ + return "MLV_COLOR_GOLD4"; + } + if( color == MLV_COLOR_GOLDENROD1 ){ + return "MLV_COLOR_GOLDENROD1"; + } + if( color == MLV_COLOR_GOLDENROD2 ){ + return "MLV_COLOR_GOLDENROD2"; + } + if( color == MLV_COLOR_GOLDENROD3 ){ + return "MLV_COLOR_GOLDENROD3"; + } + if( color == MLV_COLOR_GOLDENROD4 ){ + return "MLV_COLOR_GOLDENROD4"; + } + if( color == MLV_COLOR_DARKGOLDENROD1 ){ + return "MLV_COLOR_DARKGOLDENROD1"; + } + if( color == MLV_COLOR_DARKGOLDENROD2 ){ + return "MLV_COLOR_DARKGOLDENROD2"; + } + if( color == MLV_COLOR_DARKGOLDENROD3 ){ + return "MLV_COLOR_DARKGOLDENROD3"; + } + if( color == MLV_COLOR_DARKGOLDENROD4 ){ + return "MLV_COLOR_DARKGOLDENROD4"; + } + if( color == MLV_COLOR_ROSYBROWN1 ){ + return "MLV_COLOR_ROSYBROWN1"; + } + if( color == MLV_COLOR_ROSYBROWN2 ){ + return "MLV_COLOR_ROSYBROWN2"; + } + if( color == MLV_COLOR_ROSYBROWN3 ){ + return "MLV_COLOR_ROSYBROWN3"; + } + if( color == MLV_COLOR_ROSYBROWN4 ){ + return "MLV_COLOR_ROSYBROWN4"; + } + if( color == MLV_COLOR_INDIANRED1 ){ + return "MLV_COLOR_INDIANRED1"; + } + if( color == MLV_COLOR_INDIANRED2 ){ + return "MLV_COLOR_INDIANRED2"; + } + if( color == MLV_COLOR_INDIANRED3 ){ + return "MLV_COLOR_INDIANRED3"; + } + if( color == MLV_COLOR_INDIANRED4 ){ + return "MLV_COLOR_INDIANRED4"; + } + if( color == MLV_COLOR_SIENNA1 ){ + return "MLV_COLOR_SIENNA1"; + } + if( color == MLV_COLOR_SIENNA2 ){ + return "MLV_COLOR_SIENNA2"; + } + if( color == MLV_COLOR_SIENNA3 ){ + return "MLV_COLOR_SIENNA3"; + } + if( color == MLV_COLOR_SIENNA4 ){ + return "MLV_COLOR_SIENNA4"; + } + if( color == MLV_COLOR_BURLYWOOD1 ){ + return "MLV_COLOR_BURLYWOOD1"; + } + if( color == MLV_COLOR_BURLYWOOD2 ){ + return "MLV_COLOR_BURLYWOOD2"; + } + if( color == MLV_COLOR_BURLYWOOD3 ){ + return "MLV_COLOR_BURLYWOOD3"; + } + if( color == MLV_COLOR_BURLYWOOD4 ){ + return "MLV_COLOR_BURLYWOOD4"; + } + if( color == MLV_COLOR_WHEAT1 ){ + return "MLV_COLOR_WHEAT1"; + } + if( color == MLV_COLOR_WHEAT2 ){ + return "MLV_COLOR_WHEAT2"; + } + if( color == MLV_COLOR_WHEAT3 ){ + return "MLV_COLOR_WHEAT3"; + } + if( color == MLV_COLOR_WHEAT4 ){ + return "MLV_COLOR_WHEAT4"; + } + if( color == MLV_COLOR_TAN1 ){ + return "MLV_COLOR_TAN1"; + } + if( color == MLV_COLOR_TAN2 ){ + return "MLV_COLOR_TAN2"; + } + if( color == MLV_COLOR_TAN3 ){ + return "MLV_COLOR_TAN3"; + } + if( color == MLV_COLOR_TAN4 ){ + return "MLV_COLOR_TAN4"; + } + if( color == MLV_COLOR_CHOCOLATE1 ){ + return "MLV_COLOR_CHOCOLATE1"; + } + if( color == MLV_COLOR_CHOCOLATE2 ){ + return "MLV_COLOR_CHOCOLATE2"; + } + if( color == MLV_COLOR_CHOCOLATE3 ){ + return "MLV_COLOR_CHOCOLATE3"; + } + if( color == MLV_COLOR_CHOCOLATE4 ){ + return "MLV_COLOR_CHOCOLATE4"; + } + if( color == MLV_COLOR_FIREBRICK1 ){ + return "MLV_COLOR_FIREBRICK1"; + } + if( color == MLV_COLOR_FIREBRICK2 ){ + return "MLV_COLOR_FIREBRICK2"; + } + if( color == MLV_COLOR_FIREBRICK3 ){ + return "MLV_COLOR_FIREBRICK3"; + } + if( color == MLV_COLOR_FIREBRICK4 ){ + return "MLV_COLOR_FIREBRICK4"; + } + if( color == MLV_COLOR_BROWN1 ){ + return "MLV_COLOR_BROWN1"; + } + if( color == MLV_COLOR_BROWN2 ){ + return "MLV_COLOR_BROWN2"; + } + if( color == MLV_COLOR_BROWN3 ){ + return "MLV_COLOR_BROWN3"; + } + if( color == MLV_COLOR_BROWN4 ){ + return "MLV_COLOR_BROWN4"; + } + if( color == MLV_COLOR_SALMON1 ){ + return "MLV_COLOR_SALMON1"; + } + if( color == MLV_COLOR_SALMON2 ){ + return "MLV_COLOR_SALMON2"; + } + if( color == MLV_COLOR_SALMON3 ){ + return "MLV_COLOR_SALMON3"; + } + if( color == MLV_COLOR_SALMON4 ){ + return "MLV_COLOR_SALMON4"; + } + if( color == MLV_COLOR_LIGHTSALMON1 ){ + return "MLV_COLOR_LIGHTSALMON1"; + } + if( color == MLV_COLOR_LIGHTSALMON2 ){ + return "MLV_COLOR_LIGHTSALMON2"; + } + if( color == MLV_COLOR_LIGHTSALMON3 ){ + return "MLV_COLOR_LIGHTSALMON3"; + } + if( color == MLV_COLOR_LIGHTSALMON4 ){ + return "MLV_COLOR_LIGHTSALMON4"; + } + if( color == MLV_COLOR_ORANGE1 ){ + return "MLV_COLOR_ORANGE1"; + } + if( color == MLV_COLOR_ORANGE2 ){ + return "MLV_COLOR_ORANGE2"; + } + if( color == MLV_COLOR_ORANGE3 ){ + return "MLV_COLOR_ORANGE3"; + } + if( color == MLV_COLOR_ORANGE4 ){ + return "MLV_COLOR_ORANGE4"; + } + if( color == MLV_COLOR_DARKORANGE1 ){ + return "MLV_COLOR_DARKORANGE1"; + } + if( color == MLV_COLOR_DARKORANGE2 ){ + return "MLV_COLOR_DARKORANGE2"; + } + if( color == MLV_COLOR_DARKORANGE3 ){ + return "MLV_COLOR_DARKORANGE3"; + } + if( color == MLV_COLOR_DARKORANGE4 ){ + return "MLV_COLOR_DARKORANGE4"; + } + if( color == MLV_COLOR_CORAL1 ){ + return "MLV_COLOR_CORAL1"; + } + if( color == MLV_COLOR_CORAL2 ){ + return "MLV_COLOR_CORAL2"; + } + if( color == MLV_COLOR_CORAL3 ){ + return "MLV_COLOR_CORAL3"; + } + if( color == MLV_COLOR_CORAL4 ){ + return "MLV_COLOR_CORAL4"; + } + if( color == MLV_COLOR_TOMATO1 ){ + return "MLV_COLOR_TOMATO1"; + } + if( color == MLV_COLOR_TOMATO2 ){ + return "MLV_COLOR_TOMATO2"; + } + if( color == MLV_COLOR_TOMATO3 ){ + return "MLV_COLOR_TOMATO3"; + } + if( color == MLV_COLOR_TOMATO4 ){ + return "MLV_COLOR_TOMATO4"; + } + if( color == MLV_COLOR_ORANGERED1 ){ + return "MLV_COLOR_ORANGERED1"; + } + if( color == MLV_COLOR_ORANGERED2 ){ + return "MLV_COLOR_ORANGERED2"; + } + if( color == MLV_COLOR_ORANGERED3 ){ + return "MLV_COLOR_ORANGERED3"; + } + if( color == MLV_COLOR_ORANGERED4 ){ + return "MLV_COLOR_ORANGERED4"; + } + if( color == MLV_COLOR_RED1 ){ + return "MLV_COLOR_RED1"; + } + if( color == MLV_COLOR_RED2 ){ + return "MLV_COLOR_RED2"; + } + if( color == MLV_COLOR_RED3 ){ + return "MLV_COLOR_RED3"; + } + if( color == MLV_COLOR_RED4 ){ + return "MLV_COLOR_RED4"; + } + if( color == MLV_COLOR_DEEPPINK1 ){ + return "MLV_COLOR_DEEPPINK1"; + } + if( color == MLV_COLOR_DEEPPINK2 ){ + return "MLV_COLOR_DEEPPINK2"; + } + if( color == MLV_COLOR_DEEPPINK3 ){ + return "MLV_COLOR_DEEPPINK3"; + } + if( color == MLV_COLOR_DEEPPINK4 ){ + return "MLV_COLOR_DEEPPINK4"; + } + if( color == MLV_COLOR_HOTPINK1 ){ + return "MLV_COLOR_HOTPINK1"; + } + if( color == MLV_COLOR_HOTPINK2 ){ + return "MLV_COLOR_HOTPINK2"; + } + if( color == MLV_COLOR_HOTPINK3 ){ + return "MLV_COLOR_HOTPINK3"; + } + if( color == MLV_COLOR_HOTPINK4 ){ + return "MLV_COLOR_HOTPINK4"; + } + if( color == MLV_COLOR_PINK1 ){ + return "MLV_COLOR_PINK1"; + } + if( color == MLV_COLOR_PINK2 ){ + return "MLV_COLOR_PINK2"; + } + if( color == MLV_COLOR_PINK3 ){ + return "MLV_COLOR_PINK3"; + } + if( color == MLV_COLOR_PINK4 ){ + return "MLV_COLOR_PINK4"; + } + if( color == MLV_COLOR_LIGHTPINK1 ){ + return "MLV_COLOR_LIGHTPINK1"; + } + if( color == MLV_COLOR_LIGHTPINK2 ){ + return "MLV_COLOR_LIGHTPINK2"; + } + if( color == MLV_COLOR_LIGHTPINK3 ){ + return "MLV_COLOR_LIGHTPINK3"; + } + if( color == MLV_COLOR_LIGHTPINK4 ){ + return "MLV_COLOR_LIGHTPINK4"; + } + if( color == MLV_COLOR_PALEVIOLETRED1 ){ + return "MLV_COLOR_PALEVIOLETRED1"; + } + if( color == MLV_COLOR_PALEVIOLETRED2 ){ + return "MLV_COLOR_PALEVIOLETRED2"; + } + if( color == MLV_COLOR_PALEVIOLETRED3 ){ + return "MLV_COLOR_PALEVIOLETRED3"; + } + if( color == MLV_COLOR_PALEVIOLETRED4 ){ + return "MLV_COLOR_PALEVIOLETRED4"; + } + if( color == MLV_COLOR_MAROON1 ){ + return "MLV_COLOR_MAROON1"; + } + if( color == MLV_COLOR_MAROON2 ){ + return "MLV_COLOR_MAROON2"; + } + if( color == MLV_COLOR_MAROON3 ){ + return "MLV_COLOR_MAROON3"; + } + if( color == MLV_COLOR_MAROON4 ){ + return "MLV_COLOR_MAROON4"; + } + if( color == MLV_COLOR_VIOLETRED1 ){ + return "MLV_COLOR_VIOLETRED1"; + } + if( color == MLV_COLOR_VIOLETRED2 ){ + return "MLV_COLOR_VIOLETRED2"; + } + if( color == MLV_COLOR_VIOLETRED3 ){ + return "MLV_COLOR_VIOLETRED3"; + } + if( color == MLV_COLOR_VIOLETRED4 ){ + return "MLV_COLOR_VIOLETRED4"; + } + if( color == MLV_COLOR_MAGENTA1 ){ + return "MLV_COLOR_MAGENTA1"; + } + if( color == MLV_COLOR_MAGENTA2 ){ + return "MLV_COLOR_MAGENTA2"; + } + if( color == MLV_COLOR_MAGENTA3 ){ + return "MLV_COLOR_MAGENTA3"; + } + if( color == MLV_COLOR_MAGENTA4 ){ + return "MLV_COLOR_MAGENTA4"; + } + if( color == MLV_COLOR_ORCHID1 ){ + return "MLV_COLOR_ORCHID1"; + } + if( color == MLV_COLOR_ORCHID2 ){ + return "MLV_COLOR_ORCHID2"; + } + if( color == MLV_COLOR_ORCHID3 ){ + return "MLV_COLOR_ORCHID3"; + } + if( color == MLV_COLOR_ORCHID4 ){ + return "MLV_COLOR_ORCHID4"; + } + if( color == MLV_COLOR_PLUM1 ){ + return "MLV_COLOR_PLUM1"; + } + if( color == MLV_COLOR_PLUM2 ){ + return "MLV_COLOR_PLUM2"; + } + if( color == MLV_COLOR_PLUM3 ){ + return "MLV_COLOR_PLUM3"; + } + if( color == MLV_COLOR_PLUM4 ){ + return "MLV_COLOR_PLUM4"; + } + if( color == MLV_COLOR_MEDIUMORCHID1 ){ + return "MLV_COLOR_MEDIUMORCHID1"; + } + if( color == MLV_COLOR_MEDIUMORCHID2 ){ + return "MLV_COLOR_MEDIUMORCHID2"; + } + if( color == MLV_COLOR_MEDIUMORCHID3 ){ + return "MLV_COLOR_MEDIUMORCHID3"; + } + if( color == MLV_COLOR_MEDIUMORCHID4 ){ + return "MLV_COLOR_MEDIUMORCHID4"; + } + if( color == MLV_COLOR_DARKORCHID1 ){ + return "MLV_COLOR_DARKORCHID1"; + } + if( color == MLV_COLOR_DARKORCHID2 ){ + return "MLV_COLOR_DARKORCHID2"; + } + if( color == MLV_COLOR_DARKORCHID3 ){ + return "MLV_COLOR_DARKORCHID3"; + } + if( color == MLV_COLOR_DARKORCHID4 ){ + return "MLV_COLOR_DARKORCHID4"; + } + if( color == MLV_COLOR_PURPLE1 ){ + return "MLV_COLOR_PURPLE1"; + } + if( color == MLV_COLOR_PURPLE2 ){ + return "MLV_COLOR_PURPLE2"; + } + if( color == MLV_COLOR_PURPLE3 ){ + return "MLV_COLOR_PURPLE3"; + } + if( color == MLV_COLOR_PURPLE4 ){ + return "MLV_COLOR_PURPLE4"; + } + if( color == MLV_COLOR_MEDIUMPURPLE1 ){ + return "MLV_COLOR_MEDIUMPURPLE1"; + } + if( color == MLV_COLOR_MEDIUMPURPLE2 ){ + return "MLV_COLOR_MEDIUMPURPLE2"; + } + if( color == MLV_COLOR_MEDIUMPURPLE3 ){ + return "MLV_COLOR_MEDIUMPURPLE3"; + } + if( color == MLV_COLOR_MEDIUMPURPLE4 ){ + return "MLV_COLOR_MEDIUMPURPLE4"; + } + if( color == MLV_COLOR_THISTLE1 ){ + return "MLV_COLOR_THISTLE1"; + } + if( color == MLV_COLOR_THISTLE2 ){ + return "MLV_COLOR_THISTLE2"; + } + if( color == MLV_COLOR_THISTLE3 ){ + return "MLV_COLOR_THISTLE3"; + } + if( color == MLV_COLOR_THISTLE4 ){ + return "MLV_COLOR_THISTLE4"; + } + if( color == MLV_COLOR_GRAY0 ){ + return "MLV_COLOR_GRAY0"; + } + if( color == MLV_COLOR_GREY0 ){ + return "MLV_COLOR_GREY0"; + } + if( color == MLV_COLOR_GRAY1 ){ + return "MLV_COLOR_GRAY1"; + } + if( color == MLV_COLOR_GREY1 ){ + return "MLV_COLOR_GREY1"; + } + if( color == MLV_COLOR_GRAY2 ){ + return "MLV_COLOR_GRAY2"; + } + if( color == MLV_COLOR_GREY2 ){ + return "MLV_COLOR_GREY2"; + } + if( color == MLV_COLOR_GRAY3 ){ + return "MLV_COLOR_GRAY3"; + } + if( color == MLV_COLOR_GREY3 ){ + return "MLV_COLOR_GREY3"; + } + if( color == MLV_COLOR_GRAY4 ){ + return "MLV_COLOR_GRAY4"; + } + if( color == MLV_COLOR_GREY4 ){ + return "MLV_COLOR_GREY4"; + } + if( color == MLV_COLOR_GRAY5 ){ + return "MLV_COLOR_GRAY5"; + } + if( color == MLV_COLOR_GREY5 ){ + return "MLV_COLOR_GREY5"; + } + if( color == MLV_COLOR_GRAY6 ){ + return "MLV_COLOR_GRAY6"; + } + if( color == MLV_COLOR_GREY6 ){ + return "MLV_COLOR_GREY6"; + } + if( color == MLV_COLOR_GRAY7 ){ + return "MLV_COLOR_GRAY7"; + } + if( color == MLV_COLOR_GREY7 ){ + return "MLV_COLOR_GREY7"; + } + if( color == MLV_COLOR_GRAY8 ){ + return "MLV_COLOR_GRAY8"; + } + if( color == MLV_COLOR_GREY8 ){ + return "MLV_COLOR_GREY8"; + } + if( color == MLV_COLOR_GRAY9 ){ + return "MLV_COLOR_GRAY9"; + } + if( color == MLV_COLOR_GREY9 ){ + return "MLV_COLOR_GREY9"; + } + if( color == MLV_COLOR_GRAY10 ){ + return "MLV_COLOR_GRAY10"; + } + if( color == MLV_COLOR_GREY10 ){ + return "MLV_COLOR_GREY10"; + } + if( color == MLV_COLOR_GRAY11 ){ + return "MLV_COLOR_GRAY11"; + } + if( color == MLV_COLOR_GREY11 ){ + return "MLV_COLOR_GREY11"; + } + if( color == MLV_COLOR_GRAY12 ){ + return "MLV_COLOR_GRAY12"; + } + if( color == MLV_COLOR_GREY12 ){ + return "MLV_COLOR_GREY12"; + } + if( color == MLV_COLOR_GRAY13 ){ + return "MLV_COLOR_GRAY13"; + } + if( color == MLV_COLOR_GREY13 ){ + return "MLV_COLOR_GREY13"; + } + if( color == MLV_COLOR_GRAY14 ){ + return "MLV_COLOR_GRAY14"; + } + if( color == MLV_COLOR_GREY14 ){ + return "MLV_COLOR_GREY14"; + } + if( color == MLV_COLOR_GRAY15 ){ + return "MLV_COLOR_GRAY15"; + } + if( color == MLV_COLOR_GREY15 ){ + return "MLV_COLOR_GREY15"; + } + if( color == MLV_COLOR_GRAY16 ){ + return "MLV_COLOR_GRAY16"; + } + if( color == MLV_COLOR_GREY16 ){ + return "MLV_COLOR_GREY16"; + } + if( color == MLV_COLOR_GRAY17 ){ + return "MLV_COLOR_GRAY17"; + } + if( color == MLV_COLOR_GREY17 ){ + return "MLV_COLOR_GREY17"; + } + if( color == MLV_COLOR_GRAY18 ){ + return "MLV_COLOR_GRAY18"; + } + if( color == MLV_COLOR_GREY18 ){ + return "MLV_COLOR_GREY18"; + } + if( color == MLV_COLOR_GRAY19 ){ + return "MLV_COLOR_GRAY19"; + } + if( color == MLV_COLOR_GREY19 ){ + return "MLV_COLOR_GREY19"; + } + if( color == MLV_COLOR_GRAY20 ){ + return "MLV_COLOR_GRAY20"; + } + if( color == MLV_COLOR_GREY20 ){ + return "MLV_COLOR_GREY20"; + } + if( color == MLV_COLOR_GRAY21 ){ + return "MLV_COLOR_GRAY21"; + } + if( color == MLV_COLOR_GREY21 ){ + return "MLV_COLOR_GREY21"; + } + if( color == MLV_COLOR_GRAY22 ){ + return "MLV_COLOR_GRAY22"; + } + if( color == MLV_COLOR_GREY22 ){ + return "MLV_COLOR_GREY22"; + } + if( color == MLV_COLOR_GRAY23 ){ + return "MLV_COLOR_GRAY23"; + } + if( color == MLV_COLOR_GREY23 ){ + return "MLV_COLOR_GREY23"; + } + if( color == MLV_COLOR_GRAY24 ){ + return "MLV_COLOR_GRAY24"; + } + if( color == MLV_COLOR_GREY24 ){ + return "MLV_COLOR_GREY24"; + } + if( color == MLV_COLOR_GRAY25 ){ + return "MLV_COLOR_GRAY25"; + } + if( color == MLV_COLOR_GREY25 ){ + return "MLV_COLOR_GREY25"; + } + if( color == MLV_COLOR_GRAY26 ){ + return "MLV_COLOR_GRAY26"; + } + if( color == MLV_COLOR_GREY26 ){ + return "MLV_COLOR_GREY26"; + } + if( color == MLV_COLOR_GRAY27 ){ + return "MLV_COLOR_GRAY27"; + } + if( color == MLV_COLOR_GREY27 ){ + return "MLV_COLOR_GREY27"; + } + if( color == MLV_COLOR_GRAY28 ){ + return "MLV_COLOR_GRAY28"; + } + if( color == MLV_COLOR_GREY28 ){ + return "MLV_COLOR_GREY28"; + } + if( color == MLV_COLOR_GRAY29 ){ + return "MLV_COLOR_GRAY29"; + } + if( color == MLV_COLOR_GREY29 ){ + return "MLV_COLOR_GREY29"; + } + if( color == MLV_COLOR_GRAY30 ){ + return "MLV_COLOR_GRAY30"; + } + if( color == MLV_COLOR_GREY30 ){ + return "MLV_COLOR_GREY30"; + } + if( color == MLV_COLOR_GRAY31 ){ + return "MLV_COLOR_GRAY31"; + } + if( color == MLV_COLOR_GREY31 ){ + return "MLV_COLOR_GREY31"; + } + if( color == MLV_COLOR_GRAY32 ){ + return "MLV_COLOR_GRAY32"; + } + if( color == MLV_COLOR_GREY32 ){ + return "MLV_COLOR_GREY32"; + } + if( color == MLV_COLOR_GRAY33 ){ + return "MLV_COLOR_GRAY33"; + } + if( color == MLV_COLOR_GREY33 ){ + return "MLV_COLOR_GREY33"; + } + if( color == MLV_COLOR_GRAY34 ){ + return "MLV_COLOR_GRAY34"; + } + if( color == MLV_COLOR_GREY34 ){ + return "MLV_COLOR_GREY34"; + } + if( color == MLV_COLOR_GRAY35 ){ + return "MLV_COLOR_GRAY35"; + } + if( color == MLV_COLOR_GREY35 ){ + return "MLV_COLOR_GREY35"; + } + if( color == MLV_COLOR_GRAY36 ){ + return "MLV_COLOR_GRAY36"; + } + if( color == MLV_COLOR_GREY36 ){ + return "MLV_COLOR_GREY36"; + } + if( color == MLV_COLOR_GRAY37 ){ + return "MLV_COLOR_GRAY37"; + } + if( color == MLV_COLOR_GREY37 ){ + return "MLV_COLOR_GREY37"; + } + if( color == MLV_COLOR_GRAY38 ){ + return "MLV_COLOR_GRAY38"; + } + if( color == MLV_COLOR_GREY38 ){ + return "MLV_COLOR_GREY38"; + } + if( color == MLV_COLOR_GRAY39 ){ + return "MLV_COLOR_GRAY39"; + } + if( color == MLV_COLOR_GREY39 ){ + return "MLV_COLOR_GREY39"; + } + if( color == MLV_COLOR_GRAY40 ){ + return "MLV_COLOR_GRAY40"; + } + if( color == MLV_COLOR_GREY40 ){ + return "MLV_COLOR_GREY40"; + } + if( color == MLV_COLOR_GRAY41 ){ + return "MLV_COLOR_GRAY41"; + } + if( color == MLV_COLOR_GREY41 ){ + return "MLV_COLOR_GREY41"; + } + if( color == MLV_COLOR_GRAY42 ){ + return "MLV_COLOR_GRAY42"; + } + if( color == MLV_COLOR_GREY42 ){ + return "MLV_COLOR_GREY42"; + } + if( color == MLV_COLOR_GRAY43 ){ + return "MLV_COLOR_GRAY43"; + } + if( color == MLV_COLOR_GREY43 ){ + return "MLV_COLOR_GREY43"; + } + if( color == MLV_COLOR_GRAY44 ){ + return "MLV_COLOR_GRAY44"; + } + if( color == MLV_COLOR_GREY44 ){ + return "MLV_COLOR_GREY44"; + } + if( color == MLV_COLOR_GRAY45 ){ + return "MLV_COLOR_GRAY45"; + } + if( color == MLV_COLOR_GREY45 ){ + return "MLV_COLOR_GREY45"; + } + if( color == MLV_COLOR_GRAY46 ){ + return "MLV_COLOR_GRAY46"; + } + if( color == MLV_COLOR_GREY46 ){ + return "MLV_COLOR_GREY46"; + } + if( color == MLV_COLOR_GRAY47 ){ + return "MLV_COLOR_GRAY47"; + } + if( color == MLV_COLOR_GREY47 ){ + return "MLV_COLOR_GREY47"; + } + if( color == MLV_COLOR_GRAY48 ){ + return "MLV_COLOR_GRAY48"; + } + if( color == MLV_COLOR_GREY48 ){ + return "MLV_COLOR_GREY48"; + } + if( color == MLV_COLOR_GRAY49 ){ + return "MLV_COLOR_GRAY49"; + } + if( color == MLV_COLOR_GREY49 ){ + return "MLV_COLOR_GREY49"; + } + if( color == MLV_COLOR_GRAY50 ){ + return "MLV_COLOR_GRAY50"; + } + if( color == MLV_COLOR_GREY50 ){ + return "MLV_COLOR_GREY50"; + } + if( color == MLV_COLOR_GRAY51 ){ + return "MLV_COLOR_GRAY51"; + } + if( color == MLV_COLOR_GREY51 ){ + return "MLV_COLOR_GREY51"; + } + if( color == MLV_COLOR_GRAY52 ){ + return "MLV_COLOR_GRAY52"; + } + if( color == MLV_COLOR_GREY52 ){ + return "MLV_COLOR_GREY52"; + } + if( color == MLV_COLOR_GRAY53 ){ + return "MLV_COLOR_GRAY53"; + } + if( color == MLV_COLOR_GREY53 ){ + return "MLV_COLOR_GREY53"; + } + if( color == MLV_COLOR_GRAY54 ){ + return "MLV_COLOR_GRAY54"; + } + if( color == MLV_COLOR_GREY54 ){ + return "MLV_COLOR_GREY54"; + } + if( color == MLV_COLOR_GRAY55 ){ + return "MLV_COLOR_GRAY55"; + } + if( color == MLV_COLOR_GREY55 ){ + return "MLV_COLOR_GREY55"; + } + if( color == MLV_COLOR_GRAY56 ){ + return "MLV_COLOR_GRAY56"; + } + if( color == MLV_COLOR_GREY56 ){ + return "MLV_COLOR_GREY56"; + } + if( color == MLV_COLOR_GRAY57 ){ + return "MLV_COLOR_GRAY57"; + } + if( color == MLV_COLOR_GREY57 ){ + return "MLV_COLOR_GREY57"; + } + if( color == MLV_COLOR_GRAY58 ){ + return "MLV_COLOR_GRAY58"; + } + if( color == MLV_COLOR_GREY58 ){ + return "MLV_COLOR_GREY58"; + } + if( color == MLV_COLOR_GRAY59 ){ + return "MLV_COLOR_GRAY59"; + } + if( color == MLV_COLOR_GREY59 ){ + return "MLV_COLOR_GREY59"; + } + if( color == MLV_COLOR_GRAY60 ){ + return "MLV_COLOR_GRAY60"; + } + if( color == MLV_COLOR_GREY60 ){ + return "MLV_COLOR_GREY60"; + } + if( color == MLV_COLOR_GRAY61 ){ + return "MLV_COLOR_GRAY61"; + } + if( color == MLV_COLOR_GREY61 ){ + return "MLV_COLOR_GREY61"; + } + if( color == MLV_COLOR_GRAY62 ){ + return "MLV_COLOR_GRAY62"; + } + if( color == MLV_COLOR_GREY62 ){ + return "MLV_COLOR_GREY62"; + } + if( color == MLV_COLOR_GRAY63 ){ + return "MLV_COLOR_GRAY63"; + } + if( color == MLV_COLOR_GREY63 ){ + return "MLV_COLOR_GREY63"; + } + if( color == MLV_COLOR_GRAY64 ){ + return "MLV_COLOR_GRAY64"; + } + if( color == MLV_COLOR_GREY64 ){ + return "MLV_COLOR_GREY64"; + } + if( color == MLV_COLOR_GRAY65 ){ + return "MLV_COLOR_GRAY65"; + } + if( color == MLV_COLOR_GREY65 ){ + return "MLV_COLOR_GREY65"; + } + if( color == MLV_COLOR_GRAY66 ){ + return "MLV_COLOR_GRAY66"; + } + if( color == MLV_COLOR_GREY66 ){ + return "MLV_COLOR_GREY66"; + } + if( color == MLV_COLOR_GRAY67 ){ + return "MLV_COLOR_GRAY67"; + } + if( color == MLV_COLOR_GREY67 ){ + return "MLV_COLOR_GREY67"; + } + if( color == MLV_COLOR_GRAY68 ){ + return "MLV_COLOR_GRAY68"; + } + if( color == MLV_COLOR_GREY68 ){ + return "MLV_COLOR_GREY68"; + } + if( color == MLV_COLOR_GRAY69 ){ + return "MLV_COLOR_GRAY69"; + } + if( color == MLV_COLOR_GREY69 ){ + return "MLV_COLOR_GREY69"; + } + if( color == MLV_COLOR_GRAY70 ){ + return "MLV_COLOR_GRAY70"; + } + if( color == MLV_COLOR_GREY70 ){ + return "MLV_COLOR_GREY70"; + } + if( color == MLV_COLOR_GRAY71 ){ + return "MLV_COLOR_GRAY71"; + } + if( color == MLV_COLOR_GREY71 ){ + return "MLV_COLOR_GREY71"; + } + if( color == MLV_COLOR_GRAY72 ){ + return "MLV_COLOR_GRAY72"; + } + if( color == MLV_COLOR_GREY72 ){ + return "MLV_COLOR_GREY72"; + } + if( color == MLV_COLOR_GRAY73 ){ + return "MLV_COLOR_GRAY73"; + } + if( color == MLV_COLOR_GREY73 ){ + return "MLV_COLOR_GREY73"; + } + if( color == MLV_COLOR_GRAY74 ){ + return "MLV_COLOR_GRAY74"; + } + if( color == MLV_COLOR_GREY74 ){ + return "MLV_COLOR_GREY74"; + } + if( color == MLV_COLOR_GRAY75 ){ + return "MLV_COLOR_GRAY75"; + } + if( color == MLV_COLOR_GREY75 ){ + return "MLV_COLOR_GREY75"; + } + if( color == MLV_COLOR_GRAY76 ){ + return "MLV_COLOR_GRAY76"; + } + if( color == MLV_COLOR_GREY76 ){ + return "MLV_COLOR_GREY76"; + } + if( color == MLV_COLOR_GRAY77 ){ + return "MLV_COLOR_GRAY77"; + } + if( color == MLV_COLOR_GREY77 ){ + return "MLV_COLOR_GREY77"; + } + if( color == MLV_COLOR_GRAY78 ){ + return "MLV_COLOR_GRAY78"; + } + if( color == MLV_COLOR_GREY78 ){ + return "MLV_COLOR_GREY78"; + } + if( color == MLV_COLOR_GRAY79 ){ + return "MLV_COLOR_GRAY79"; + } + if( color == MLV_COLOR_GREY79 ){ + return "MLV_COLOR_GREY79"; + } + if( color == MLV_COLOR_GRAY80 ){ + return "MLV_COLOR_GRAY80"; + } + if( color == MLV_COLOR_GREY80 ){ + return "MLV_COLOR_GREY80"; + } + if( color == MLV_COLOR_GRAY81 ){ + return "MLV_COLOR_GRAY81"; + } + if( color == MLV_COLOR_GREY81 ){ + return "MLV_COLOR_GREY81"; + } + if( color == MLV_COLOR_GRAY82 ){ + return "MLV_COLOR_GRAY82"; + } + if( color == MLV_COLOR_GREY82 ){ + return "MLV_COLOR_GREY82"; + } + if( color == MLV_COLOR_GRAY83 ){ + return "MLV_COLOR_GRAY83"; + } + if( color == MLV_COLOR_GREY83 ){ + return "MLV_COLOR_GREY83"; + } + if( color == MLV_COLOR_GRAY84 ){ + return "MLV_COLOR_GRAY84"; + } + if( color == MLV_COLOR_GREY84 ){ + return "MLV_COLOR_GREY84"; + } + if( color == MLV_COLOR_GRAY85 ){ + return "MLV_COLOR_GRAY85"; + } + if( color == MLV_COLOR_GREY85 ){ + return "MLV_COLOR_GREY85"; + } + if( color == MLV_COLOR_GRAY86 ){ + return "MLV_COLOR_GRAY86"; + } + if( color == MLV_COLOR_GREY86 ){ + return "MLV_COLOR_GREY86"; + } + if( color == MLV_COLOR_GRAY87 ){ + return "MLV_COLOR_GRAY87"; + } + if( color == MLV_COLOR_GREY87 ){ + return "MLV_COLOR_GREY87"; + } + if( color == MLV_COLOR_GRAY88 ){ + return "MLV_COLOR_GRAY88"; + } + if( color == MLV_COLOR_GREY88 ){ + return "MLV_COLOR_GREY88"; + } + if( color == MLV_COLOR_GRAY89 ){ + return "MLV_COLOR_GRAY89"; + } + if( color == MLV_COLOR_GREY89 ){ + return "MLV_COLOR_GREY89"; + } + if( color == MLV_COLOR_GRAY90 ){ + return "MLV_COLOR_GRAY90"; + } + if( color == MLV_COLOR_GREY90 ){ + return "MLV_COLOR_GREY90"; + } + if( color == MLV_COLOR_GRAY91 ){ + return "MLV_COLOR_GRAY91"; + } + if( color == MLV_COLOR_GREY91 ){ + return "MLV_COLOR_GREY91"; + } + if( color == MLV_COLOR_GRAY92 ){ + return "MLV_COLOR_GRAY92"; + } + if( color == MLV_COLOR_GREY92 ){ + return "MLV_COLOR_GREY92"; + } + if( color == MLV_COLOR_GRAY93 ){ + return "MLV_COLOR_GRAY93"; + } + if( color == MLV_COLOR_GREY93 ){ + return "MLV_COLOR_GREY93"; + } + if( color == MLV_COLOR_GRAY94 ){ + return "MLV_COLOR_GRAY94"; + } + if( color == MLV_COLOR_GREY94 ){ + return "MLV_COLOR_GREY94"; + } + if( color == MLV_COLOR_GRAY95 ){ + return "MLV_COLOR_GRAY95"; + } + if( color == MLV_COLOR_GREY95 ){ + return "MLV_COLOR_GREY95"; + } + if( color == MLV_COLOR_GRAY96 ){ + return "MLV_COLOR_GRAY96"; + } + if( color == MLV_COLOR_GREY96 ){ + return "MLV_COLOR_GREY96"; + } + if( color == MLV_COLOR_GRAY97 ){ + return "MLV_COLOR_GRAY97"; + } + if( color == MLV_COLOR_GREY97 ){ + return "MLV_COLOR_GREY97"; + } + if( color == MLV_COLOR_GRAY98 ){ + return "MLV_COLOR_GRAY98"; + } + if( color == MLV_COLOR_GREY98 ){ + return "MLV_COLOR_GREY98"; + } + if( color == MLV_COLOR_GRAY99 ){ + return "MLV_COLOR_GRAY99"; + } + if( color == MLV_COLOR_GREY99 ){ + return "MLV_COLOR_GREY99"; + } + if( color == MLV_COLOR_GRAY100 ){ + return "MLV_COLOR_GRAY100"; + } + if( color == MLV_COLOR_GREY100 ){ + return "MLV_COLOR_GREY100"; + } + if( color == MLV_COLOR_DARK_GREY ){ + return "MLV_COLOR_DARK_GREY"; + } + if( color == MLV_COLOR_DARKGREY ){ + return "MLV_COLOR_DARKGREY"; + } + if( color == MLV_COLOR_DARK_GRAY ){ + return "MLV_COLOR_DARK_GRAY"; + } + if( color == MLV_COLOR_DARKGRAY ){ + return "MLV_COLOR_DARKGRAY"; + } + if( color == MLV_COLOR_DARK_BLUE ){ + return "MLV_COLOR_DARK_BLUE"; + } + if( color == MLV_COLOR_DARKBLUE ){ + return "MLV_COLOR_DARKBLUE"; + } + if( color == MLV_COLOR_DARK_CYAN ){ + return "MLV_COLOR_DARK_CYAN"; + } + if( color == MLV_COLOR_DARKCYAN ){ + return "MLV_COLOR_DARKCYAN"; + } + if( color == MLV_COLOR_DARK_MAGENTA ){ + return "MLV_COLOR_DARK_MAGENTA"; + } + if( color == MLV_COLOR_DARKMAGENTA ){ + return "MLV_COLOR_DARKMAGENTA"; + } + if( color == MLV_COLOR_DARK_RED ){ + return "MLV_COLOR_DARK_RED"; + } + if( color == MLV_COLOR_DARKRED ){ + return "MLV_COLOR_DARKRED"; + } + if( color == MLV_COLOR_LIGHT_GREEN ){ + return "MLV_COLOR_LIGHT_GREEN"; + } + if( color == MLV_COLOR_LIGHTGREEN ){ + return "MLV_COLOR_LIGHTGREEN"; + } + ERROR( "Unexepcted color code" ); + return NULL; +} + +MLV_Color MLV_convert_string_to_color( const char* color_name ){ + if( strcmp( color_name, "MLV_COLOR_SNOW" )==0 ){ + return MLV_COLOR_SNOW; + } + if( strcmp( color_name, "MLV_COLOR_GHOST_WHITE" )==0 ){ + return MLV_COLOR_GHOST_WHITE; + } + if( strcmp( color_name, "MLV_COLOR_GHOSTWHITE" )==0 ){ + return MLV_COLOR_GHOSTWHITE; + } + if( strcmp( color_name, "MLV_COLOR_WHITE_SMOKE" )==0 ){ + return MLV_COLOR_WHITE_SMOKE; + } + if( strcmp( color_name, "MLV_COLOR_WHITESMOKE" )==0 ){ + return MLV_COLOR_WHITESMOKE; + } + if( strcmp( color_name, "MLV_COLOR_GAINSBORO" )==0 ){ + return MLV_COLOR_GAINSBORO; + } + if( strcmp( color_name, "MLV_COLOR_FLORAL_WHITE" )==0 ){ + return MLV_COLOR_FLORAL_WHITE; + } + if( strcmp( color_name, "MLV_COLOR_FLORALWHITE" )==0 ){ + return MLV_COLOR_FLORALWHITE; + } + if( strcmp( color_name, "MLV_COLOR_OLD_LACE" )==0 ){ + return MLV_COLOR_OLD_LACE; + } + if( strcmp( color_name, "MLV_COLOR_OLDLACE" )==0 ){ + return MLV_COLOR_OLDLACE; + } + if( strcmp( color_name, "MLV_COLOR_LINEN" )==0 ){ + return MLV_COLOR_LINEN; + } + if( strcmp( color_name, "MLV_COLOR_ANTIQUE_WHITE" )==0 ){ + return MLV_COLOR_ANTIQUE_WHITE; + } + if( strcmp( color_name, "MLV_COLOR_ANTIQUEWHITE" )==0 ){ + return MLV_COLOR_ANTIQUEWHITE; + } + if( strcmp( color_name, "MLV_COLOR_PAPAYA_WHIP" )==0 ){ + return MLV_COLOR_PAPAYA_WHIP; + } + if( strcmp( color_name, "MLV_COLOR_PAPAYAWHIP" )==0 ){ + return MLV_COLOR_PAPAYAWHIP; + } + if( strcmp( color_name, "MLV_COLOR_BLANCHED_ALMOND" )==0 ){ + return MLV_COLOR_BLANCHED_ALMOND; + } + if( strcmp( color_name, "MLV_COLOR_BLANCHEDALMOND" )==0 ){ + return MLV_COLOR_BLANCHEDALMOND; + } + if( strcmp( color_name, "MLV_COLOR_BISQUE" )==0 ){ + return MLV_COLOR_BISQUE; + } + if( strcmp( color_name, "MLV_COLOR_PEACH_PUFF" )==0 ){ + return MLV_COLOR_PEACH_PUFF; + } + if( strcmp( color_name, "MLV_COLOR_PEACHPUFF" )==0 ){ + return MLV_COLOR_PEACHPUFF; + } + if( strcmp( color_name, "MLV_COLOR_NAVAJO_WHITE" )==0 ){ + return MLV_COLOR_NAVAJO_WHITE; + } + if( strcmp( color_name, "MLV_COLOR_NAVAJOWHITE" )==0 ){ + return MLV_COLOR_NAVAJOWHITE; + } + if( strcmp( color_name, "MLV_COLOR_MOCCASIN" )==0 ){ + return MLV_COLOR_MOCCASIN; + } + if( strcmp( color_name, "MLV_COLOR_CORNSILK" )==0 ){ + return MLV_COLOR_CORNSILK; + } + if( strcmp( color_name, "MLV_COLOR_IVORY" )==0 ){ + return MLV_COLOR_IVORY; + } + if( strcmp( color_name, "MLV_COLOR_LEMON_CHIFFON" )==0 ){ + return MLV_COLOR_LEMON_CHIFFON; + } + if( strcmp( color_name, "MLV_COLOR_LEMONCHIFFON" )==0 ){ + return MLV_COLOR_LEMONCHIFFON; + } + if( strcmp( color_name, "MLV_COLOR_SEASHELL" )==0 ){ + return MLV_COLOR_SEASHELL; + } + if( strcmp( color_name, "MLV_COLOR_HONEYDEW" )==0 ){ + return MLV_COLOR_HONEYDEW; + } + if( strcmp( color_name, "MLV_COLOR_MINT_CREAM" )==0 ){ + return MLV_COLOR_MINT_CREAM; + } + if( strcmp( color_name, "MLV_COLOR_MINTCREAM" )==0 ){ + return MLV_COLOR_MINTCREAM; + } + if( strcmp( color_name, "MLV_COLOR_AZURE" )==0 ){ + return MLV_COLOR_AZURE; + } + if( strcmp( color_name, "MLV_COLOR_ALICE_BLUE" )==0 ){ + return MLV_COLOR_ALICE_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_ALICEBLUE" )==0 ){ + return MLV_COLOR_ALICEBLUE; + } + if( strcmp( color_name, "MLV_COLOR_LAVENDER" )==0 ){ + return MLV_COLOR_LAVENDER; + } + if( strcmp( color_name, "MLV_COLOR_LAVENDER_BLUSH" )==0 ){ + return MLV_COLOR_LAVENDER_BLUSH; + } + if( strcmp( color_name, "MLV_COLOR_LAVENDERBLUSH" )==0 ){ + return MLV_COLOR_LAVENDERBLUSH; + } + if( strcmp( color_name, "MLV_COLOR_MISTY_ROSE" )==0 ){ + return MLV_COLOR_MISTY_ROSE; + } + if( strcmp( color_name, "MLV_COLOR_MISTYROSE" )==0 ){ + return MLV_COLOR_MISTYROSE; + } + if( strcmp( color_name, "MLV_COLOR_WHITE" )==0 ){ + return MLV_COLOR_WHITE; + } + if( strcmp( color_name, "MLV_COLOR_BLACK" )==0 ){ + return MLV_COLOR_BLACK; + } + if( strcmp( color_name, "MLV_COLOR_DARK_SLATE_GRAY" )==0 ){ + return MLV_COLOR_DARK_SLATE_GRAY; + } + if( strcmp( color_name, "MLV_COLOR_DARKSLATEGRAY" )==0 ){ + return MLV_COLOR_DARKSLATEGRAY; + } + if( strcmp( color_name, "MLV_COLOR_DARK_SLATE_GREY" )==0 ){ + return MLV_COLOR_DARK_SLATE_GREY; + } + if( strcmp( color_name, "MLV_COLOR_DARKSLATEGREY" )==0 ){ + return MLV_COLOR_DARKSLATEGREY; + } + if( strcmp( color_name, "MLV_COLOR_DIM_GRAY" )==0 ){ + return MLV_COLOR_DIM_GRAY; + } + if( strcmp( color_name, "MLV_COLOR_DIMGRAY" )==0 ){ + return MLV_COLOR_DIMGRAY; + } + if( strcmp( color_name, "MLV_COLOR_DIM_GREY" )==0 ){ + return MLV_COLOR_DIM_GREY; + } + if( strcmp( color_name, "MLV_COLOR_DIMGREY" )==0 ){ + return MLV_COLOR_DIMGREY; + } + if( strcmp( color_name, "MLV_COLOR_SLATE_GRAY" )==0 ){ + return MLV_COLOR_SLATE_GRAY; + } + if( strcmp( color_name, "MLV_COLOR_SLATEGRAY" )==0 ){ + return MLV_COLOR_SLATEGRAY; + } + if( strcmp( color_name, "MLV_COLOR_SLATE_GREY" )==0 ){ + return MLV_COLOR_SLATE_GREY; + } + if( strcmp( color_name, "MLV_COLOR_SLATEGREY" )==0 ){ + return MLV_COLOR_SLATEGREY; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_SLATE_GRAY" )==0 ){ + return MLV_COLOR_LIGHT_SLATE_GRAY; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSLATEGRAY" )==0 ){ + return MLV_COLOR_LIGHTSLATEGRAY; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_SLATE_GREY" )==0 ){ + return MLV_COLOR_LIGHT_SLATE_GREY; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSLATEGREY" )==0 ){ + return MLV_COLOR_LIGHTSLATEGREY; + } + if( strcmp( color_name, "MLV_COLOR_GRAY" )==0 ){ + return MLV_COLOR_GRAY; + } + if( strcmp( color_name, "MLV_COLOR_GREY" )==0 ){ + return MLV_COLOR_GREY; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_GREY" )==0 ){ + return MLV_COLOR_LIGHT_GREY; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTGREY" )==0 ){ + return MLV_COLOR_LIGHTGREY; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_GRAY" )==0 ){ + return MLV_COLOR_LIGHT_GRAY; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTGRAY" )==0 ){ + return MLV_COLOR_LIGHTGRAY; + } + if( strcmp( color_name, "MLV_COLOR_MIDNIGHT_BLUE" )==0 ){ + return MLV_COLOR_MIDNIGHT_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_MIDNIGHTBLUE" )==0 ){ + return MLV_COLOR_MIDNIGHTBLUE; + } + if( strcmp( color_name, "MLV_COLOR_NAVY" )==0 ){ + return MLV_COLOR_NAVY; + } + if( strcmp( color_name, "MLV_COLOR_NAVY_BLUE" )==0 ){ + return MLV_COLOR_NAVY_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_NAVYBLUE" )==0 ){ + return MLV_COLOR_NAVYBLUE; + } + if( strcmp( color_name, "MLV_COLOR_CORNFLOWER_BLUE" )==0 ){ + return MLV_COLOR_CORNFLOWER_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_CORNFLOWERBLUE" )==0 ){ + return MLV_COLOR_CORNFLOWERBLUE; + } + if( strcmp( color_name, "MLV_COLOR_DARK_SLATE_BLUE" )==0 ){ + return MLV_COLOR_DARK_SLATE_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_DARKSLATEBLUE" )==0 ){ + return MLV_COLOR_DARKSLATEBLUE; + } + if( strcmp( color_name, "MLV_COLOR_SLATE_BLUE" )==0 ){ + return MLV_COLOR_SLATE_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_SLATEBLUE" )==0 ){ + return MLV_COLOR_SLATEBLUE; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUM_SLATE_BLUE" )==0 ){ + return MLV_COLOR_MEDIUM_SLATE_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMSLATEBLUE" )==0 ){ + return MLV_COLOR_MEDIUMSLATEBLUE; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_SLATE_BLUE" )==0 ){ + return MLV_COLOR_LIGHT_SLATE_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSLATEBLUE" )==0 ){ + return MLV_COLOR_LIGHTSLATEBLUE; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUM_BLUE" )==0 ){ + return MLV_COLOR_MEDIUM_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMBLUE" )==0 ){ + return MLV_COLOR_MEDIUMBLUE; + } + if( strcmp( color_name, "MLV_COLOR_ROYAL_BLUE" )==0 ){ + return MLV_COLOR_ROYAL_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_ROYALBLUE" )==0 ){ + return MLV_COLOR_ROYALBLUE; + } + if( strcmp( color_name, "MLV_COLOR_BLUE" )==0 ){ + return MLV_COLOR_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_DODGER_BLUE" )==0 ){ + return MLV_COLOR_DODGER_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_DODGERBLUE" )==0 ){ + return MLV_COLOR_DODGERBLUE; + } + if( strcmp( color_name, "MLV_COLOR_DEEP_SKY_BLUE" )==0 ){ + return MLV_COLOR_DEEP_SKY_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_DEEPSKYBLUE" )==0 ){ + return MLV_COLOR_DEEPSKYBLUE; + } + if( strcmp( color_name, "MLV_COLOR_SKY_BLUE" )==0 ){ + return MLV_COLOR_SKY_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_SKYBLUE" )==0 ){ + return MLV_COLOR_SKYBLUE; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_SKY_BLUE" )==0 ){ + return MLV_COLOR_LIGHT_SKY_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSKYBLUE" )==0 ){ + return MLV_COLOR_LIGHTSKYBLUE; + } + if( strcmp( color_name, "MLV_COLOR_STEEL_BLUE" )==0 ){ + return MLV_COLOR_STEEL_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_STEELBLUE" )==0 ){ + return MLV_COLOR_STEELBLUE; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_STEEL_BLUE" )==0 ){ + return MLV_COLOR_LIGHT_STEEL_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSTEELBLUE" )==0 ){ + return MLV_COLOR_LIGHTSTEELBLUE; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_BLUE" )==0 ){ + return MLV_COLOR_LIGHT_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTBLUE" )==0 ){ + return MLV_COLOR_LIGHTBLUE; + } + if( strcmp( color_name, "MLV_COLOR_POWDER_BLUE" )==0 ){ + return MLV_COLOR_POWDER_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_POWDERBLUE" )==0 ){ + return MLV_COLOR_POWDERBLUE; + } + if( strcmp( color_name, "MLV_COLOR_PALE_TURQUOISE" )==0 ){ + return MLV_COLOR_PALE_TURQUOISE; + } + if( strcmp( color_name, "MLV_COLOR_PALETURQUOISE" )==0 ){ + return MLV_COLOR_PALETURQUOISE; + } + if( strcmp( color_name, "MLV_COLOR_DARK_TURQUOISE" )==0 ){ + return MLV_COLOR_DARK_TURQUOISE; + } + if( strcmp( color_name, "MLV_COLOR_DARKTURQUOISE" )==0 ){ + return MLV_COLOR_DARKTURQUOISE; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUM_TURQUOISE" )==0 ){ + return MLV_COLOR_MEDIUM_TURQUOISE; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMTURQUOISE" )==0 ){ + return MLV_COLOR_MEDIUMTURQUOISE; + } + if( strcmp( color_name, "MLV_COLOR_TURQUOISE" )==0 ){ + return MLV_COLOR_TURQUOISE; + } + if( strcmp( color_name, "MLV_COLOR_CYAN" )==0 ){ + return MLV_COLOR_CYAN; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_CYAN" )==0 ){ + return MLV_COLOR_LIGHT_CYAN; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTCYAN" )==0 ){ + return MLV_COLOR_LIGHTCYAN; + } + if( strcmp( color_name, "MLV_COLOR_CADET_BLUE" )==0 ){ + return MLV_COLOR_CADET_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_CADETBLUE" )==0 ){ + return MLV_COLOR_CADETBLUE; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUM_AQUAMARINE" )==0 ){ + return MLV_COLOR_MEDIUM_AQUAMARINE; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMAQUAMARINE" )==0 ){ + return MLV_COLOR_MEDIUMAQUAMARINE; + } + if( strcmp( color_name, "MLV_COLOR_AQUAMARINE" )==0 ){ + return MLV_COLOR_AQUAMARINE; + } + if( strcmp( color_name, "MLV_COLOR_DARK_GREEN" )==0 ){ + return MLV_COLOR_DARK_GREEN; + } + if( strcmp( color_name, "MLV_COLOR_DARKGREEN" )==0 ){ + return MLV_COLOR_DARKGREEN; + } + if( strcmp( color_name, "MLV_COLOR_DARK_OLIVE_GREEN" )==0 ){ + return MLV_COLOR_DARK_OLIVE_GREEN; + } + if( strcmp( color_name, "MLV_COLOR_DARKOLIVEGREEN" )==0 ){ + return MLV_COLOR_DARKOLIVEGREEN; + } + if( strcmp( color_name, "MLV_COLOR_DARK_SEA_GREEN" )==0 ){ + return MLV_COLOR_DARK_SEA_GREEN; + } + if( strcmp( color_name, "MLV_COLOR_DARKSEAGREEN" )==0 ){ + return MLV_COLOR_DARKSEAGREEN; + } + if( strcmp( color_name, "MLV_COLOR_SEA_GREEN" )==0 ){ + return MLV_COLOR_SEA_GREEN; + } + if( strcmp( color_name, "MLV_COLOR_SEAGREEN" )==0 ){ + return MLV_COLOR_SEAGREEN; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUM_SEA_GREEN" )==0 ){ + return MLV_COLOR_MEDIUM_SEA_GREEN; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMSEAGREEN" )==0 ){ + return MLV_COLOR_MEDIUMSEAGREEN; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_SEA_GREEN" )==0 ){ + return MLV_COLOR_LIGHT_SEA_GREEN; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSEAGREEN" )==0 ){ + return MLV_COLOR_LIGHTSEAGREEN; + } + if( strcmp( color_name, "MLV_COLOR_PALE_GREEN" )==0 ){ + return MLV_COLOR_PALE_GREEN; + } + if( strcmp( color_name, "MLV_COLOR_PALEGREEN" )==0 ){ + return MLV_COLOR_PALEGREEN; + } + if( strcmp( color_name, "MLV_COLOR_SPRING_GREEN" )==0 ){ + return MLV_COLOR_SPRING_GREEN; + } + if( strcmp( color_name, "MLV_COLOR_SPRINGGREEN" )==0 ){ + return MLV_COLOR_SPRINGGREEN; + } + if( strcmp( color_name, "MLV_COLOR_LAWN_GREEN" )==0 ){ + return MLV_COLOR_LAWN_GREEN; + } + if( strcmp( color_name, "MLV_COLOR_LAWNGREEN" )==0 ){ + return MLV_COLOR_LAWNGREEN; + } + if( strcmp( color_name, "MLV_COLOR_GREEN" )==0 ){ + return MLV_COLOR_GREEN; + } + if( strcmp( color_name, "MLV_COLOR_CHARTREUSE" )==0 ){ + return MLV_COLOR_CHARTREUSE; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUM_SPRING_GREEN" )==0 ){ + return MLV_COLOR_MEDIUM_SPRING_GREEN; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMSPRINGGREEN" )==0 ){ + return MLV_COLOR_MEDIUMSPRINGGREEN; + } + if( strcmp( color_name, "MLV_COLOR_GREEN_YELLOW" )==0 ){ + return MLV_COLOR_GREEN_YELLOW; + } + if( strcmp( color_name, "MLV_COLOR_GREENYELLOW" )==0 ){ + return MLV_COLOR_GREENYELLOW; + } + if( strcmp( color_name, "MLV_COLOR_LIME_GREEN" )==0 ){ + return MLV_COLOR_LIME_GREEN; + } + if( strcmp( color_name, "MLV_COLOR_LIMEGREEN" )==0 ){ + return MLV_COLOR_LIMEGREEN; + } + if( strcmp( color_name, "MLV_COLOR_YELLOW_GREEN" )==0 ){ + return MLV_COLOR_YELLOW_GREEN; + } + if( strcmp( color_name, "MLV_COLOR_YELLOWGREEN" )==0 ){ + return MLV_COLOR_YELLOWGREEN; + } + if( strcmp( color_name, "MLV_COLOR_FOREST_GREEN" )==0 ){ + return MLV_COLOR_FOREST_GREEN; + } + if( strcmp( color_name, "MLV_COLOR_FORESTGREEN" )==0 ){ + return MLV_COLOR_FORESTGREEN; + } + if( strcmp( color_name, "MLV_COLOR_OLIVE_DRAB" )==0 ){ + return MLV_COLOR_OLIVE_DRAB; + } + if( strcmp( color_name, "MLV_COLOR_OLIVEDRAB" )==0 ){ + return MLV_COLOR_OLIVEDRAB; + } + if( strcmp( color_name, "MLV_COLOR_DARK_KHAKI" )==0 ){ + return MLV_COLOR_DARK_KHAKI; + } + if( strcmp( color_name, "MLV_COLOR_DARKKHAKI" )==0 ){ + return MLV_COLOR_DARKKHAKI; + } + if( strcmp( color_name, "MLV_COLOR_KHAKI" )==0 ){ + return MLV_COLOR_KHAKI; + } + if( strcmp( color_name, "MLV_COLOR_PALE_GOLDENROD" )==0 ){ + return MLV_COLOR_PALE_GOLDENROD; + } + if( strcmp( color_name, "MLV_COLOR_PALEGOLDENROD" )==0 ){ + return MLV_COLOR_PALEGOLDENROD; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_GOLDENROD_YELLOW" )==0 ){ + return MLV_COLOR_LIGHT_GOLDENROD_YELLOW; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTGOLDENRODYELLOW" )==0 ){ + return MLV_COLOR_LIGHTGOLDENRODYELLOW; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_YELLOW" )==0 ){ + return MLV_COLOR_LIGHT_YELLOW; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTYELLOW" )==0 ){ + return MLV_COLOR_LIGHTYELLOW; + } + if( strcmp( color_name, "MLV_COLOR_YELLOW" )==0 ){ + return MLV_COLOR_YELLOW; + } + if( strcmp( color_name, "MLV_COLOR_GOLD" )==0 ){ + return MLV_COLOR_GOLD; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_GOLDENROD" )==0 ){ + return MLV_COLOR_LIGHT_GOLDENROD; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTGOLDENROD" )==0 ){ + return MLV_COLOR_LIGHTGOLDENROD; + } + if( strcmp( color_name, "MLV_COLOR_GOLDENROD" )==0 ){ + return MLV_COLOR_GOLDENROD; + } + if( strcmp( color_name, "MLV_COLOR_DARK_GOLDENROD" )==0 ){ + return MLV_COLOR_DARK_GOLDENROD; + } + if( strcmp( color_name, "MLV_COLOR_DARKGOLDENROD" )==0 ){ + return MLV_COLOR_DARKGOLDENROD; + } + if( strcmp( color_name, "MLV_COLOR_ROSY_BROWN" )==0 ){ + return MLV_COLOR_ROSY_BROWN; + } + if( strcmp( color_name, "MLV_COLOR_ROSYBROWN" )==0 ){ + return MLV_COLOR_ROSYBROWN; + } + if( strcmp( color_name, "MLV_COLOR_INDIAN_RED" )==0 ){ + return MLV_COLOR_INDIAN_RED; + } + if( strcmp( color_name, "MLV_COLOR_INDIANRED" )==0 ){ + return MLV_COLOR_INDIANRED; + } + if( strcmp( color_name, "MLV_COLOR_SADDLE_BROWN" )==0 ){ + return MLV_COLOR_SADDLE_BROWN; + } + if( strcmp( color_name, "MLV_COLOR_SADDLEBROWN" )==0 ){ + return MLV_COLOR_SADDLEBROWN; + } + if( strcmp( color_name, "MLV_COLOR_SIENNA" )==0 ){ + return MLV_COLOR_SIENNA; + } + if( strcmp( color_name, "MLV_COLOR_PERU" )==0 ){ + return MLV_COLOR_PERU; + } + if( strcmp( color_name, "MLV_COLOR_BURLYWOOD" )==0 ){ + return MLV_COLOR_BURLYWOOD; + } + if( strcmp( color_name, "MLV_COLOR_BEIGE" )==0 ){ + return MLV_COLOR_BEIGE; + } + if( strcmp( color_name, "MLV_COLOR_WHEAT" )==0 ){ + return MLV_COLOR_WHEAT; + } + if( strcmp( color_name, "MLV_COLOR_SANDY_BROWN" )==0 ){ + return MLV_COLOR_SANDY_BROWN; + } + if( strcmp( color_name, "MLV_COLOR_SANDYBROWN" )==0 ){ + return MLV_COLOR_SANDYBROWN; + } + if( strcmp( color_name, "MLV_COLOR_TAN" )==0 ){ + return MLV_COLOR_TAN; + } + if( strcmp( color_name, "MLV_COLOR_CHOCOLATE" )==0 ){ + return MLV_COLOR_CHOCOLATE; + } + if( strcmp( color_name, "MLV_COLOR_FIREBRICK" )==0 ){ + return MLV_COLOR_FIREBRICK; + } + if( strcmp( color_name, "MLV_COLOR_BROWN" )==0 ){ + return MLV_COLOR_BROWN; + } + if( strcmp( color_name, "MLV_COLOR_DARK_SALMON" )==0 ){ + return MLV_COLOR_DARK_SALMON; + } + if( strcmp( color_name, "MLV_COLOR_DARKSALMON" )==0 ){ + return MLV_COLOR_DARKSALMON; + } + if( strcmp( color_name, "MLV_COLOR_SALMON" )==0 ){ + return MLV_COLOR_SALMON; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_SALMON" )==0 ){ + return MLV_COLOR_LIGHT_SALMON; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSALMON" )==0 ){ + return MLV_COLOR_LIGHTSALMON; + } + if( strcmp( color_name, "MLV_COLOR_ORANGE" )==0 ){ + return MLV_COLOR_ORANGE; + } + if( strcmp( color_name, "MLV_COLOR_DARK_ORANGE" )==0 ){ + return MLV_COLOR_DARK_ORANGE; + } + if( strcmp( color_name, "MLV_COLOR_DARKORANGE" )==0 ){ + return MLV_COLOR_DARKORANGE; + } + if( strcmp( color_name, "MLV_COLOR_CORAL" )==0 ){ + return MLV_COLOR_CORAL; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_CORAL" )==0 ){ + return MLV_COLOR_LIGHT_CORAL; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTCORAL" )==0 ){ + return MLV_COLOR_LIGHTCORAL; + } + if( strcmp( color_name, "MLV_COLOR_TOMATO" )==0 ){ + return MLV_COLOR_TOMATO; + } + if( strcmp( color_name, "MLV_COLOR_ORANGE_RED" )==0 ){ + return MLV_COLOR_ORANGE_RED; + } + if( strcmp( color_name, "MLV_COLOR_ORANGERED" )==0 ){ + return MLV_COLOR_ORANGERED; + } + if( strcmp( color_name, "MLV_COLOR_RED" )==0 ){ + return MLV_COLOR_RED; + } + if( strcmp( color_name, "MLV_COLOR_HOT_PINK" )==0 ){ + return MLV_COLOR_HOT_PINK; + } + if( strcmp( color_name, "MLV_COLOR_HOTPINK" )==0 ){ + return MLV_COLOR_HOTPINK; + } + if( strcmp( color_name, "MLV_COLOR_DEEP_PINK" )==0 ){ + return MLV_COLOR_DEEP_PINK; + } + if( strcmp( color_name, "MLV_COLOR_DEEPPINK" )==0 ){ + return MLV_COLOR_DEEPPINK; + } + if( strcmp( color_name, "MLV_COLOR_PINK" )==0 ){ + return MLV_COLOR_PINK; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_PINK" )==0 ){ + return MLV_COLOR_LIGHT_PINK; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTPINK" )==0 ){ + return MLV_COLOR_LIGHTPINK; + } + if( strcmp( color_name, "MLV_COLOR_PALE_VIOLET_RED" )==0 ){ + return MLV_COLOR_PALE_VIOLET_RED; + } + if( strcmp( color_name, "MLV_COLOR_PALEVIOLETRED" )==0 ){ + return MLV_COLOR_PALEVIOLETRED; + } + if( strcmp( color_name, "MLV_COLOR_MAROON" )==0 ){ + return MLV_COLOR_MAROON; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUM_VIOLET_RED" )==0 ){ + return MLV_COLOR_MEDIUM_VIOLET_RED; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMVIOLETRED" )==0 ){ + return MLV_COLOR_MEDIUMVIOLETRED; + } + if( strcmp( color_name, "MLV_COLOR_VIOLET_RED" )==0 ){ + return MLV_COLOR_VIOLET_RED; + } + if( strcmp( color_name, "MLV_COLOR_VIOLETRED" )==0 ){ + return MLV_COLOR_VIOLETRED; + } + if( strcmp( color_name, "MLV_COLOR_MAGENTA" )==0 ){ + return MLV_COLOR_MAGENTA; + } + if( strcmp( color_name, "MLV_COLOR_VIOLET" )==0 ){ + return MLV_COLOR_VIOLET; + } + if( strcmp( color_name, "MLV_COLOR_PLUM" )==0 ){ + return MLV_COLOR_PLUM; + } + if( strcmp( color_name, "MLV_COLOR_ORCHID" )==0 ){ + return MLV_COLOR_ORCHID; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUM_ORCHID" )==0 ){ + return MLV_COLOR_MEDIUM_ORCHID; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMORCHID" )==0 ){ + return MLV_COLOR_MEDIUMORCHID; + } + if( strcmp( color_name, "MLV_COLOR_DARK_ORCHID" )==0 ){ + return MLV_COLOR_DARK_ORCHID; + } + if( strcmp( color_name, "MLV_COLOR_DARKORCHID" )==0 ){ + return MLV_COLOR_DARKORCHID; + } + if( strcmp( color_name, "MLV_COLOR_DARK_VIOLET" )==0 ){ + return MLV_COLOR_DARK_VIOLET; + } + if( strcmp( color_name, "MLV_COLOR_DARKVIOLET" )==0 ){ + return MLV_COLOR_DARKVIOLET; + } + if( strcmp( color_name, "MLV_COLOR_BLUE_VIOLET" )==0 ){ + return MLV_COLOR_BLUE_VIOLET; + } + if( strcmp( color_name, "MLV_COLOR_BLUEVIOLET" )==0 ){ + return MLV_COLOR_BLUEVIOLET; + } + if( strcmp( color_name, "MLV_COLOR_PURPLE" )==0 ){ + return MLV_COLOR_PURPLE; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUM_PURPLE" )==0 ){ + return MLV_COLOR_MEDIUM_PURPLE; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMPURPLE" )==0 ){ + return MLV_COLOR_MEDIUMPURPLE; + } + if( strcmp( color_name, "MLV_COLOR_THISTLE" )==0 ){ + return MLV_COLOR_THISTLE; + } + if( strcmp( color_name, "MLV_COLOR_SNOW1" )==0 ){ + return MLV_COLOR_SNOW1; + } + if( strcmp( color_name, "MLV_COLOR_SNOW2" )==0 ){ + return MLV_COLOR_SNOW2; + } + if( strcmp( color_name, "MLV_COLOR_SNOW3" )==0 ){ + return MLV_COLOR_SNOW3; + } + if( strcmp( color_name, "MLV_COLOR_SNOW4" )==0 ){ + return MLV_COLOR_SNOW4; + } + if( strcmp( color_name, "MLV_COLOR_SEASHELL1" )==0 ){ + return MLV_COLOR_SEASHELL1; + } + if( strcmp( color_name, "MLV_COLOR_SEASHELL2" )==0 ){ + return MLV_COLOR_SEASHELL2; + } + if( strcmp( color_name, "MLV_COLOR_SEASHELL3" )==0 ){ + return MLV_COLOR_SEASHELL3; + } + if( strcmp( color_name, "MLV_COLOR_SEASHELL4" )==0 ){ + return MLV_COLOR_SEASHELL4; + } + if( strcmp( color_name, "MLV_COLOR_ANTIQUEWHITE1" )==0 ){ + return MLV_COLOR_ANTIQUEWHITE1; + } + if( strcmp( color_name, "MLV_COLOR_ANTIQUEWHITE2" )==0 ){ + return MLV_COLOR_ANTIQUEWHITE2; + } + if( strcmp( color_name, "MLV_COLOR_ANTIQUEWHITE3" )==0 ){ + return MLV_COLOR_ANTIQUEWHITE3; + } + if( strcmp( color_name, "MLV_COLOR_ANTIQUEWHITE4" )==0 ){ + return MLV_COLOR_ANTIQUEWHITE4; + } + if( strcmp( color_name, "MLV_COLOR_BISQUE1" )==0 ){ + return MLV_COLOR_BISQUE1; + } + if( strcmp( color_name, "MLV_COLOR_BISQUE2" )==0 ){ + return MLV_COLOR_BISQUE2; + } + if( strcmp( color_name, "MLV_COLOR_BISQUE3" )==0 ){ + return MLV_COLOR_BISQUE3; + } + if( strcmp( color_name, "MLV_COLOR_BISQUE4" )==0 ){ + return MLV_COLOR_BISQUE4; + } + if( strcmp( color_name, "MLV_COLOR_PEACHPUFF1" )==0 ){ + return MLV_COLOR_PEACHPUFF1; + } + if( strcmp( color_name, "MLV_COLOR_PEACHPUFF2" )==0 ){ + return MLV_COLOR_PEACHPUFF2; + } + if( strcmp( color_name, "MLV_COLOR_PEACHPUFF3" )==0 ){ + return MLV_COLOR_PEACHPUFF3; + } + if( strcmp( color_name, "MLV_COLOR_PEACHPUFF4" )==0 ){ + return MLV_COLOR_PEACHPUFF4; + } + if( strcmp( color_name, "MLV_COLOR_NAVAJOWHITE1" )==0 ){ + return MLV_COLOR_NAVAJOWHITE1; + } + if( strcmp( color_name, "MLV_COLOR_NAVAJOWHITE2" )==0 ){ + return MLV_COLOR_NAVAJOWHITE2; + } + if( strcmp( color_name, "MLV_COLOR_NAVAJOWHITE3" )==0 ){ + return MLV_COLOR_NAVAJOWHITE3; + } + if( strcmp( color_name, "MLV_COLOR_NAVAJOWHITE4" )==0 ){ + return MLV_COLOR_NAVAJOWHITE4; + } + if( strcmp( color_name, "MLV_COLOR_LEMONCHIFFON1" )==0 ){ + return MLV_COLOR_LEMONCHIFFON1; + } + if( strcmp( color_name, "MLV_COLOR_LEMONCHIFFON2" )==0 ){ + return MLV_COLOR_LEMONCHIFFON2; + } + if( strcmp( color_name, "MLV_COLOR_LEMONCHIFFON3" )==0 ){ + return MLV_COLOR_LEMONCHIFFON3; + } + if( strcmp( color_name, "MLV_COLOR_LEMONCHIFFON4" )==0 ){ + return MLV_COLOR_LEMONCHIFFON4; + } + if( strcmp( color_name, "MLV_COLOR_CORNSILK1" )==0 ){ + return MLV_COLOR_CORNSILK1; + } + if( strcmp( color_name, "MLV_COLOR_CORNSILK2" )==0 ){ + return MLV_COLOR_CORNSILK2; + } + if( strcmp( color_name, "MLV_COLOR_CORNSILK3" )==0 ){ + return MLV_COLOR_CORNSILK3; + } + if( strcmp( color_name, "MLV_COLOR_CORNSILK4" )==0 ){ + return MLV_COLOR_CORNSILK4; + } + if( strcmp( color_name, "MLV_COLOR_IVORY1" )==0 ){ + return MLV_COLOR_IVORY1; + } + if( strcmp( color_name, "MLV_COLOR_IVORY2" )==0 ){ + return MLV_COLOR_IVORY2; + } + if( strcmp( color_name, "MLV_COLOR_IVORY3" )==0 ){ + return MLV_COLOR_IVORY3; + } + if( strcmp( color_name, "MLV_COLOR_IVORY4" )==0 ){ + return MLV_COLOR_IVORY4; + } + if( strcmp( color_name, "MLV_COLOR_HONEYDEW1" )==0 ){ + return MLV_COLOR_HONEYDEW1; + } + if( strcmp( color_name, "MLV_COLOR_HONEYDEW2" )==0 ){ + return MLV_COLOR_HONEYDEW2; + } + if( strcmp( color_name, "MLV_COLOR_HONEYDEW3" )==0 ){ + return MLV_COLOR_HONEYDEW3; + } + if( strcmp( color_name, "MLV_COLOR_HONEYDEW4" )==0 ){ + return MLV_COLOR_HONEYDEW4; + } + if( strcmp( color_name, "MLV_COLOR_LAVENDERBLUSH1" )==0 ){ + return MLV_COLOR_LAVENDERBLUSH1; + } + if( strcmp( color_name, "MLV_COLOR_LAVENDERBLUSH2" )==0 ){ + return MLV_COLOR_LAVENDERBLUSH2; + } + if( strcmp( color_name, "MLV_COLOR_LAVENDERBLUSH3" )==0 ){ + return MLV_COLOR_LAVENDERBLUSH3; + } + if( strcmp( color_name, "MLV_COLOR_LAVENDERBLUSH4" )==0 ){ + return MLV_COLOR_LAVENDERBLUSH4; + } + if( strcmp( color_name, "MLV_COLOR_MISTYROSE1" )==0 ){ + return MLV_COLOR_MISTYROSE1; + } + if( strcmp( color_name, "MLV_COLOR_MISTYROSE2" )==0 ){ + return MLV_COLOR_MISTYROSE2; + } + if( strcmp( color_name, "MLV_COLOR_MISTYROSE3" )==0 ){ + return MLV_COLOR_MISTYROSE3; + } + if( strcmp( color_name, "MLV_COLOR_MISTYROSE4" )==0 ){ + return MLV_COLOR_MISTYROSE4; + } + if( strcmp( color_name, "MLV_COLOR_AZURE1" )==0 ){ + return MLV_COLOR_AZURE1; + } + if( strcmp( color_name, "MLV_COLOR_AZURE2" )==0 ){ + return MLV_COLOR_AZURE2; + } + if( strcmp( color_name, "MLV_COLOR_AZURE3" )==0 ){ + return MLV_COLOR_AZURE3; + } + if( strcmp( color_name, "MLV_COLOR_AZURE4" )==0 ){ + return MLV_COLOR_AZURE4; + } + if( strcmp( color_name, "MLV_COLOR_SLATEBLUE1" )==0 ){ + return MLV_COLOR_SLATEBLUE1; + } + if( strcmp( color_name, "MLV_COLOR_SLATEBLUE2" )==0 ){ + return MLV_COLOR_SLATEBLUE2; + } + if( strcmp( color_name, "MLV_COLOR_SLATEBLUE3" )==0 ){ + return MLV_COLOR_SLATEBLUE3; + } + if( strcmp( color_name, "MLV_COLOR_SLATEBLUE4" )==0 ){ + return MLV_COLOR_SLATEBLUE4; + } + if( strcmp( color_name, "MLV_COLOR_ROYALBLUE1" )==0 ){ + return MLV_COLOR_ROYALBLUE1; + } + if( strcmp( color_name, "MLV_COLOR_ROYALBLUE2" )==0 ){ + return MLV_COLOR_ROYALBLUE2; + } + if( strcmp( color_name, "MLV_COLOR_ROYALBLUE3" )==0 ){ + return MLV_COLOR_ROYALBLUE3; + } + if( strcmp( color_name, "MLV_COLOR_ROYALBLUE4" )==0 ){ + return MLV_COLOR_ROYALBLUE4; + } + if( strcmp( color_name, "MLV_COLOR_BLUE1" )==0 ){ + return MLV_COLOR_BLUE1; + } + if( strcmp( color_name, "MLV_COLOR_BLUE2" )==0 ){ + return MLV_COLOR_BLUE2; + } + if( strcmp( color_name, "MLV_COLOR_BLUE3" )==0 ){ + return MLV_COLOR_BLUE3; + } + if( strcmp( color_name, "MLV_COLOR_BLUE4" )==0 ){ + return MLV_COLOR_BLUE4; + } + if( strcmp( color_name, "MLV_COLOR_DODGERBLUE1" )==0 ){ + return MLV_COLOR_DODGERBLUE1; + } + if( strcmp( color_name, "MLV_COLOR_DODGERBLUE2" )==0 ){ + return MLV_COLOR_DODGERBLUE2; + } + if( strcmp( color_name, "MLV_COLOR_DODGERBLUE3" )==0 ){ + return MLV_COLOR_DODGERBLUE3; + } + if( strcmp( color_name, "MLV_COLOR_DODGERBLUE4" )==0 ){ + return MLV_COLOR_DODGERBLUE4; + } + if( strcmp( color_name, "MLV_COLOR_STEELBLUE1" )==0 ){ + return MLV_COLOR_STEELBLUE1; + } + if( strcmp( color_name, "MLV_COLOR_STEELBLUE2" )==0 ){ + return MLV_COLOR_STEELBLUE2; + } + if( strcmp( color_name, "MLV_COLOR_STEELBLUE3" )==0 ){ + return MLV_COLOR_STEELBLUE3; + } + if( strcmp( color_name, "MLV_COLOR_STEELBLUE4" )==0 ){ + return MLV_COLOR_STEELBLUE4; + } + if( strcmp( color_name, "MLV_COLOR_DEEPSKYBLUE1" )==0 ){ + return MLV_COLOR_DEEPSKYBLUE1; + } + if( strcmp( color_name, "MLV_COLOR_DEEPSKYBLUE2" )==0 ){ + return MLV_COLOR_DEEPSKYBLUE2; + } + if( strcmp( color_name, "MLV_COLOR_DEEPSKYBLUE3" )==0 ){ + return MLV_COLOR_DEEPSKYBLUE3; + } + if( strcmp( color_name, "MLV_COLOR_DEEPSKYBLUE4" )==0 ){ + return MLV_COLOR_DEEPSKYBLUE4; + } + if( strcmp( color_name, "MLV_COLOR_SKYBLUE1" )==0 ){ + return MLV_COLOR_SKYBLUE1; + } + if( strcmp( color_name, "MLV_COLOR_SKYBLUE2" )==0 ){ + return MLV_COLOR_SKYBLUE2; + } + if( strcmp( color_name, "MLV_COLOR_SKYBLUE3" )==0 ){ + return MLV_COLOR_SKYBLUE3; + } + if( strcmp( color_name, "MLV_COLOR_SKYBLUE4" )==0 ){ + return MLV_COLOR_SKYBLUE4; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSKYBLUE1" )==0 ){ + return MLV_COLOR_LIGHTSKYBLUE1; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSKYBLUE2" )==0 ){ + return MLV_COLOR_LIGHTSKYBLUE2; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSKYBLUE3" )==0 ){ + return MLV_COLOR_LIGHTSKYBLUE3; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSKYBLUE4" )==0 ){ + return MLV_COLOR_LIGHTSKYBLUE4; + } + if( strcmp( color_name, "MLV_COLOR_SLATEGRAY1" )==0 ){ + return MLV_COLOR_SLATEGRAY1; + } + if( strcmp( color_name, "MLV_COLOR_SLATEGRAY2" )==0 ){ + return MLV_COLOR_SLATEGRAY2; + } + if( strcmp( color_name, "MLV_COLOR_SLATEGRAY3" )==0 ){ + return MLV_COLOR_SLATEGRAY3; + } + if( strcmp( color_name, "MLV_COLOR_SLATEGRAY4" )==0 ){ + return MLV_COLOR_SLATEGRAY4; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSTEELBLUE1" )==0 ){ + return MLV_COLOR_LIGHTSTEELBLUE1; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSTEELBLUE2" )==0 ){ + return MLV_COLOR_LIGHTSTEELBLUE2; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSTEELBLUE3" )==0 ){ + return MLV_COLOR_LIGHTSTEELBLUE3; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSTEELBLUE4" )==0 ){ + return MLV_COLOR_LIGHTSTEELBLUE4; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTBLUE1" )==0 ){ + return MLV_COLOR_LIGHTBLUE1; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTBLUE2" )==0 ){ + return MLV_COLOR_LIGHTBLUE2; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTBLUE3" )==0 ){ + return MLV_COLOR_LIGHTBLUE3; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTBLUE4" )==0 ){ + return MLV_COLOR_LIGHTBLUE4; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTCYAN1" )==0 ){ + return MLV_COLOR_LIGHTCYAN1; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTCYAN2" )==0 ){ + return MLV_COLOR_LIGHTCYAN2; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTCYAN3" )==0 ){ + return MLV_COLOR_LIGHTCYAN3; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTCYAN4" )==0 ){ + return MLV_COLOR_LIGHTCYAN4; + } + if( strcmp( color_name, "MLV_COLOR_PALETURQUOISE1" )==0 ){ + return MLV_COLOR_PALETURQUOISE1; + } + if( strcmp( color_name, "MLV_COLOR_PALETURQUOISE2" )==0 ){ + return MLV_COLOR_PALETURQUOISE2; + } + if( strcmp( color_name, "MLV_COLOR_PALETURQUOISE3" )==0 ){ + return MLV_COLOR_PALETURQUOISE3; + } + if( strcmp( color_name, "MLV_COLOR_PALETURQUOISE4" )==0 ){ + return MLV_COLOR_PALETURQUOISE4; + } + if( strcmp( color_name, "MLV_COLOR_CADETBLUE1" )==0 ){ + return MLV_COLOR_CADETBLUE1; + } + if( strcmp( color_name, "MLV_COLOR_CADETBLUE2" )==0 ){ + return MLV_COLOR_CADETBLUE2; + } + if( strcmp( color_name, "MLV_COLOR_CADETBLUE3" )==0 ){ + return MLV_COLOR_CADETBLUE3; + } + if( strcmp( color_name, "MLV_COLOR_CADETBLUE4" )==0 ){ + return MLV_COLOR_CADETBLUE4; + } + if( strcmp( color_name, "MLV_COLOR_TURQUOISE1" )==0 ){ + return MLV_COLOR_TURQUOISE1; + } + if( strcmp( color_name, "MLV_COLOR_TURQUOISE2" )==0 ){ + return MLV_COLOR_TURQUOISE2; + } + if( strcmp( color_name, "MLV_COLOR_TURQUOISE3" )==0 ){ + return MLV_COLOR_TURQUOISE3; + } + if( strcmp( color_name, "MLV_COLOR_TURQUOISE4" )==0 ){ + return MLV_COLOR_TURQUOISE4; + } + if( strcmp( color_name, "MLV_COLOR_CYAN1" )==0 ){ + return MLV_COLOR_CYAN1; + } + if( strcmp( color_name, "MLV_COLOR_CYAN2" )==0 ){ + return MLV_COLOR_CYAN2; + } + if( strcmp( color_name, "MLV_COLOR_CYAN3" )==0 ){ + return MLV_COLOR_CYAN3; + } + if( strcmp( color_name, "MLV_COLOR_CYAN4" )==0 ){ + return MLV_COLOR_CYAN4; + } + if( strcmp( color_name, "MLV_COLOR_DARKSLATEGRAY1" )==0 ){ + return MLV_COLOR_DARKSLATEGRAY1; + } + if( strcmp( color_name, "MLV_COLOR_DARKSLATEGRAY2" )==0 ){ + return MLV_COLOR_DARKSLATEGRAY2; + } + if( strcmp( color_name, "MLV_COLOR_DARKSLATEGRAY3" )==0 ){ + return MLV_COLOR_DARKSLATEGRAY3; + } + if( strcmp( color_name, "MLV_COLOR_DARKSLATEGRAY4" )==0 ){ + return MLV_COLOR_DARKSLATEGRAY4; + } + if( strcmp( color_name, "MLV_COLOR_AQUAMARINE1" )==0 ){ + return MLV_COLOR_AQUAMARINE1; + } + if( strcmp( color_name, "MLV_COLOR_AQUAMARINE2" )==0 ){ + return MLV_COLOR_AQUAMARINE2; + } + if( strcmp( color_name, "MLV_COLOR_AQUAMARINE3" )==0 ){ + return MLV_COLOR_AQUAMARINE3; + } + if( strcmp( color_name, "MLV_COLOR_AQUAMARINE4" )==0 ){ + return MLV_COLOR_AQUAMARINE4; + } + if( strcmp( color_name, "MLV_COLOR_DARKSEAGREEN1" )==0 ){ + return MLV_COLOR_DARKSEAGREEN1; + } + if( strcmp( color_name, "MLV_COLOR_DARKSEAGREEN2" )==0 ){ + return MLV_COLOR_DARKSEAGREEN2; + } + if( strcmp( color_name, "MLV_COLOR_DARKSEAGREEN3" )==0 ){ + return MLV_COLOR_DARKSEAGREEN3; + } + if( strcmp( color_name, "MLV_COLOR_DARKSEAGREEN4" )==0 ){ + return MLV_COLOR_DARKSEAGREEN4; + } + if( strcmp( color_name, "MLV_COLOR_SEAGREEN1" )==0 ){ + return MLV_COLOR_SEAGREEN1; + } + if( strcmp( color_name, "MLV_COLOR_SEAGREEN2" )==0 ){ + return MLV_COLOR_SEAGREEN2; + } + if( strcmp( color_name, "MLV_COLOR_SEAGREEN3" )==0 ){ + return MLV_COLOR_SEAGREEN3; + } + if( strcmp( color_name, "MLV_COLOR_SEAGREEN4" )==0 ){ + return MLV_COLOR_SEAGREEN4; + } + if( strcmp( color_name, "MLV_COLOR_PALEGREEN1" )==0 ){ + return MLV_COLOR_PALEGREEN1; + } + if( strcmp( color_name, "MLV_COLOR_PALEGREEN2" )==0 ){ + return MLV_COLOR_PALEGREEN2; + } + if( strcmp( color_name, "MLV_COLOR_PALEGREEN3" )==0 ){ + return MLV_COLOR_PALEGREEN3; + } + if( strcmp( color_name, "MLV_COLOR_PALEGREEN4" )==0 ){ + return MLV_COLOR_PALEGREEN4; + } + if( strcmp( color_name, "MLV_COLOR_SPRINGGREEN1" )==0 ){ + return MLV_COLOR_SPRINGGREEN1; + } + if( strcmp( color_name, "MLV_COLOR_SPRINGGREEN2" )==0 ){ + return MLV_COLOR_SPRINGGREEN2; + } + if( strcmp( color_name, "MLV_COLOR_SPRINGGREEN3" )==0 ){ + return MLV_COLOR_SPRINGGREEN3; + } + if( strcmp( color_name, "MLV_COLOR_SPRINGGREEN4" )==0 ){ + return MLV_COLOR_SPRINGGREEN4; + } + if( strcmp( color_name, "MLV_COLOR_GREEN1" )==0 ){ + return MLV_COLOR_GREEN1; + } + if( strcmp( color_name, "MLV_COLOR_GREEN2" )==0 ){ + return MLV_COLOR_GREEN2; + } + if( strcmp( color_name, "MLV_COLOR_GREEN3" )==0 ){ + return MLV_COLOR_GREEN3; + } + if( strcmp( color_name, "MLV_COLOR_GREEN4" )==0 ){ + return MLV_COLOR_GREEN4; + } + if( strcmp( color_name, "MLV_COLOR_CHARTREUSE1" )==0 ){ + return MLV_COLOR_CHARTREUSE1; + } + if( strcmp( color_name, "MLV_COLOR_CHARTREUSE2" )==0 ){ + return MLV_COLOR_CHARTREUSE2; + } + if( strcmp( color_name, "MLV_COLOR_CHARTREUSE3" )==0 ){ + return MLV_COLOR_CHARTREUSE3; + } + if( strcmp( color_name, "MLV_COLOR_CHARTREUSE4" )==0 ){ + return MLV_COLOR_CHARTREUSE4; + } + if( strcmp( color_name, "MLV_COLOR_OLIVEDRAB1" )==0 ){ + return MLV_COLOR_OLIVEDRAB1; + } + if( strcmp( color_name, "MLV_COLOR_OLIVEDRAB2" )==0 ){ + return MLV_COLOR_OLIVEDRAB2; + } + if( strcmp( color_name, "MLV_COLOR_OLIVEDRAB3" )==0 ){ + return MLV_COLOR_OLIVEDRAB3; + } + if( strcmp( color_name, "MLV_COLOR_OLIVEDRAB4" )==0 ){ + return MLV_COLOR_OLIVEDRAB4; + } + if( strcmp( color_name, "MLV_COLOR_DARKOLIVEGREEN1" )==0 ){ + return MLV_COLOR_DARKOLIVEGREEN1; + } + if( strcmp( color_name, "MLV_COLOR_DARKOLIVEGREEN2" )==0 ){ + return MLV_COLOR_DARKOLIVEGREEN2; + } + if( strcmp( color_name, "MLV_COLOR_DARKOLIVEGREEN3" )==0 ){ + return MLV_COLOR_DARKOLIVEGREEN3; + } + if( strcmp( color_name, "MLV_COLOR_DARKOLIVEGREEN4" )==0 ){ + return MLV_COLOR_DARKOLIVEGREEN4; + } + if( strcmp( color_name, "MLV_COLOR_KHAKI1" )==0 ){ + return MLV_COLOR_KHAKI1; + } + if( strcmp( color_name, "MLV_COLOR_KHAKI2" )==0 ){ + return MLV_COLOR_KHAKI2; + } + if( strcmp( color_name, "MLV_COLOR_KHAKI3" )==0 ){ + return MLV_COLOR_KHAKI3; + } + if( strcmp( color_name, "MLV_COLOR_KHAKI4" )==0 ){ + return MLV_COLOR_KHAKI4; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTGOLDENROD1" )==0 ){ + return MLV_COLOR_LIGHTGOLDENROD1; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTGOLDENROD2" )==0 ){ + return MLV_COLOR_LIGHTGOLDENROD2; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTGOLDENROD3" )==0 ){ + return MLV_COLOR_LIGHTGOLDENROD3; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTGOLDENROD4" )==0 ){ + return MLV_COLOR_LIGHTGOLDENROD4; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTYELLOW1" )==0 ){ + return MLV_COLOR_LIGHTYELLOW1; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTYELLOW2" )==0 ){ + return MLV_COLOR_LIGHTYELLOW2; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTYELLOW3" )==0 ){ + return MLV_COLOR_LIGHTYELLOW3; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTYELLOW4" )==0 ){ + return MLV_COLOR_LIGHTYELLOW4; + } + if( strcmp( color_name, "MLV_COLOR_YELLOW1" )==0 ){ + return MLV_COLOR_YELLOW1; + } + if( strcmp( color_name, "MLV_COLOR_YELLOW2" )==0 ){ + return MLV_COLOR_YELLOW2; + } + if( strcmp( color_name, "MLV_COLOR_YELLOW3" )==0 ){ + return MLV_COLOR_YELLOW3; + } + if( strcmp( color_name, "MLV_COLOR_YELLOW4" )==0 ){ + return MLV_COLOR_YELLOW4; + } + if( strcmp( color_name, "MLV_COLOR_GOLD1" )==0 ){ + return MLV_COLOR_GOLD1; + } + if( strcmp( color_name, "MLV_COLOR_GOLD2" )==0 ){ + return MLV_COLOR_GOLD2; + } + if( strcmp( color_name, "MLV_COLOR_GOLD3" )==0 ){ + return MLV_COLOR_GOLD3; + } + if( strcmp( color_name, "MLV_COLOR_GOLD4" )==0 ){ + return MLV_COLOR_GOLD4; + } + if( strcmp( color_name, "MLV_COLOR_GOLDENROD1" )==0 ){ + return MLV_COLOR_GOLDENROD1; + } + if( strcmp( color_name, "MLV_COLOR_GOLDENROD2" )==0 ){ + return MLV_COLOR_GOLDENROD2; + } + if( strcmp( color_name, "MLV_COLOR_GOLDENROD3" )==0 ){ + return MLV_COLOR_GOLDENROD3; + } + if( strcmp( color_name, "MLV_COLOR_GOLDENROD4" )==0 ){ + return MLV_COLOR_GOLDENROD4; + } + if( strcmp( color_name, "MLV_COLOR_DARKGOLDENROD1" )==0 ){ + return MLV_COLOR_DARKGOLDENROD1; + } + if( strcmp( color_name, "MLV_COLOR_DARKGOLDENROD2" )==0 ){ + return MLV_COLOR_DARKGOLDENROD2; + } + if( strcmp( color_name, "MLV_COLOR_DARKGOLDENROD3" )==0 ){ + return MLV_COLOR_DARKGOLDENROD3; + } + if( strcmp( color_name, "MLV_COLOR_DARKGOLDENROD4" )==0 ){ + return MLV_COLOR_DARKGOLDENROD4; + } + if( strcmp( color_name, "MLV_COLOR_ROSYBROWN1" )==0 ){ + return MLV_COLOR_ROSYBROWN1; + } + if( strcmp( color_name, "MLV_COLOR_ROSYBROWN2" )==0 ){ + return MLV_COLOR_ROSYBROWN2; + } + if( strcmp( color_name, "MLV_COLOR_ROSYBROWN3" )==0 ){ + return MLV_COLOR_ROSYBROWN3; + } + if( strcmp( color_name, "MLV_COLOR_ROSYBROWN4" )==0 ){ + return MLV_COLOR_ROSYBROWN4; + } + if( strcmp( color_name, "MLV_COLOR_INDIANRED1" )==0 ){ + return MLV_COLOR_INDIANRED1; + } + if( strcmp( color_name, "MLV_COLOR_INDIANRED2" )==0 ){ + return MLV_COLOR_INDIANRED2; + } + if( strcmp( color_name, "MLV_COLOR_INDIANRED3" )==0 ){ + return MLV_COLOR_INDIANRED3; + } + if( strcmp( color_name, "MLV_COLOR_INDIANRED4" )==0 ){ + return MLV_COLOR_INDIANRED4; + } + if( strcmp( color_name, "MLV_COLOR_SIENNA1" )==0 ){ + return MLV_COLOR_SIENNA1; + } + if( strcmp( color_name, "MLV_COLOR_SIENNA2" )==0 ){ + return MLV_COLOR_SIENNA2; + } + if( strcmp( color_name, "MLV_COLOR_SIENNA3" )==0 ){ + return MLV_COLOR_SIENNA3; + } + if( strcmp( color_name, "MLV_COLOR_SIENNA4" )==0 ){ + return MLV_COLOR_SIENNA4; + } + if( strcmp( color_name, "MLV_COLOR_BURLYWOOD1" )==0 ){ + return MLV_COLOR_BURLYWOOD1; + } + if( strcmp( color_name, "MLV_COLOR_BURLYWOOD2" )==0 ){ + return MLV_COLOR_BURLYWOOD2; + } + if( strcmp( color_name, "MLV_COLOR_BURLYWOOD3" )==0 ){ + return MLV_COLOR_BURLYWOOD3; + } + if( strcmp( color_name, "MLV_COLOR_BURLYWOOD4" )==0 ){ + return MLV_COLOR_BURLYWOOD4; + } + if( strcmp( color_name, "MLV_COLOR_WHEAT1" )==0 ){ + return MLV_COLOR_WHEAT1; + } + if( strcmp( color_name, "MLV_COLOR_WHEAT2" )==0 ){ + return MLV_COLOR_WHEAT2; + } + if( strcmp( color_name, "MLV_COLOR_WHEAT3" )==0 ){ + return MLV_COLOR_WHEAT3; + } + if( strcmp( color_name, "MLV_COLOR_WHEAT4" )==0 ){ + return MLV_COLOR_WHEAT4; + } + if( strcmp( color_name, "MLV_COLOR_TAN1" )==0 ){ + return MLV_COLOR_TAN1; + } + if( strcmp( color_name, "MLV_COLOR_TAN2" )==0 ){ + return MLV_COLOR_TAN2; + } + if( strcmp( color_name, "MLV_COLOR_TAN3" )==0 ){ + return MLV_COLOR_TAN3; + } + if( strcmp( color_name, "MLV_COLOR_TAN4" )==0 ){ + return MLV_COLOR_TAN4; + } + if( strcmp( color_name, "MLV_COLOR_CHOCOLATE1" )==0 ){ + return MLV_COLOR_CHOCOLATE1; + } + if( strcmp( color_name, "MLV_COLOR_CHOCOLATE2" )==0 ){ + return MLV_COLOR_CHOCOLATE2; + } + if( strcmp( color_name, "MLV_COLOR_CHOCOLATE3" )==0 ){ + return MLV_COLOR_CHOCOLATE3; + } + if( strcmp( color_name, "MLV_COLOR_CHOCOLATE4" )==0 ){ + return MLV_COLOR_CHOCOLATE4; + } + if( strcmp( color_name, "MLV_COLOR_FIREBRICK1" )==0 ){ + return MLV_COLOR_FIREBRICK1; + } + if( strcmp( color_name, "MLV_COLOR_FIREBRICK2" )==0 ){ + return MLV_COLOR_FIREBRICK2; + } + if( strcmp( color_name, "MLV_COLOR_FIREBRICK3" )==0 ){ + return MLV_COLOR_FIREBRICK3; + } + if( strcmp( color_name, "MLV_COLOR_FIREBRICK4" )==0 ){ + return MLV_COLOR_FIREBRICK4; + } + if( strcmp( color_name, "MLV_COLOR_BROWN1" )==0 ){ + return MLV_COLOR_BROWN1; + } + if( strcmp( color_name, "MLV_COLOR_BROWN2" )==0 ){ + return MLV_COLOR_BROWN2; + } + if( strcmp( color_name, "MLV_COLOR_BROWN3" )==0 ){ + return MLV_COLOR_BROWN3; + } + if( strcmp( color_name, "MLV_COLOR_BROWN4" )==0 ){ + return MLV_COLOR_BROWN4; + } + if( strcmp( color_name, "MLV_COLOR_SALMON1" )==0 ){ + return MLV_COLOR_SALMON1; + } + if( strcmp( color_name, "MLV_COLOR_SALMON2" )==0 ){ + return MLV_COLOR_SALMON2; + } + if( strcmp( color_name, "MLV_COLOR_SALMON3" )==0 ){ + return MLV_COLOR_SALMON3; + } + if( strcmp( color_name, "MLV_COLOR_SALMON4" )==0 ){ + return MLV_COLOR_SALMON4; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSALMON1" )==0 ){ + return MLV_COLOR_LIGHTSALMON1; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSALMON2" )==0 ){ + return MLV_COLOR_LIGHTSALMON2; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSALMON3" )==0 ){ + return MLV_COLOR_LIGHTSALMON3; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTSALMON4" )==0 ){ + return MLV_COLOR_LIGHTSALMON4; + } + if( strcmp( color_name, "MLV_COLOR_ORANGE1" )==0 ){ + return MLV_COLOR_ORANGE1; + } + if( strcmp( color_name, "MLV_COLOR_ORANGE2" )==0 ){ + return MLV_COLOR_ORANGE2; + } + if( strcmp( color_name, "MLV_COLOR_ORANGE3" )==0 ){ + return MLV_COLOR_ORANGE3; + } + if( strcmp( color_name, "MLV_COLOR_ORANGE4" )==0 ){ + return MLV_COLOR_ORANGE4; + } + if( strcmp( color_name, "MLV_COLOR_DARKORANGE1" )==0 ){ + return MLV_COLOR_DARKORANGE1; + } + if( strcmp( color_name, "MLV_COLOR_DARKORANGE2" )==0 ){ + return MLV_COLOR_DARKORANGE2; + } + if( strcmp( color_name, "MLV_COLOR_DARKORANGE3" )==0 ){ + return MLV_COLOR_DARKORANGE3; + } + if( strcmp( color_name, "MLV_COLOR_DARKORANGE4" )==0 ){ + return MLV_COLOR_DARKORANGE4; + } + if( strcmp( color_name, "MLV_COLOR_CORAL1" )==0 ){ + return MLV_COLOR_CORAL1; + } + if( strcmp( color_name, "MLV_COLOR_CORAL2" )==0 ){ + return MLV_COLOR_CORAL2; + } + if( strcmp( color_name, "MLV_COLOR_CORAL3" )==0 ){ + return MLV_COLOR_CORAL3; + } + if( strcmp( color_name, "MLV_COLOR_CORAL4" )==0 ){ + return MLV_COLOR_CORAL4; + } + if( strcmp( color_name, "MLV_COLOR_TOMATO1" )==0 ){ + return MLV_COLOR_TOMATO1; + } + if( strcmp( color_name, "MLV_COLOR_TOMATO2" )==0 ){ + return MLV_COLOR_TOMATO2; + } + if( strcmp( color_name, "MLV_COLOR_TOMATO3" )==0 ){ + return MLV_COLOR_TOMATO3; + } + if( strcmp( color_name, "MLV_COLOR_TOMATO4" )==0 ){ + return MLV_COLOR_TOMATO4; + } + if( strcmp( color_name, "MLV_COLOR_ORANGERED1" )==0 ){ + return MLV_COLOR_ORANGERED1; + } + if( strcmp( color_name, "MLV_COLOR_ORANGERED2" )==0 ){ + return MLV_COLOR_ORANGERED2; + } + if( strcmp( color_name, "MLV_COLOR_ORANGERED3" )==0 ){ + return MLV_COLOR_ORANGERED3; + } + if( strcmp( color_name, "MLV_COLOR_ORANGERED4" )==0 ){ + return MLV_COLOR_ORANGERED4; + } + if( strcmp( color_name, "MLV_COLOR_RED1" )==0 ){ + return MLV_COLOR_RED1; + } + if( strcmp( color_name, "MLV_COLOR_RED2" )==0 ){ + return MLV_COLOR_RED2; + } + if( strcmp( color_name, "MLV_COLOR_RED3" )==0 ){ + return MLV_COLOR_RED3; + } + if( strcmp( color_name, "MLV_COLOR_RED4" )==0 ){ + return MLV_COLOR_RED4; + } + if( strcmp( color_name, "MLV_COLOR_DEEPPINK1" )==0 ){ + return MLV_COLOR_DEEPPINK1; + } + if( strcmp( color_name, "MLV_COLOR_DEEPPINK2" )==0 ){ + return MLV_COLOR_DEEPPINK2; + } + if( strcmp( color_name, "MLV_COLOR_DEEPPINK3" )==0 ){ + return MLV_COLOR_DEEPPINK3; + } + if( strcmp( color_name, "MLV_COLOR_DEEPPINK4" )==0 ){ + return MLV_COLOR_DEEPPINK4; + } + if( strcmp( color_name, "MLV_COLOR_HOTPINK1" )==0 ){ + return MLV_COLOR_HOTPINK1; + } + if( strcmp( color_name, "MLV_COLOR_HOTPINK2" )==0 ){ + return MLV_COLOR_HOTPINK2; + } + if( strcmp( color_name, "MLV_COLOR_HOTPINK3" )==0 ){ + return MLV_COLOR_HOTPINK3; + } + if( strcmp( color_name, "MLV_COLOR_HOTPINK4" )==0 ){ + return MLV_COLOR_HOTPINK4; + } + if( strcmp( color_name, "MLV_COLOR_PINK1" )==0 ){ + return MLV_COLOR_PINK1; + } + if( strcmp( color_name, "MLV_COLOR_PINK2" )==0 ){ + return MLV_COLOR_PINK2; + } + if( strcmp( color_name, "MLV_COLOR_PINK3" )==0 ){ + return MLV_COLOR_PINK3; + } + if( strcmp( color_name, "MLV_COLOR_PINK4" )==0 ){ + return MLV_COLOR_PINK4; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTPINK1" )==0 ){ + return MLV_COLOR_LIGHTPINK1; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTPINK2" )==0 ){ + return MLV_COLOR_LIGHTPINK2; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTPINK3" )==0 ){ + return MLV_COLOR_LIGHTPINK3; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTPINK4" )==0 ){ + return MLV_COLOR_LIGHTPINK4; + } + if( strcmp( color_name, "MLV_COLOR_PALEVIOLETRED1" )==0 ){ + return MLV_COLOR_PALEVIOLETRED1; + } + if( strcmp( color_name, "MLV_COLOR_PALEVIOLETRED2" )==0 ){ + return MLV_COLOR_PALEVIOLETRED2; + } + if( strcmp( color_name, "MLV_COLOR_PALEVIOLETRED3" )==0 ){ + return MLV_COLOR_PALEVIOLETRED3; + } + if( strcmp( color_name, "MLV_COLOR_PALEVIOLETRED4" )==0 ){ + return MLV_COLOR_PALEVIOLETRED4; + } + if( strcmp( color_name, "MLV_COLOR_MAROON1" )==0 ){ + return MLV_COLOR_MAROON1; + } + if( strcmp( color_name, "MLV_COLOR_MAROON2" )==0 ){ + return MLV_COLOR_MAROON2; + } + if( strcmp( color_name, "MLV_COLOR_MAROON3" )==0 ){ + return MLV_COLOR_MAROON3; + } + if( strcmp( color_name, "MLV_COLOR_MAROON4" )==0 ){ + return MLV_COLOR_MAROON4; + } + if( strcmp( color_name, "MLV_COLOR_VIOLETRED1" )==0 ){ + return MLV_COLOR_VIOLETRED1; + } + if( strcmp( color_name, "MLV_COLOR_VIOLETRED2" )==0 ){ + return MLV_COLOR_VIOLETRED2; + } + if( strcmp( color_name, "MLV_COLOR_VIOLETRED3" )==0 ){ + return MLV_COLOR_VIOLETRED3; + } + if( strcmp( color_name, "MLV_COLOR_VIOLETRED4" )==0 ){ + return MLV_COLOR_VIOLETRED4; + } + if( strcmp( color_name, "MLV_COLOR_MAGENTA1" )==0 ){ + return MLV_COLOR_MAGENTA1; + } + if( strcmp( color_name, "MLV_COLOR_MAGENTA2" )==0 ){ + return MLV_COLOR_MAGENTA2; + } + if( strcmp( color_name, "MLV_COLOR_MAGENTA3" )==0 ){ + return MLV_COLOR_MAGENTA3; + } + if( strcmp( color_name, "MLV_COLOR_MAGENTA4" )==0 ){ + return MLV_COLOR_MAGENTA4; + } + if( strcmp( color_name, "MLV_COLOR_ORCHID1" )==0 ){ + return MLV_COLOR_ORCHID1; + } + if( strcmp( color_name, "MLV_COLOR_ORCHID2" )==0 ){ + return MLV_COLOR_ORCHID2; + } + if( strcmp( color_name, "MLV_COLOR_ORCHID3" )==0 ){ + return MLV_COLOR_ORCHID3; + } + if( strcmp( color_name, "MLV_COLOR_ORCHID4" )==0 ){ + return MLV_COLOR_ORCHID4; + } + if( strcmp( color_name, "MLV_COLOR_PLUM1" )==0 ){ + return MLV_COLOR_PLUM1; + } + if( strcmp( color_name, "MLV_COLOR_PLUM2" )==0 ){ + return MLV_COLOR_PLUM2; + } + if( strcmp( color_name, "MLV_COLOR_PLUM3" )==0 ){ + return MLV_COLOR_PLUM3; + } + if( strcmp( color_name, "MLV_COLOR_PLUM4" )==0 ){ + return MLV_COLOR_PLUM4; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMORCHID1" )==0 ){ + return MLV_COLOR_MEDIUMORCHID1; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMORCHID2" )==0 ){ + return MLV_COLOR_MEDIUMORCHID2; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMORCHID3" )==0 ){ + return MLV_COLOR_MEDIUMORCHID3; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMORCHID4" )==0 ){ + return MLV_COLOR_MEDIUMORCHID4; + } + if( strcmp( color_name, "MLV_COLOR_DARKORCHID1" )==0 ){ + return MLV_COLOR_DARKORCHID1; + } + if( strcmp( color_name, "MLV_COLOR_DARKORCHID2" )==0 ){ + return MLV_COLOR_DARKORCHID2; + } + if( strcmp( color_name, "MLV_COLOR_DARKORCHID3" )==0 ){ + return MLV_COLOR_DARKORCHID3; + } + if( strcmp( color_name, "MLV_COLOR_DARKORCHID4" )==0 ){ + return MLV_COLOR_DARKORCHID4; + } + if( strcmp( color_name, "MLV_COLOR_PURPLE1" )==0 ){ + return MLV_COLOR_PURPLE1; + } + if( strcmp( color_name, "MLV_COLOR_PURPLE2" )==0 ){ + return MLV_COLOR_PURPLE2; + } + if( strcmp( color_name, "MLV_COLOR_PURPLE3" )==0 ){ + return MLV_COLOR_PURPLE3; + } + if( strcmp( color_name, "MLV_COLOR_PURPLE4" )==0 ){ + return MLV_COLOR_PURPLE4; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMPURPLE1" )==0 ){ + return MLV_COLOR_MEDIUMPURPLE1; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMPURPLE2" )==0 ){ + return MLV_COLOR_MEDIUMPURPLE2; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMPURPLE3" )==0 ){ + return MLV_COLOR_MEDIUMPURPLE3; + } + if( strcmp( color_name, "MLV_COLOR_MEDIUMPURPLE4" )==0 ){ + return MLV_COLOR_MEDIUMPURPLE4; + } + if( strcmp( color_name, "MLV_COLOR_THISTLE1" )==0 ){ + return MLV_COLOR_THISTLE1; + } + if( strcmp( color_name, "MLV_COLOR_THISTLE2" )==0 ){ + return MLV_COLOR_THISTLE2; + } + if( strcmp( color_name, "MLV_COLOR_THISTLE3" )==0 ){ + return MLV_COLOR_THISTLE3; + } + if( strcmp( color_name, "MLV_COLOR_THISTLE4" )==0 ){ + return MLV_COLOR_THISTLE4; + } + if( strcmp( color_name, "MLV_COLOR_GRAY0" )==0 ){ + return MLV_COLOR_GRAY0; + } + if( strcmp( color_name, "MLV_COLOR_GREY0" )==0 ){ + return MLV_COLOR_GREY0; + } + if( strcmp( color_name, "MLV_COLOR_GRAY1" )==0 ){ + return MLV_COLOR_GRAY1; + } + if( strcmp( color_name, "MLV_COLOR_GREY1" )==0 ){ + return MLV_COLOR_GREY1; + } + if( strcmp( color_name, "MLV_COLOR_GRAY2" )==0 ){ + return MLV_COLOR_GRAY2; + } + if( strcmp( color_name, "MLV_COLOR_GREY2" )==0 ){ + return MLV_COLOR_GREY2; + } + if( strcmp( color_name, "MLV_COLOR_GRAY3" )==0 ){ + return MLV_COLOR_GRAY3; + } + if( strcmp( color_name, "MLV_COLOR_GREY3" )==0 ){ + return MLV_COLOR_GREY3; + } + if( strcmp( color_name, "MLV_COLOR_GRAY4" )==0 ){ + return MLV_COLOR_GRAY4; + } + if( strcmp( color_name, "MLV_COLOR_GREY4" )==0 ){ + return MLV_COLOR_GREY4; + } + if( strcmp( color_name, "MLV_COLOR_GRAY5" )==0 ){ + return MLV_COLOR_GRAY5; + } + if( strcmp( color_name, "MLV_COLOR_GREY5" )==0 ){ + return MLV_COLOR_GREY5; + } + if( strcmp( color_name, "MLV_COLOR_GRAY6" )==0 ){ + return MLV_COLOR_GRAY6; + } + if( strcmp( color_name, "MLV_COLOR_GREY6" )==0 ){ + return MLV_COLOR_GREY6; + } + if( strcmp( color_name, "MLV_COLOR_GRAY7" )==0 ){ + return MLV_COLOR_GRAY7; + } + if( strcmp( color_name, "MLV_COLOR_GREY7" )==0 ){ + return MLV_COLOR_GREY7; + } + if( strcmp( color_name, "MLV_COLOR_GRAY8" )==0 ){ + return MLV_COLOR_GRAY8; + } + if( strcmp( color_name, "MLV_COLOR_GREY8" )==0 ){ + return MLV_COLOR_GREY8; + } + if( strcmp( color_name, "MLV_COLOR_GRAY9" )==0 ){ + return MLV_COLOR_GRAY9; + } + if( strcmp( color_name, "MLV_COLOR_GREY9" )==0 ){ + return MLV_COLOR_GREY9; + } + if( strcmp( color_name, "MLV_COLOR_GRAY10" )==0 ){ + return MLV_COLOR_GRAY10; + } + if( strcmp( color_name, "MLV_COLOR_GREY10" )==0 ){ + return MLV_COLOR_GREY10; + } + if( strcmp( color_name, "MLV_COLOR_GRAY11" )==0 ){ + return MLV_COLOR_GRAY11; + } + if( strcmp( color_name, "MLV_COLOR_GREY11" )==0 ){ + return MLV_COLOR_GREY11; + } + if( strcmp( color_name, "MLV_COLOR_GRAY12" )==0 ){ + return MLV_COLOR_GRAY12; + } + if( strcmp( color_name, "MLV_COLOR_GREY12" )==0 ){ + return MLV_COLOR_GREY12; + } + if( strcmp( color_name, "MLV_COLOR_GRAY13" )==0 ){ + return MLV_COLOR_GRAY13; + } + if( strcmp( color_name, "MLV_COLOR_GREY13" )==0 ){ + return MLV_COLOR_GREY13; + } + if( strcmp( color_name, "MLV_COLOR_GRAY14" )==0 ){ + return MLV_COLOR_GRAY14; + } + if( strcmp( color_name, "MLV_COLOR_GREY14" )==0 ){ + return MLV_COLOR_GREY14; + } + if( strcmp( color_name, "MLV_COLOR_GRAY15" )==0 ){ + return MLV_COLOR_GRAY15; + } + if( strcmp( color_name, "MLV_COLOR_GREY15" )==0 ){ + return MLV_COLOR_GREY15; + } + if( strcmp( color_name, "MLV_COLOR_GRAY16" )==0 ){ + return MLV_COLOR_GRAY16; + } + if( strcmp( color_name, "MLV_COLOR_GREY16" )==0 ){ + return MLV_COLOR_GREY16; + } + if( strcmp( color_name, "MLV_COLOR_GRAY17" )==0 ){ + return MLV_COLOR_GRAY17; + } + if( strcmp( color_name, "MLV_COLOR_GREY17" )==0 ){ + return MLV_COLOR_GREY17; + } + if( strcmp( color_name, "MLV_COLOR_GRAY18" )==0 ){ + return MLV_COLOR_GRAY18; + } + if( strcmp( color_name, "MLV_COLOR_GREY18" )==0 ){ + return MLV_COLOR_GREY18; + } + if( strcmp( color_name, "MLV_COLOR_GRAY19" )==0 ){ + return MLV_COLOR_GRAY19; + } + if( strcmp( color_name, "MLV_COLOR_GREY19" )==0 ){ + return MLV_COLOR_GREY19; + } + if( strcmp( color_name, "MLV_COLOR_GRAY20" )==0 ){ + return MLV_COLOR_GRAY20; + } + if( strcmp( color_name, "MLV_COLOR_GREY20" )==0 ){ + return MLV_COLOR_GREY20; + } + if( strcmp( color_name, "MLV_COLOR_GRAY21" )==0 ){ + return MLV_COLOR_GRAY21; + } + if( strcmp( color_name, "MLV_COLOR_GREY21" )==0 ){ + return MLV_COLOR_GREY21; + } + if( strcmp( color_name, "MLV_COLOR_GRAY22" )==0 ){ + return MLV_COLOR_GRAY22; + } + if( strcmp( color_name, "MLV_COLOR_GREY22" )==0 ){ + return MLV_COLOR_GREY22; + } + if( strcmp( color_name, "MLV_COLOR_GRAY23" )==0 ){ + return MLV_COLOR_GRAY23; + } + if( strcmp( color_name, "MLV_COLOR_GREY23" )==0 ){ + return MLV_COLOR_GREY23; + } + if( strcmp( color_name, "MLV_COLOR_GRAY24" )==0 ){ + return MLV_COLOR_GRAY24; + } + if( strcmp( color_name, "MLV_COLOR_GREY24" )==0 ){ + return MLV_COLOR_GREY24; + } + if( strcmp( color_name, "MLV_COLOR_GRAY25" )==0 ){ + return MLV_COLOR_GRAY25; + } + if( strcmp( color_name, "MLV_COLOR_GREY25" )==0 ){ + return MLV_COLOR_GREY25; + } + if( strcmp( color_name, "MLV_COLOR_GRAY26" )==0 ){ + return MLV_COLOR_GRAY26; + } + if( strcmp( color_name, "MLV_COLOR_GREY26" )==0 ){ + return MLV_COLOR_GREY26; + } + if( strcmp( color_name, "MLV_COLOR_GRAY27" )==0 ){ + return MLV_COLOR_GRAY27; + } + if( strcmp( color_name, "MLV_COLOR_GREY27" )==0 ){ + return MLV_COLOR_GREY27; + } + if( strcmp( color_name, "MLV_COLOR_GRAY28" )==0 ){ + return MLV_COLOR_GRAY28; + } + if( strcmp( color_name, "MLV_COLOR_GREY28" )==0 ){ + return MLV_COLOR_GREY28; + } + if( strcmp( color_name, "MLV_COLOR_GRAY29" )==0 ){ + return MLV_COLOR_GRAY29; + } + if( strcmp( color_name, "MLV_COLOR_GREY29" )==0 ){ + return MLV_COLOR_GREY29; + } + if( strcmp( color_name, "MLV_COLOR_GRAY30" )==0 ){ + return MLV_COLOR_GRAY30; + } + if( strcmp( color_name, "MLV_COLOR_GREY30" )==0 ){ + return MLV_COLOR_GREY30; + } + if( strcmp( color_name, "MLV_COLOR_GRAY31" )==0 ){ + return MLV_COLOR_GRAY31; + } + if( strcmp( color_name, "MLV_COLOR_GREY31" )==0 ){ + return MLV_COLOR_GREY31; + } + if( strcmp( color_name, "MLV_COLOR_GRAY32" )==0 ){ + return MLV_COLOR_GRAY32; + } + if( strcmp( color_name, "MLV_COLOR_GREY32" )==0 ){ + return MLV_COLOR_GREY32; + } + if( strcmp( color_name, "MLV_COLOR_GRAY33" )==0 ){ + return MLV_COLOR_GRAY33; + } + if( strcmp( color_name, "MLV_COLOR_GREY33" )==0 ){ + return MLV_COLOR_GREY33; + } + if( strcmp( color_name, "MLV_COLOR_GRAY34" )==0 ){ + return MLV_COLOR_GRAY34; + } + if( strcmp( color_name, "MLV_COLOR_GREY34" )==0 ){ + return MLV_COLOR_GREY34; + } + if( strcmp( color_name, "MLV_COLOR_GRAY35" )==0 ){ + return MLV_COLOR_GRAY35; + } + if( strcmp( color_name, "MLV_COLOR_GREY35" )==0 ){ + return MLV_COLOR_GREY35; + } + if( strcmp( color_name, "MLV_COLOR_GRAY36" )==0 ){ + return MLV_COLOR_GRAY36; + } + if( strcmp( color_name, "MLV_COLOR_GREY36" )==0 ){ + return MLV_COLOR_GREY36; + } + if( strcmp( color_name, "MLV_COLOR_GRAY37" )==0 ){ + return MLV_COLOR_GRAY37; + } + if( strcmp( color_name, "MLV_COLOR_GREY37" )==0 ){ + return MLV_COLOR_GREY37; + } + if( strcmp( color_name, "MLV_COLOR_GRAY38" )==0 ){ + return MLV_COLOR_GRAY38; + } + if( strcmp( color_name, "MLV_COLOR_GREY38" )==0 ){ + return MLV_COLOR_GREY38; + } + if( strcmp( color_name, "MLV_COLOR_GRAY39" )==0 ){ + return MLV_COLOR_GRAY39; + } + if( strcmp( color_name, "MLV_COLOR_GREY39" )==0 ){ + return MLV_COLOR_GREY39; + } + if( strcmp( color_name, "MLV_COLOR_GRAY40" )==0 ){ + return MLV_COLOR_GRAY40; + } + if( strcmp( color_name, "MLV_COLOR_GREY40" )==0 ){ + return MLV_COLOR_GREY40; + } + if( strcmp( color_name, "MLV_COLOR_GRAY41" )==0 ){ + return MLV_COLOR_GRAY41; + } + if( strcmp( color_name, "MLV_COLOR_GREY41" )==0 ){ + return MLV_COLOR_GREY41; + } + if( strcmp( color_name, "MLV_COLOR_GRAY42" )==0 ){ + return MLV_COLOR_GRAY42; + } + if( strcmp( color_name, "MLV_COLOR_GREY42" )==0 ){ + return MLV_COLOR_GREY42; + } + if( strcmp( color_name, "MLV_COLOR_GRAY43" )==0 ){ + return MLV_COLOR_GRAY43; + } + if( strcmp( color_name, "MLV_COLOR_GREY43" )==0 ){ + return MLV_COLOR_GREY43; + } + if( strcmp( color_name, "MLV_COLOR_GRAY44" )==0 ){ + return MLV_COLOR_GRAY44; + } + if( strcmp( color_name, "MLV_COLOR_GREY44" )==0 ){ + return MLV_COLOR_GREY44; + } + if( strcmp( color_name, "MLV_COLOR_GRAY45" )==0 ){ + return MLV_COLOR_GRAY45; + } + if( strcmp( color_name, "MLV_COLOR_GREY45" )==0 ){ + return MLV_COLOR_GREY45; + } + if( strcmp( color_name, "MLV_COLOR_GRAY46" )==0 ){ + return MLV_COLOR_GRAY46; + } + if( strcmp( color_name, "MLV_COLOR_GREY46" )==0 ){ + return MLV_COLOR_GREY46; + } + if( strcmp( color_name, "MLV_COLOR_GRAY47" )==0 ){ + return MLV_COLOR_GRAY47; + } + if( strcmp( color_name, "MLV_COLOR_GREY47" )==0 ){ + return MLV_COLOR_GREY47; + } + if( strcmp( color_name, "MLV_COLOR_GRAY48" )==0 ){ + return MLV_COLOR_GRAY48; + } + if( strcmp( color_name, "MLV_COLOR_GREY48" )==0 ){ + return MLV_COLOR_GREY48; + } + if( strcmp( color_name, "MLV_COLOR_GRAY49" )==0 ){ + return MLV_COLOR_GRAY49; + } + if( strcmp( color_name, "MLV_COLOR_GREY49" )==0 ){ + return MLV_COLOR_GREY49; + } + if( strcmp( color_name, "MLV_COLOR_GRAY50" )==0 ){ + return MLV_COLOR_GRAY50; + } + if( strcmp( color_name, "MLV_COLOR_GREY50" )==0 ){ + return MLV_COLOR_GREY50; + } + if( strcmp( color_name, "MLV_COLOR_GRAY51" )==0 ){ + return MLV_COLOR_GRAY51; + } + if( strcmp( color_name, "MLV_COLOR_GREY51" )==0 ){ + return MLV_COLOR_GREY51; + } + if( strcmp( color_name, "MLV_COLOR_GRAY52" )==0 ){ + return MLV_COLOR_GRAY52; + } + if( strcmp( color_name, "MLV_COLOR_GREY52" )==0 ){ + return MLV_COLOR_GREY52; + } + if( strcmp( color_name, "MLV_COLOR_GRAY53" )==0 ){ + return MLV_COLOR_GRAY53; + } + if( strcmp( color_name, "MLV_COLOR_GREY53" )==0 ){ + return MLV_COLOR_GREY53; + } + if( strcmp( color_name, "MLV_COLOR_GRAY54" )==0 ){ + return MLV_COLOR_GRAY54; + } + if( strcmp( color_name, "MLV_COLOR_GREY54" )==0 ){ + return MLV_COLOR_GREY54; + } + if( strcmp( color_name, "MLV_COLOR_GRAY55" )==0 ){ + return MLV_COLOR_GRAY55; + } + if( strcmp( color_name, "MLV_COLOR_GREY55" )==0 ){ + return MLV_COLOR_GREY55; + } + if( strcmp( color_name, "MLV_COLOR_GRAY56" )==0 ){ + return MLV_COLOR_GRAY56; + } + if( strcmp( color_name, "MLV_COLOR_GREY56" )==0 ){ + return MLV_COLOR_GREY56; + } + if( strcmp( color_name, "MLV_COLOR_GRAY57" )==0 ){ + return MLV_COLOR_GRAY57; + } + if( strcmp( color_name, "MLV_COLOR_GREY57" )==0 ){ + return MLV_COLOR_GREY57; + } + if( strcmp( color_name, "MLV_COLOR_GRAY58" )==0 ){ + return MLV_COLOR_GRAY58; + } + if( strcmp( color_name, "MLV_COLOR_GREY58" )==0 ){ + return MLV_COLOR_GREY58; + } + if( strcmp( color_name, "MLV_COLOR_GRAY59" )==0 ){ + return MLV_COLOR_GRAY59; + } + if( strcmp( color_name, "MLV_COLOR_GREY59" )==0 ){ + return MLV_COLOR_GREY59; + } + if( strcmp( color_name, "MLV_COLOR_GRAY60" )==0 ){ + return MLV_COLOR_GRAY60; + } + if( strcmp( color_name, "MLV_COLOR_GREY60" )==0 ){ + return MLV_COLOR_GREY60; + } + if( strcmp( color_name, "MLV_COLOR_GRAY61" )==0 ){ + return MLV_COLOR_GRAY61; + } + if( strcmp( color_name, "MLV_COLOR_GREY61" )==0 ){ + return MLV_COLOR_GREY61; + } + if( strcmp( color_name, "MLV_COLOR_GRAY62" )==0 ){ + return MLV_COLOR_GRAY62; + } + if( strcmp( color_name, "MLV_COLOR_GREY62" )==0 ){ + return MLV_COLOR_GREY62; + } + if( strcmp( color_name, "MLV_COLOR_GRAY63" )==0 ){ + return MLV_COLOR_GRAY63; + } + if( strcmp( color_name, "MLV_COLOR_GREY63" )==0 ){ + return MLV_COLOR_GREY63; + } + if( strcmp( color_name, "MLV_COLOR_GRAY64" )==0 ){ + return MLV_COLOR_GRAY64; + } + if( strcmp( color_name, "MLV_COLOR_GREY64" )==0 ){ + return MLV_COLOR_GREY64; + } + if( strcmp( color_name, "MLV_COLOR_GRAY65" )==0 ){ + return MLV_COLOR_GRAY65; + } + if( strcmp( color_name, "MLV_COLOR_GREY65" )==0 ){ + return MLV_COLOR_GREY65; + } + if( strcmp( color_name, "MLV_COLOR_GRAY66" )==0 ){ + return MLV_COLOR_GRAY66; + } + if( strcmp( color_name, "MLV_COLOR_GREY66" )==0 ){ + return MLV_COLOR_GREY66; + } + if( strcmp( color_name, "MLV_COLOR_GRAY67" )==0 ){ + return MLV_COLOR_GRAY67; + } + if( strcmp( color_name, "MLV_COLOR_GREY67" )==0 ){ + return MLV_COLOR_GREY67; + } + if( strcmp( color_name, "MLV_COLOR_GRAY68" )==0 ){ + return MLV_COLOR_GRAY68; + } + if( strcmp( color_name, "MLV_COLOR_GREY68" )==0 ){ + return MLV_COLOR_GREY68; + } + if( strcmp( color_name, "MLV_COLOR_GRAY69" )==0 ){ + return MLV_COLOR_GRAY69; + } + if( strcmp( color_name, "MLV_COLOR_GREY69" )==0 ){ + return MLV_COLOR_GREY69; + } + if( strcmp( color_name, "MLV_COLOR_GRAY70" )==0 ){ + return MLV_COLOR_GRAY70; + } + if( strcmp( color_name, "MLV_COLOR_GREY70" )==0 ){ + return MLV_COLOR_GREY70; + } + if( strcmp( color_name, "MLV_COLOR_GRAY71" )==0 ){ + return MLV_COLOR_GRAY71; + } + if( strcmp( color_name, "MLV_COLOR_GREY71" )==0 ){ + return MLV_COLOR_GREY71; + } + if( strcmp( color_name, "MLV_COLOR_GRAY72" )==0 ){ + return MLV_COLOR_GRAY72; + } + if( strcmp( color_name, "MLV_COLOR_GREY72" )==0 ){ + return MLV_COLOR_GREY72; + } + if( strcmp( color_name, "MLV_COLOR_GRAY73" )==0 ){ + return MLV_COLOR_GRAY73; + } + if( strcmp( color_name, "MLV_COLOR_GREY73" )==0 ){ + return MLV_COLOR_GREY73; + } + if( strcmp( color_name, "MLV_COLOR_GRAY74" )==0 ){ + return MLV_COLOR_GRAY74; + } + if( strcmp( color_name, "MLV_COLOR_GREY74" )==0 ){ + return MLV_COLOR_GREY74; + } + if( strcmp( color_name, "MLV_COLOR_GRAY75" )==0 ){ + return MLV_COLOR_GRAY75; + } + if( strcmp( color_name, "MLV_COLOR_GREY75" )==0 ){ + return MLV_COLOR_GREY75; + } + if( strcmp( color_name, "MLV_COLOR_GRAY76" )==0 ){ + return MLV_COLOR_GRAY76; + } + if( strcmp( color_name, "MLV_COLOR_GREY76" )==0 ){ + return MLV_COLOR_GREY76; + } + if( strcmp( color_name, "MLV_COLOR_GRAY77" )==0 ){ + return MLV_COLOR_GRAY77; + } + if( strcmp( color_name, "MLV_COLOR_GREY77" )==0 ){ + return MLV_COLOR_GREY77; + } + if( strcmp( color_name, "MLV_COLOR_GRAY78" )==0 ){ + return MLV_COLOR_GRAY78; + } + if( strcmp( color_name, "MLV_COLOR_GREY78" )==0 ){ + return MLV_COLOR_GREY78; + } + if( strcmp( color_name, "MLV_COLOR_GRAY79" )==0 ){ + return MLV_COLOR_GRAY79; + } + if( strcmp( color_name, "MLV_COLOR_GREY79" )==0 ){ + return MLV_COLOR_GREY79; + } + if( strcmp( color_name, "MLV_COLOR_GRAY80" )==0 ){ + return MLV_COLOR_GRAY80; + } + if( strcmp( color_name, "MLV_COLOR_GREY80" )==0 ){ + return MLV_COLOR_GREY80; + } + if( strcmp( color_name, "MLV_COLOR_GRAY81" )==0 ){ + return MLV_COLOR_GRAY81; + } + if( strcmp( color_name, "MLV_COLOR_GREY81" )==0 ){ + return MLV_COLOR_GREY81; + } + if( strcmp( color_name, "MLV_COLOR_GRAY82" )==0 ){ + return MLV_COLOR_GRAY82; + } + if( strcmp( color_name, "MLV_COLOR_GREY82" )==0 ){ + return MLV_COLOR_GREY82; + } + if( strcmp( color_name, "MLV_COLOR_GRAY83" )==0 ){ + return MLV_COLOR_GRAY83; + } + if( strcmp( color_name, "MLV_COLOR_GREY83" )==0 ){ + return MLV_COLOR_GREY83; + } + if( strcmp( color_name, "MLV_COLOR_GRAY84" )==0 ){ + return MLV_COLOR_GRAY84; + } + if( strcmp( color_name, "MLV_COLOR_GREY84" )==0 ){ + return MLV_COLOR_GREY84; + } + if( strcmp( color_name, "MLV_COLOR_GRAY85" )==0 ){ + return MLV_COLOR_GRAY85; + } + if( strcmp( color_name, "MLV_COLOR_GREY85" )==0 ){ + return MLV_COLOR_GREY85; + } + if( strcmp( color_name, "MLV_COLOR_GRAY86" )==0 ){ + return MLV_COLOR_GRAY86; + } + if( strcmp( color_name, "MLV_COLOR_GREY86" )==0 ){ + return MLV_COLOR_GREY86; + } + if( strcmp( color_name, "MLV_COLOR_GRAY87" )==0 ){ + return MLV_COLOR_GRAY87; + } + if( strcmp( color_name, "MLV_COLOR_GREY87" )==0 ){ + return MLV_COLOR_GREY87; + } + if( strcmp( color_name, "MLV_COLOR_GRAY88" )==0 ){ + return MLV_COLOR_GRAY88; + } + if( strcmp( color_name, "MLV_COLOR_GREY88" )==0 ){ + return MLV_COLOR_GREY88; + } + if( strcmp( color_name, "MLV_COLOR_GRAY89" )==0 ){ + return MLV_COLOR_GRAY89; + } + if( strcmp( color_name, "MLV_COLOR_GREY89" )==0 ){ + return MLV_COLOR_GREY89; + } + if( strcmp( color_name, "MLV_COLOR_GRAY90" )==0 ){ + return MLV_COLOR_GRAY90; + } + if( strcmp( color_name, "MLV_COLOR_GREY90" )==0 ){ + return MLV_COLOR_GREY90; + } + if( strcmp( color_name, "MLV_COLOR_GRAY91" )==0 ){ + return MLV_COLOR_GRAY91; + } + if( strcmp( color_name, "MLV_COLOR_GREY91" )==0 ){ + return MLV_COLOR_GREY91; + } + if( strcmp( color_name, "MLV_COLOR_GRAY92" )==0 ){ + return MLV_COLOR_GRAY92; + } + if( strcmp( color_name, "MLV_COLOR_GREY92" )==0 ){ + return MLV_COLOR_GREY92; + } + if( strcmp( color_name, "MLV_COLOR_GRAY93" )==0 ){ + return MLV_COLOR_GRAY93; + } + if( strcmp( color_name, "MLV_COLOR_GREY93" )==0 ){ + return MLV_COLOR_GREY93; + } + if( strcmp( color_name, "MLV_COLOR_GRAY94" )==0 ){ + return MLV_COLOR_GRAY94; + } + if( strcmp( color_name, "MLV_COLOR_GREY94" )==0 ){ + return MLV_COLOR_GREY94; + } + if( strcmp( color_name, "MLV_COLOR_GRAY95" )==0 ){ + return MLV_COLOR_GRAY95; + } + if( strcmp( color_name, "MLV_COLOR_GREY95" )==0 ){ + return MLV_COLOR_GREY95; + } + if( strcmp( color_name, "MLV_COLOR_GRAY96" )==0 ){ + return MLV_COLOR_GRAY96; + } + if( strcmp( color_name, "MLV_COLOR_GREY96" )==0 ){ + return MLV_COLOR_GREY96; + } + if( strcmp( color_name, "MLV_COLOR_GRAY97" )==0 ){ + return MLV_COLOR_GRAY97; + } + if( strcmp( color_name, "MLV_COLOR_GREY97" )==0 ){ + return MLV_COLOR_GREY97; + } + if( strcmp( color_name, "MLV_COLOR_GRAY98" )==0 ){ + return MLV_COLOR_GRAY98; + } + if( strcmp( color_name, "MLV_COLOR_GREY98" )==0 ){ + return MLV_COLOR_GREY98; + } + if( strcmp( color_name, "MLV_COLOR_GRAY99" )==0 ){ + return MLV_COLOR_GRAY99; + } + if( strcmp( color_name, "MLV_COLOR_GREY99" )==0 ){ + return MLV_COLOR_GREY99; + } + if( strcmp( color_name, "MLV_COLOR_GRAY100" )==0 ){ + return MLV_COLOR_GRAY100; + } + if( strcmp( color_name, "MLV_COLOR_GREY100" )==0 ){ + return MLV_COLOR_GREY100; + } + if( strcmp( color_name, "MLV_COLOR_DARK_GREY" )==0 ){ + return MLV_COLOR_DARK_GREY; + } + if( strcmp( color_name, "MLV_COLOR_DARKGREY" )==0 ){ + return MLV_COLOR_DARKGREY; + } + if( strcmp( color_name, "MLV_COLOR_DARK_GRAY" )==0 ){ + return MLV_COLOR_DARK_GRAY; + } + if( strcmp( color_name, "MLV_COLOR_DARKGRAY" )==0 ){ + return MLV_COLOR_DARKGRAY; + } + if( strcmp( color_name, "MLV_COLOR_DARK_BLUE" )==0 ){ + return MLV_COLOR_DARK_BLUE; + } + if( strcmp( color_name, "MLV_COLOR_DARKBLUE" )==0 ){ + return MLV_COLOR_DARKBLUE; + } + if( strcmp( color_name, "MLV_COLOR_DARK_CYAN" )==0 ){ + return MLV_COLOR_DARK_CYAN; + } + if( strcmp( color_name, "MLV_COLOR_DARKCYAN" )==0 ){ + return MLV_COLOR_DARKCYAN; + } + if( strcmp( color_name, "MLV_COLOR_DARK_MAGENTA" )==0 ){ + return MLV_COLOR_DARK_MAGENTA; + } + if( strcmp( color_name, "MLV_COLOR_DARKMAGENTA" )==0 ){ + return MLV_COLOR_DARKMAGENTA; + } + if( strcmp( color_name, "MLV_COLOR_DARK_RED" )==0 ){ + return MLV_COLOR_DARK_RED; + } + if( strcmp( color_name, "MLV_COLOR_DARKRED" )==0 ){ + return MLV_COLOR_DARKRED; + } + if( strcmp( color_name, "MLV_COLOR_LIGHT_GREEN" )==0 ){ + return MLV_COLOR_LIGHT_GREEN; + } + if( strcmp( color_name, "MLV_COLOR_LIGHTGREEN" )==0 ){ + return MLV_COLOR_LIGHTGREEN; + } + ERROR("Unexpected color name."); + return -1; +} + diff --git a/MLV/config.h.in b/MLV/config.h.in new file mode 100644 index 0000000..7c66bc7 --- /dev/null +++ b/MLV/config.h.in @@ -0,0 +1,77 @@ +/* MLV/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define the revision in the source repository */ +#undef MLV_RCS_REVISION + +/* Define the revision control software */ +#undef MLV_REPOSITORY + +/* Define the address of the MLV repository */ +#undef MLV_SOURCE_REPOSITORY + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const diff --git a/MLV/data_structure.h b/MLV/data_structure.h new file mode 100644 index 0000000..3048c8b --- /dev/null +++ b/MLV/data_structure.h @@ -0,0 +1,72 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#ifndef __MLV__DATA_STRUCTURE_H_ +#define __MLV__DATA_STRUCTURE_H_ + +#include "platform.h" + +#ifndef MEMORY_DEBUG +#if defined( OS_WINDOWS ) +# include +# include +#elif defined( OS_APPLE ) +# include +# include +#else +# include +# include +#endif + + + +#else +#include "memory_management.h" +#endif + +#include + +#include "MLV_playlist.h" +#include "MLV_text.h" + +#include "list.h" + +typedef struct _DataMLV { + SDL_Surface *screen; + Uint32 width; + Uint32 height; + int full_screen_is_enable; + SDL_Rect rectangle; + SDL_Surface *save_screen; + SDL_sem* audio_semaphore; + SDL_AudioSpec audio_device_spec; + MLV_List* playing_streaming; + MLV_List* playlists; + MLV_List* active_playlists; + MLV_Font* defaultFont; + FPSmanager frame_rate_manager; + FPSmanager frame_rate_manager_for_MLV_wait_event; +} DataMLV; + +struct _MLV_Image { + SDL_Surface * surface; +}; + +#endif diff --git a/MLV/event.c b/MLV/event.c new file mode 100644 index 0000000..0b35ac7 --- /dev/null +++ b/MLV/event.c @@ -0,0 +1,425 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "MLV_event.h" +#include "MLV_mouse.h" + +#include "platform.h" + +#ifndef MEMORY_DEBUG +#if defined( OS_WINDOWS ) +# include +# include +#elif defined( OS_APPLE ) +# include +# include +#else +# include +# include +#endif +#else +#include "memory_debug.h" +#endif + +#include + +#include "warning_error.h" + +#include "memory_management.h" + +#include "MLV_time.h" + +#include "data_structure.h" + +extern DataMLV* MLV_data; + + +MLV_Event MLV_get_event( + MLV_Keyboard_button* key_sym, MLV_Keyboard_modifier* key_mod, int* unicode, + char** texte, MLV_Input_box** input_box, + int* mouse_x, int* mouse_y, MLV_Mouse_button* mouse_button, + MLV_Button_state* state +){ + SDL_Event event; + int invalidEvent = 1; + while( invalidEvent ){ + if( SDL_PollEvent( &event ) ){ + switch( event.type ){ + case SDL_KEYDOWN: { + if( key_sym || key_mod || state ){ + if( key_sym ){ + (*key_sym) = (MLV_Keyboard_button) + event.key.keysym.sym; + } + if( key_mod ){ + (*key_mod) = (MLV_Keyboard_modifier) + event.key.keysym.mod; + } + if( unicode ){ + (*unicode) = event.key.keysym.unicode; + } + if( state ){ + (*state) = MLV_PRESSED; + } + return MLV_KEY; + } + }; + break; + case SDL_KEYUP:{ + if( key_sym || key_mod || state ){ + if( key_sym ){ + (*key_sym) = (MLV_Keyboard_button) + event.key.keysym.sym; + } + if( key_mod ){ + (*key_mod) = (MLV_Keyboard_modifier) + event.key.keysym.mod; + } + if( unicode ){ + (*unicode) = event.key.keysym.unicode; + } + if( state ){ + (*state) = MLV_RELEASED; + } + return MLV_KEY; + } + }; + break; + case SDL_MOUSEMOTION:{ + if( mouse_x || mouse_y ){ + if( mouse_x ){ + (*mouse_x) = event.motion.x; + } + if( mouse_y ){ + (*mouse_y) = event.motion.y; + } + return MLV_MOUSE_MOTION; + } + } + break; + case SDL_MOUSEBUTTONUP: { + if( mouse_x || mouse_y || mouse_button || state ){ + if( mouse_x ){ + (*mouse_x) = event.button.x; + } + if( mouse_y ){ + (*mouse_y) = event.button.y; + } + if( mouse_button ){ + (*mouse_button) = (MLV_Mouse_button) + event.button.button; + } + if( state ){ + (*state) = MLV_RELEASED; + } + return MLV_MOUSE_BUTTON; + } + } + break; + case SDL_MOUSEBUTTONDOWN: { + if( mouse_x || mouse_y || mouse_button || state ){ + if( mouse_x ){ + (*mouse_x) = event.button.x; + } + if( mouse_y ){ + (*mouse_y) = event.button.y; + } + if( mouse_button ){ + (*mouse_button) = (MLV_Mouse_button) + event.button.button; + } + if( state ){ + (*state) = MLV_PRESSED; + } + return MLV_MOUSE_BUTTON; + } + } + break; + case SDL_QUIT:{ + } + break; + case SDL_USEREVENT: { + if( event.user.code == MLV_INPUT_BOX ){ + if( texte || input_box ){ + if( input_box ){ + (*input_box) = event.user.data1; + } + if( texte ){ + int size = strlen(event.user.data2)+1; + (*texte) = MLV_MALLOC( size, char ); + memcpy( + (*texte), + event.user.data2, + size + ); + } + return MLV_INPUT_BOX; + } + } + } + break; + + default:; + } + }else{ + invalidEvent = 0; + } + } + return MLV_NONE; +} + +MLV_Event MLV_wait_event( + MLV_Keyboard_button* key_sym, MLV_Keyboard_modifier* key_mod, int* unicode, + char** texte, MLV_Input_box** input_box, + int* mouse_x, int* mouse_y, MLV_Mouse_button* mouse_button, + MLV_Button_state* state +){ + MLV_Event resultat; + while( + ( + resultat = MLV_get_event( + key_sym, key_mod, unicode, + texte, input_box, + mouse_x, mouse_y, mouse_button, + state + ) + ) == MLV_NONE + ) SDL_framerateDelay( &(MLV_data->frame_rate_manager_for_MLV_wait_event) ); + return resultat; +} + +MLV_Event MLV_wait_event_or_seconds( + MLV_Keyboard_button* key_sym, MLV_Keyboard_modifier* key_mod, int* unicode, + char** texte, MLV_Input_box** input_box, + int* mouse_x, int* mouse_y, MLV_Mouse_button* mouse_button, + MLV_Button_state* state, int seconds +){ + MLV_Event resultat; + int time = MLV_get_time(); + while( + ( + ( + resultat = MLV_get_event( + key_sym, key_mod, unicode, + texte, input_box, + mouse_x, mouse_y, mouse_button, + state + ) + ) == MLV_NONE + ) && ( + MLV_get_time() - time < seconds*1000 + ) + ) SDL_framerateDelay( &(MLV_data->frame_rate_manager_for_MLV_wait_event) ); + return resultat; +} + + +void MLV_flush_event_queue(){ + MLV_get_event( + NULL, NULL, NULL, + NULL, NULL, + NULL, NULL, NULL, + NULL + ); +} + +MLV_Event MLV_wait_keyboard_or_mouse( + MLV_Keyboard_button* sym, MLV_Keyboard_modifier* mod, int* unicode, + int* mouse_x, int* mouse_y +){ + MLV_Event resultat; + MLV_Button_state state; + MLV_Mouse_button mouse_button; + + // We remove all existing event from the queue + MLV_flush_event_queue(); + + MLV_Keyboard_button tmp_sym; + MLV_Keyboard_modifier tmp_mod; + int tmp_unicode; + int tmp_mouse_x; + int tmp_mouse_y; + + //We wait for a new keyboard or mouse event + while( + ( + ( + ( + resultat = MLV_wait_event( + &tmp_sym, &tmp_mod, &tmp_unicode, + NULL, NULL, + &tmp_mouse_x, &tmp_mouse_y, &mouse_button, + &state + ) + ) != MLV_KEY + ) && ( + ( resultat != MLV_MOUSE_BUTTON ) || + ( mouse_button != MLV_BUTTON_LEFT ) + ) + ) || ( + state != MLV_PRESSED + ) + ); + + switch( resultat ){ + case MLV_KEY: + if( sym ) *sym = tmp_sym; + if( mod ) *mod = tmp_mod; + if( unicode ) *unicode = tmp_unicode; + break; + case MLV_MOUSE_BUTTON: + if( mouse_x ) *mouse_x = tmp_mouse_x; + if( mouse_y ) *mouse_y = tmp_mouse_y; + break; + default: + ERROR("Valeur d'evenements innatendu."); + } + + return resultat; +} + + +MLV_Event MLV_wait_keyboard_or_mouse_or_seconds( + MLV_Keyboard_button* sym, MLV_Keyboard_modifier* mod, int* unicode, + int* mouse_x, int* mouse_y, + int seconds +){ + MLV_Event resultat; + MLV_Button_state state; + MLV_Mouse_button mouse_button; + + // We remove all existing event from the queue + MLV_flush_event_queue(); + + int time = MLV_get_time(); + + MLV_Keyboard_button tmp_sym; + MLV_Keyboard_modifier tmp_mod; + int tmp_unicode; + int tmp_mouse_x; + int tmp_mouse_y; + + int event_is_not_valid = 0; + //We wait for a new keyboard or mouse event + while( + ( + event_is_not_valid = ( + ( + ( + resultat = MLV_wait_event_or_seconds( + &tmp_sym, &tmp_mod, &tmp_unicode, + NULL, NULL, + &tmp_mouse_x, &tmp_mouse_y, &mouse_button, + &state, + seconds - (MLV_get_time() - time)/1000 + ) + ) != MLV_KEY + ) && ( + ( resultat != MLV_MOUSE_BUTTON ) || + ( mouse_button != MLV_BUTTON_LEFT ) + ) + ) || ( + state != MLV_PRESSED + ) + ) && ( + (MLV_get_time() - time) < seconds*1000 + ) + ); + if(event_is_not_valid) return MLV_NONE; + + switch( resultat ){ + case MLV_KEY: + if( sym ) *sym = tmp_sym; + if( mod ) *mod = tmp_mod; + if( unicode ) *unicode = tmp_unicode; + break; + case MLV_MOUSE_BUTTON: + if( mouse_x ) *mouse_x = tmp_mouse_x; + if( mouse_y ) *mouse_y = tmp_mouse_y; + break; + default: + ERROR("Valeur d'evenements innatendu."); + } + + return resultat; +} + +const char* MLV_convert_event_to_string( MLV_Event event_code ){ + switch( event_code ){ + case MLV_NONE: + return "MLV_NONE"; + case MLV_KEY: + return "MLV_KEY"; + case MLV_INPUT_BOX: + return "MLV_INPUT_BOX"; + case MLV_MOUSE_BUTTON: + return "MLV_MOUSE_BUTTON"; + case MLV_MOUSE_MOTION: + return "MLV_MOUSE_MOTION"; + default: + ERROR( "Event code unexpected." ); + } + return NULL; +} + +MLV_Event MLV_convert_string_to_event( const char* event_string ){ + if( strcmp( event_string, "MLV_NONE" )==0 ){ + return MLV_NONE; + } + if( strcmp( event_string, "MLV_KEY" )==0 ){ + return MLV_KEY; + } + if( strcmp( event_string, "MLV_INPUT_BOX" )==0 ){ + return MLV_INPUT_BOX; + } + if( strcmp( event_string, "MLV_MOUSE_BUTTON" )==0 ){ + return MLV_MOUSE_BUTTON; + } + if( strcmp( event_string, "MLV_MOUSE_MOTION" )==0 ){ + return MLV_MOUSE_MOTION; + } + ERROR( "Event name unknown." ); + return -1; +} + +const char* MLV_convert_button_state_to_string( MLV_Button_state state_code ){ + switch( state_code ){ + case MLV_PRESSED : + return "MLV_PRESSED"; + case MLV_RELEASED : + return "MLV_RELEASED"; + default: + ERROR( "Unexpected state code." ); + } + return NULL; +} + +MLV_Button_state MLV_convert_string_to_button_state( const char* state_string ){ + if( strcmp( state_string, "MLV_PRESSED" ) ){ + return MLV_PRESSED; + } + if( strcmp( state_string, "MLV_RELEASED" ) ){ + return MLV_RELEASED; + } + ERROR( "Unexpected state name." ); + return -1; +} + + diff --git a/MLV/image.c b/MLV/image.c new file mode 100644 index 0000000..b598837 --- /dev/null +++ b/MLV/image.c @@ -0,0 +1,521 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "MLV_image.h" +#include "data_structure.h" + +#include "platform.h" + +#ifndef MEMORY_DEBUG +#if defined( OS_WINDOWS ) +# include +# include +# include +#elif defined( OS_APPLE ) +# include +# include +# include +#else +# include +# include +# include +#endif +#else +#include "memory_debug.h" +#endif + +#include "warning_error.h" + +#include "memory_management.h" + +#include "data_structure.h" +#include "image.h" + +extern DataMLV* MLV_data; + +SDL_Surface* create_surface( int width, int height ){ + Uint32 rmask, gmask, bmask, amask; + #if SDL_BYTEORDER == SDL_BIG_ENDIAN + rmask = 0xff000000; + gmask = 0x00ff0000; + bmask = 0x0000ff00; + amask = 0x000000ff; + #else + rmask = 0x000000ff; + gmask = 0x0000ff00; + bmask = 0x00ff0000; + amask = 0xff000000; + #endif + #if defined( OS_ANDROID ) + return SDL_CreateRGBSurface( + SDL_SWSURFACE|SDL_SRCALPHA, + width, height, + MLV_BPP, rmask, gmask, bmask, amask + ); + #else + return SDL_CreateRGBSurface( + SDL_HWSURFACE|SDL_SRCALPHA, + width, height, + MLV_BPP, rmask, gmask, bmask, amask + ); + #endif +} + + +MLV_Image* MLV_load_image( const char* file_image ){ + if( MLV_data==NULL ){ + ERROR("Before using MLV_load_image, you have to initialise the MLV library by calling MLV_create_windows."); + } + + SDL_Surface* surface = IMG_Load( file_image ); + if( surface==NULL ){ + return NULL; + } + + MLV_Image* image = MLV_MALLOC( 1, MLV_Image ); + image->surface = SDL_DisplayFormatAlpha( + surface + ); + + SDL_FreeSurface( surface ); + return image; +} + +int MLV_save_image_as_bmp( const MLV_Image* image, const char* file_image ){ + return SDL_SaveBMP( image->surface, file_image ); +} + + +void MLV_resize_image( MLV_Image* image, int width, int height ){ + double scalar_x = ((double) width) / ((double) image->surface->w); + double scalar_y = ((double) height) / ((double) image->surface->h); + MLV_scale_xy_image( image, scalar_x, scalar_y ); +} + +void MLV_vertical_image_mirror( MLV_Image* image ){ + int width, height; + MLV_get_image_size( image, &width, &height ); + Uint32 *pixel_src, *pixel_dst, tmp; + int i=0; int j=0; + for( i=0; i< width/2; i++ ){ + for( j=0; jsurface->pixels) + + j*image->surface->pitch/4 + i; + pixel_dst = ((Uint32*) image->surface->pixels) + + j*image->surface->pitch/4 + width-1-i; + tmp = *pixel_dst; + *pixel_dst = *pixel_src; + *pixel_src = tmp; + } + } +} + +void MLV_horizontal_image_mirror( MLV_Image* image ){ + int width, height; + MLV_get_image_size( image, &width, &height ); + Uint32 *pixel_src, *pixel_dst, tmp; + int i=0; int j=0; + for( i=0; i< width; i++ ){ + for( j=0; jsurface->pixels) + + j*image->surface->pitch/4 + i; + pixel_dst = ((Uint32*) image->surface->pixels) + + (height-1-j)*image->surface->pitch/4 + i; + tmp = *pixel_dst; + *pixel_dst = *pixel_src; + *pixel_src = tmp; + } + } +} + +void MLV_resize_image_with_proportions( MLV_Image* image, int width, int height ){ + double scalar_x = -1.0; + double scalar_y = -1.0; + if( width<=0 && height<=0 ) return; + if( width > 0){ + scalar_x = ((double) width) / ((double) image->surface->w); + } + if( height > 0){ + scalar_y = ((double) height) / ((double) image->surface->h); + } + if( scalar_x < 0 ){ + scalar_x = scalar_y; + } + if( scalar_y < 0 ){ + scalar_y = scalar_x; + } + MLV_scale_image( image, ( scalar_x < scalar_y )? scalar_x : scalar_y ); +} + +void MLV_get_image_size( const MLV_Image* image, int* width, int* height ){ + if( width ){ + *width = image->surface->w; + } + if( height ){ + *height = image->surface->h; + } +} + +int MLV_get_image_width( const MLV_Image* image ){ + return image->surface->w; +} + +int MLV_get_image_height( const MLV_Image* image ){ + return image->surface->h; +} + +void MLV_scale_xy_image( MLV_Image* image, double scalar_x, double scalar_y ){ + MLV_rotate_and_scale_xy_image( image, 0.0, scalar_x, scalar_y ); +} + +void MLV_rotate_and_scale_xy_image( + MLV_Image* image, double rotation, double scalar_x, double scalar_y +){ + SDL_Surface* dst; + dst = rotozoomSurfaceXY( image->surface, rotation, scalar_x, scalar_y, 0); + SDL_FreeSurface( image->surface ); + image->surface = dst; +} + +void MLV_scale_image( MLV_Image* image, double scalar ){ + MLV_rotate_and_scale_image( image, 0.0, scalar ); +} + +void MLV_rotate_image( MLV_Image* image, double rotation ){ + MLV_rotate_and_scale_image( image, rotation, 1.0 ); +} + +void MLV_rotate_and_scale_image( MLV_Image* image, double rotation, double scalar ){ + SDL_Surface* dst; + dst = rotozoomSurface( image->surface, rotation, scalar, 0); + SDL_FreeSurface( image->surface ); + image->surface = dst; +} + +MLV_Image* MLV_create_image( int width, int height ){ + MLV_Image* result = MLV_MALLOC( 1, MLV_Image ); + + result->surface = create_surface( width, height ); + + int i,j; + for( i=0; isurface ); + MLV_FREE( image, MLV_Image ); + } +} + +MLV_Image* MLV_copy_image( const MLV_Image* image ){ + MLV_Image* result = MLV_MALLOC( 1, MLV_Image ); + result->surface = SDL_ConvertSurface( + image->surface, image->surface->format, image->surface->flags + ); + return result; +} + +MLV_Image* MLV_copy_partial_image( const MLV_Image* image, int x, int y, int width, int height ){ + MLV_Image* result = MLV_MALLOC( 1, MLV_Image ); + + SDL_Surface* tmp = create_surface( width, height ); + + result->surface = SDL_DisplayFormatAlpha( tmp ); + SDL_FreeSurface( tmp ); + + SDL_LockSurface( image->surface ); + SDL_LockSurface( result->surface ); + + Uint32 *pixel_src, *pixel_dst; + int i=0; int j=0; + for( i=0; i< width; i++ ){ + for( j=0; jsurface->pixels) + + (y+j)*image->surface->pitch/4 + x+i; + pixel_dst = ((Uint32*) result->surface->pixels) + + j*result->surface->pitch/4 + i; + *pixel_dst = * pixel_src; + } + } + + SDL_UnlockSurface( result->surface ); + SDL_UnlockSurface( image->surface ); + + return result; +} + + +void MLV_draw_image( const MLV_Image* image, int x, int y ){ + SDL_Rect rectangle; + rectangle.x = x; + rectangle.y = y; + rectangle.h = image->surface->h; + rectangle.w = image->surface->w; + SDL_BlitSurface( image->surface, NULL, MLV_data->screen, &rectangle); +} + +void MLV_draw_partial_image( + const MLV_Image* image, int x_source, int y_source, + int width_source, int height_source, + int x, int y +){ + SDL_Rect rectangle_source; + rectangle_source.x = x_source; + rectangle_source.y = y_source; + rectangle_source.h = height_source; + rectangle_source.w = width_source; + + SDL_Rect rectangle_dest; + rectangle_dest.x = x; + rectangle_dest.y = y; + rectangle_dest.h = height_source; + rectangle_dest.w = width_source; + + SDL_BlitSurface( image->surface, &rectangle_source, MLV_data->screen, &rectangle_dest); +} + + +void MLV_draw_scaled_rotated_image( MLV_Image* image, int centre_x, int centre_y, double rotation, double scalar ){ + SDL_Surface* dst; + dst = rotozoomSurface( image->surface, rotation, scalar, 0); + SDL_Rect rectangle_dest; + rectangle_dest.x = centre_x; + rectangle_dest.y = centre_y; + rectangle_dest.h = dst->h; + rectangle_dest.w = dst->w; + SDL_BlitSurface( dst, NULL, MLV_data->screen, &rectangle_dest); + SDL_FreeSurface( dst ); +} + +void MLV_draw_rotated_image( MLV_Image* image, int centre_x, int centre_y, double roation ){ + MLV_draw_scaled_rotated_image( image, centre_x, centre_y, roation, 1.0 ); +} + +void MLV_draw_scaled_image( MLV_Image* image, int centre_x, int centre_y, double scalar ){ + MLV_draw_scaled_rotated_image( image, centre_x, centre_y, 0.0, scalar ); +} + +void MLV_set_alpha_on_image( MLV_Alpha alpha, MLV_Image *image ){ + SDL_Surface* surface = image->surface; + SDL_LockSurface(surface); + + SDL_PixelFormat *fmt; + Uint32 *pixel; + Uint32 alpha32; + + fmt = surface->format; + int x,y; + int width, height; + MLV_get_image_size( image, &width, &height ); + for( x=0; xpixels)+ y*surface->pitch/4 + x; + + /* set the Alpha component */ + alpha32 = alpha; + alpha32 = alpha32 >> fmt->Aloss; + alpha32 = alpha32 << fmt->Ashift; + + *pixel = ( + *pixel & ( fmt->Rmask | fmt->Gmask | fmt->Bmask ) + ) | alpha32; + } + } + + SDL_UnlockSurface(surface); +} + +void MLV_set_pixel_on_image( + int x, int y, + MLV_Color color, + MLV_Image *image +){ + SDL_Surface* surface = image->surface; + SDL_LockSurface(surface); + + SDL_PixelFormat *fmt; + Uint32 *pixel; + + fmt = surface->format; + pixel = ((Uint32*) surface->pixels)+ y*surface->pitch/4 + x; + + Uint8 red, blue, green, alpha; + MLV_convert_color_to_rgba( color, &red, &green, &blue, &alpha ); + + Uint32 red32 = red, blue32 = blue, green32 = green, alpha32 = alpha; + + /* set the Red component */ + red32 = red32 >> fmt->Rloss; + red32 = red32 << fmt->Rshift; + + /* set the Green component */ + green32 = green32 >> fmt->Gloss; + green32 = green32 << fmt->Gshift; + + /* set the Blue component */ + blue32 = blue32 >> fmt->Bloss; + blue32 = blue32 << fmt->Bshift; + + /* set the Alpha component */ + alpha32 = alpha32 >> fmt->Aloss; + alpha32 = alpha32 << fmt->Ashift; + + *pixel = red32 | green32 | blue32 | alpha32; + + SDL_UnlockSurface(surface); +} + + +SDL_Surface* MLV_get_image_data( MLV_Image* image ){ + return image->surface; +} + + +void get_pixel_on_image_unsafe( + SDL_Surface* surface, + int x, int y, + int* red, int* green, int* blue, int* alpha +){ + /* Extracting color components from a 32-bit color value */ + SDL_PixelFormat *fmt; + Uint32 temp, pixel; + + fmt = surface->format; + pixel = *(((Uint32*) surface->pixels)+ y*surface->pitch/4 + x ); + + /* Get Red component */ + if( red ){ + temp = pixel & fmt->Rmask; /* Isolate red component */ + temp = temp >> fmt->Rshift; /* Shift it down to 8-bit */ + temp = temp << fmt->Rloss; /* Expand to a full 8-bit number */ + *red = temp; + } + + /* Get Green component */ + if( green ){ + temp = pixel & fmt->Gmask; /* Isolate green component */ + temp = temp >> fmt->Gshift; /* Shift it down to 8-bit */ + temp = temp << fmt->Gloss; /* Expand to a full 8-bit number */ + *green = temp; + } + + /* Get Blue component */ + if( blue ){ + temp = pixel & fmt->Bmask; /* Isolate blue component */ + temp = temp >> fmt->Bshift; /* Shift it down to 8-bit */ + temp = temp << fmt->Bloss; /* Expand to a full 8-bit number */ + *blue = temp; + } + + /* Get Alpha component */ + if( alpha ){ + temp = pixel & fmt->Amask; /* Isolate alpha component */ + temp = temp >> fmt->Ashift; /* Shift it down to 8-bit */ + temp = temp << fmt->Aloss; /* Expand to a full 8-bit number */ + *alpha = temp; + } +} + +void get_pixel_on_image( + SDL_Surface* surface, + int x, int y, + int* red, int* green, int* blue, int* alpha +){ + SDL_LockSurface(surface); + + get_pixel_on_image_unsafe( + surface, + x, y, + red, green, blue, alpha + ); + + SDL_UnlockSurface(surface); +} + +void MLV_get_pixel( + int x, int y, int* red, int* green, int* blue, int* alpha +){ + get_pixel_on_image( MLV_data->screen, x, y, red, green, blue, alpha ); +} + +void MLV_get_pixel_on_image( + const MLV_Image* image, int x, int y, + int* red, int* green, int* blue, int* alpha +){ + get_pixel_on_image( image->surface, x, y, red, green, blue, alpha ); +} + +void MLV_draw_image_on_image( + const MLV_Image* source_image, + MLV_Image* destination_image, + int destination_x, int destination_y +){ + SDL_Rect rectangle; + rectangle.x = destination_x; + rectangle.y = destination_y; + rectangle.h = source_image->surface->h; + rectangle.w = source_image->surface->w; + SDL_BlitSurface( source_image->surface, NULL, destination_image->surface , &rectangle); +} + +void MLV_draw_partial_image_on_image( + const MLV_Image* source_image, + int source_x, int source_y, + int width, int height, + MLV_Image* destination_image, + int destination_x, int destination_y +){ + SDL_Rect rectangle_source,rectangle_destination; + + rectangle_destination.x = destination_x; + rectangle_destination.y = destination_y; + rectangle_destination.w = destination_image->surface->w; + rectangle_destination.h = destination_image->surface->h; + + rectangle_source.x = source_x; + rectangle_source.y = source_y; + rectangle_source.w = width; + rectangle_source.h = height; + + SDL_BlitSurface( + source_image->surface, &rectangle_source, + destination_image->surface , &rectangle_destination + ); +} + +/////////////////////////////////////////////////////////////////////////////// +// Save screen // +/////////////////////////////////////////////////////////////////////////////// + +void MLV_save_screen(){ + SDL_BlitSurface( MLV_data->screen, NULL, MLV_data->save_screen, &(MLV_data->rectangle)); +} + +void MLV_load_screen(){ + SDL_BlitSurface( MLV_data->save_screen, NULL, MLV_data->screen, &(MLV_data->rectangle)); +} + diff --git a/MLV/image.h b/MLV/image.h new file mode 100644 index 0000000..32a13cc --- /dev/null +++ b/MLV/image.h @@ -0,0 +1,55 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#ifndef __MLV__IMAGE_H__ +#define __MLV__IMAGE_H__ + +#include "platform.h" + +#if defined( __MLV_ANDROID__ ) +# define MLV_16_BPP 16 +#else +# define MLV_32_BPP 32 +#endif + +#if defined( MLV_32_BPP ) +# define MLV_BPP 32 +#elif defined( MLV_16_BPP ) +# define MLV_BPP 16 +#endif + +#ifndef MEMORY_DEBUG +#if defined( OS_WINDOWS ) +# include +#elif defined( OS_APPLE ) +# include +#else +# include +#endif +#else +#include "memory_debug.h" +#endif + +SDL_Surface* create_surface( int width, int height ); +void get_pixel_on_image_unsafe( SDL_Surface* surface, int x, int y, + int* red, int* green, int* blue, int* alpha +); + +#endif diff --git a/MLV/informations.c b/MLV/informations.c new file mode 100644 index 0000000..1dd6669 --- /dev/null +++ b/MLV/informations.c @@ -0,0 +1,50 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "MLV_information.h" +#include "config.h" + +const char* MLV_get_package_name( ){ + return PACKAGE_NAME; +} + +const char* MLV_get_version( ){ + return VERSION; +} + +const char* MLV_get_revision_of_revision_control_software( ){ + return MLV_RCS_REVISION; +} + +const char* MLV_get_repository( ){ + return MLV_REPOSITORY; +} + +const char* MLV_get_bug_report_address( ){ + return PACKAGE_BUGREPORT; +} + +const char* MLV_get_web_distribution( ){ + return PACKAGE_URL; +} + +const char* MLV_get_licence( ){ + return "GPL V3"; +} diff --git a/MLV/input_box.c b/MLV/input_box.c new file mode 100644 index 0000000..5a27b37 --- /dev/null +++ b/MLV/input_box.c @@ -0,0 +1,935 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include + +#include "platform.h" + +#ifdef OS_WINDOWS +/* Get va_list. */ +#if __STDC__ || defined __cplusplus || defined _MSC_VER +# include +#else +# include +#endif +extern int vasprintf (char **, const char *, va_list); +#endif + +#include "MLV_input_box.h" +#include "MLV_event.h" +#include "MLV_text.h" + +#include "platform.h" +#include "image.h" +#include "input_box.h" +#include "text.h" +#include "list.h" + +#ifndef MEMORY_DEBUG +#if defined( OS_WINDOWS ) +# include +# include +#elif defined( OS_APPLE ) +# include +# include +#else +# include +# include +#endif +#else +#include "memory_debug.h" +#endif + +#include "sdlkeyboardtochar.h" +#include "glib.h" + +#include +#include "warning_error.h" + +#include "memory_management.h" + +#define SIZE_FONT 8 +#define SIZE_BORD 1 +#define TIME_CURSOR 1000 //Periode d'oscillation du curseur (ms) + +// +// Les fonction avec le suffixe _NST veux dire : No Safe Thread. +// Cela veux dire qu'anvant d'utiliser de telle fonctions, il faut +// s'assurer la propriété entiere des objet qu'il va modifier. +// + +#include "data_structure.h" + +extern DataMLV* MLV_data; + +struct _MLV_Input_box { + //Géométrie de la boîte de saisie + int sommetHautGauche[2]; + int sommetBasDroit[2]; + int width; + int height; + SDL_Rect rectangle; + //Taille de la font du texte + const MLV_Font* font; + //Positiononnement du texte + int bord[2]; + int widthMessage; + int widthAnswer; + int heightMessAns; + //Couleurs de la boîtes de saisie + MLV_Color borderColor; + MLV_Color textColor; + MLV_Color backgroundColor; + //Rendu de la boîte de saisie + SDL_Surface* apparence; + SDL_Surface* answer; + SDL_Rect answerRectangle; + //Message d'information + char* informativeMessage; + //position du curseur dans la réponse courante + int positionCursor; + int lastTime; + int cursorIsVisible; //le curseur (qui clignote ) est dans son etat visible + //La boîte de saisie est active + int isListenning; + //Histroique - le premier élément de l'historique correspond à la + //reponse courante de la boîte de saisie + MLV_List* history; + MLV_List* positionHistory; + //Gestion concurentiel de l'accès à la boîte de saisie. + SDL_sem* semaphore; +}; + + +/* + * bord[0] withMessage withAnswer bord[0] + * <---><-------------><---------------------------><--> + * _ ____________________________________________________ + * bord[1] | | | + * |_ | _____________________________________________ | + * | | | | | | + * heightMessAns | | | I. Message | An|swer | | + * |_ | |_______________|___________________________| | + * | | | + * bord[1] |_ |___________________________________________________| + * + * + * */ +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void recalculateTextPositions_NTS( MLV_Input_box* input_box ){ + int width_message, height_message; + MLV_get_size_of_text_with_font( + input_box->informativeMessage, + &width_message, &height_message, + input_box->font + ); + input_box->widthMessage = width_message; + input_box->widthAnswer = input_box->width - input_box->widthMessage - 2 * input_box->bord[0]; + input_box->heightMessAns = ( input_box->font->size > height_message )? + input_box->font->size : height_message ; +// input_box->heightMessAns = height_message ; + input_box->bord[1] = (input_box->height - ( input_box->heightMessAns ) )/2; + if(input_box->answer){ +// DEBUG("Free answer"); + SDL_FreeSurface( input_box->answer ); + } + if( input_box->widthAnswer > 0 ){ +// DEBUG("Create answer"); + input_box->answer = create_surface( input_box->widthAnswer, input_box->heightMessAns ); + input_box->answerRectangle.x = input_box->bord[0] + input_box->widthMessage; + input_box->answerRectangle.y = input_box->bord[1]; + input_box->answerRectangle.w = input_box->widthAnswer; + input_box->answerRectangle.h = input_box->heightMessAns; + }else{ + input_box->answer = NULL; + } +} + +void lock_input_box( MLV_Input_box* input_box ){ + if( SDL_SemWait( input_box->semaphore ) ){ + ERROR_FULL("Probleme de semaphore"); + } +} + +void unlock_input_box( MLV_Input_box* input_box ){ + if( SDL_SemPost( input_box->semaphore ) ){ + ERROR_FULL("Probleme de semaphore"); + } +} + +typedef struct _Input_box_information { + MLV_List* input_box_list; + MLV_Input_box* input_box_activated; + SDL_sem* semaphore; +} Input_box_information; + +Input_box_information input_box_information; + +void lock_input_box_information( ){ + if( SDL_SemWait( input_box_information.semaphore ) ){ + ERROR_FULL( "Probleme de semaphore" ); + } +} + +void unlock_input_box_information( ){ + if( SDL_SemPost( input_box_information.semaphore ) ){ + ERROR_FULL( "Probleme de semaphore" ); + } +} + +/* +input_box->history->data + 0 m l-1 +--------------------------------------------------------- +| | | | | X | Y | | | | | | | | \0 | +--------------------------------------------------------- + | + curseur +new + + 0 m l-1 l +--------------------------------------------------------- +| | | | | X | c | Y | | | | | | | \0 | +--------------------------------------------------------- + | + curseur + */ +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void add_carac_input_box_NTS( MLV_Input_box* input_box, char c ){ + int l = strlen(input_box->history->data); + int m = input_box->positionCursor ; +// DEBUG("Add History Entry"); + char* new = MLV_MALLOC( ( l + 2 ), char ); + strncpy( new, input_box->history->data , m ); + new[input_box->positionCursor] = c; + strncpy( new + m + 1 , input_box->history->data + m , l - m ); + new[l + 1] = '\0'; +// DEBUG("Free History Entry"); + MLV_FREE( input_box->history->data, char ); + input_box->history->data = new; + input_box->positionCursor++; +} + +/* +input_box->history->data + 0 m l-1 +--------------------------------------------------------- +| | | | | X | Y | Z | | | | | | | \0 | +--------------------------------------------------------- + | + curseur +resultat + + 0 m l-1 +------------------------------------------------------ +| | | | | X | Z | | | | | | | \0 | +------------------------------------------------------ + | + curseur + */ +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void suppress_carac_input_box_NTS( MLV_Input_box* input_box ){ + int l = strlen(input_box->history->data); + int m = input_box->positionCursor ; + if( l == m ) return; + memmove( input_box->history->data + m, input_box->history->data + m + 1, l - m ); +} + +/* +input_box->history->data + 0 m l-1 +--------------------------------------------------------- +| | | | X | Y | Z | | | | | | | | \0 | +--------------------------------------------------------- + | + curseur +resulat + + 0 m-1 m l-1 +------------------------------------------------------ +| | | | X | Z | | | | | | | | \0 | +------------------------------------------------------ + | + curseur + */ +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void return_deletion_carac_input_box_NTS( MLV_Input_box* input_box ){ + int l = strlen(input_box->history->data); + int m = input_box->positionCursor ; + if( m != 0 ){ + memmove( input_box->history->data + m-1, input_box->history->data + m , l - m + 1 ); + input_box->positionCursor--; + } +} + + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void recalculateSommetBas_NTS( MLV_Input_box* input_box ){ + input_box->sommetBasDroit[0] = input_box->sommetHautGauche[0] + input_box->width; + input_box->sommetBasDroit[1] = input_box->sommetHautGauche[1] + input_box->height; +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void change_position_input_box_NTS(MLV_Input_box* input_box, int sommetHautGaucheX, int sommetHautGaucheY){ + input_box->sommetHautGauche[0] = sommetHautGaucheX; + input_box->sommetHautGauche[1] = sommetHautGaucheY; + input_box->rectangle.x = sommetHautGaucheX; + input_box->rectangle.y = sommetHautGaucheY; + recalculateSommetBas_NTS( input_box ); + recalculateTextPositions_NTS( input_box ); +} + +void MLV_change_position_input_box(MLV_Input_box* input_box, int sommetHautGaucheX, int sommetHautGaucheY){ + lock_input_box( input_box ); + change_position_input_box_NTS( input_box, sommetHautGaucheX, sommetHautGaucheY ); + unlock_input_box( input_box ); +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void change_size_input_box_NTS(MLV_Input_box* input_box, int width, int height){ + if( (width < 0) || (height < 0)){ + ERROR_FULL( "Les tailles ne sont pas correctes." ); + } + input_box->width = width; + input_box->height = height; + input_box->rectangle.w = width; + input_box->rectangle.h = height; + if( input_box->apparence ){ +// DEBUG("Free apparence"); + SDL_FreeSurface(input_box->apparence); + } +// DEBUG("Create apparence"); + input_box->apparence = create_surface( input_box->width, input_box->height ); + recalculateSommetBas_NTS( input_box ); + recalculateTextPositions_NTS( input_box ); +} + +void MLV_change_input_box_size(MLV_Input_box* input_box, int width, int height){ + lock_input_box( input_box ); + change_size_input_box_NTS( input_box, width, height); + unlock_input_box( input_box ); +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void change_geometry_input_box_NTS(MLV_Input_box* input_box, int sommetHautGaucheX, int sommetHautGaucheY, int width, int height){ + change_size_input_box_NTS( input_box, width, height ); + change_position_input_box_NTS( input_box, sommetHautGaucheX, sommetHautGaucheY); +}; + +void MLV_change_input_box_geometry(MLV_Input_box* input_box, int sommetHautGaucheX, int sommetHautGaucheY, int width, int height){ + lock_input_box( input_box ); + change_geometry_input_box_NTS( input_box, sommetHautGaucheX, sommetHautGaucheY, width, height); + unlock_input_box( input_box ); +}; + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void change_colors_input_box_NTS( MLV_Input_box* input_box, MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor ){ + input_box->borderColor = borderColor; + input_box->textColor = textColor; + input_box->backgroundColor = backgroundColor; +}; + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void MLV_change_input_box_colors( MLV_Input_box* input_box, MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor ){ + lock_input_box( input_box ); + change_colors_input_box_NTS( input_box, borderColor, textColor, backgroundColor ); + unlock_input_box( input_box ); +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void desactivate_input_box_NTS( ){ + if( input_box_information.input_box_activated ){ + input_box_information.input_box_activated->isListenning = 0; + input_box_information.input_box_activated = NULL; + } +} + +void MLV_desactivate_input_box( ){ + lock_input_box_information(); + desactivate_input_box_NTS( ); + unlock_input_box_information(); +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void activate_imput_box_NTS( MLV_Input_box* input_box ){ + desactivate_input_box_NTS( ); + input_box->isListenning = 1; + input_box_information.input_box_activated = input_box; +} + +void MLV_activate_input_box( MLV_Input_box* input_box ){ + lock_input_box_information(); + lock_input_box( input_box ); + activate_imput_box_NTS( input_box ); + unlock_input_box( input_box ); + unlock_input_box_information(); +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +int is_in_input_box_NTS( MLV_Input_box* input_box, int x, int y ){ + int result = 0; + if( (x >= input_box->sommetHautGauche[0]) && + (x <= input_box->sommetBasDroit[0]) && + (y >= input_box->sommetHautGauche[1]) && + (y <= input_box->sommetBasDroit[1]) + ) result = 1; + return result; +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +MLV_Input_box* is_in_an_input_box_NTS( int x, int y ){ + MLV_Input_box* result = NULL; + MLV_List* list = input_box_information.input_box_list; + while( list ){ + MLV_Input_box* input_box = (MLV_Input_box*) list->data; + if( is_in_input_box_NTS( input_box, x, y ) ){ + result = input_box; + break; + } + list = list->next; + } + return result; +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void construct_input_box_NTS( MLV_Input_box* input_box ){ + int width_message_before_input_box, height_message_before_input_box; + + boxColor( + input_box->apparence, + 0, 0, input_box->width-1, input_box->height-1, + input_box->backgroundColor + ); + + drawString( + input_box->apparence, + input_box->bord[0] , input_box->bord[1], + input_box->informativeMessage, + input_box->textColor, input_box->font->font + ); + + if( input_box->widthAnswer > 0 ){ + boxColor( + input_box->answer, + 0, 0, input_box->widthAnswer-1, input_box->heightMessAns -1, + input_box->backgroundColor + ); + char * message = (char*) input_box->history->data ; + int decalage = 0; + char* message_before_input_box = MLV_MALLOC( input_box->positionCursor+1, char ); + strncpy( message_before_input_box, message, input_box->positionCursor ); + message_before_input_box[input_box->positionCursor] = '\0'; + MLV_get_size_of_text_with_font( + message_before_input_box, + &width_message_before_input_box, &height_message_before_input_box, + input_box->font + ); + if( width_message_before_input_box > (input_box->widthAnswer) ){ + decalage = input_box->widthAnswer - width_message_before_input_box -1; + } + MLV_FREE( message_before_input_box, char ); + drawString( + input_box->answer, + decalage , 0, + message, + input_box->textColor, input_box->font->font + ); + SDL_BlitSurface( + input_box->answer, NULL, + input_box->apparence, &(input_box->answerRectangle) + ); + } + + int time = SDL_GetTicks(); + if( ( time - input_box->lastTime > TIME_CURSOR ) ){ + input_box->lastTime = time; + input_box->cursorIsVisible = ! input_box->cursorIsVisible; + }; + + if( (! input_box->isListenning) || input_box->cursorIsVisible ){ + int abscisse; + if( width_message_before_input_box > input_box->widthAnswer ){ + abscisse = input_box->bord[0] + + input_box->widthMessage + + input_box->widthAnswer -2; + }else{ + abscisse = input_box->bord[0] + + input_box->widthMessage + + width_message_before_input_box; + } + lineColor( + input_box->apparence, + abscisse , input_box->bord[1], + abscisse, input_box->bord[1] + input_box->heightMessAns -1, + input_box->textColor + ); + } + + rectangleColor( + input_box->apparence, + 0, 0, + input_box->width-1, input_box->height-1, + input_box->borderColor + ); +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void input_box_register_NTS(MLV_Input_box* input_box){ + input_box_information.input_box_list = MLV_prepend_list( input_box_information.input_box_list , input_box ); +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void input_box_unregister_NTS(MLV_Input_box* input_box){ + if( input_box_information.input_box_activated == input_box ) desactivate_input_box_NTS(); + input_box_information.input_box_list = MLV_remove_list( input_box_information.input_box_list, input_box ); +} + +MLV_Input_box* create_input_box_with_font( + int sommetHautGaucheX, int sommetHautGaucheY, + int width, int height, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, + const MLV_Font* font +){ +// DEBUG("Add input_box"); + MLV_Input_box* input_box = MLV_MALLOC( 1, MLV_Input_box ); + +// DEBUG("Create semaphore"); + input_box->semaphore = SDL_CreateSemaphore(1); + + input_box->font = font; + input_box->bord[0] = SIZE_BORD; +// DEBUG("Add Informative message"); + input_box->informativeMessage = MLV_MALLOC( (strlen(informativeMessage)+1), char ); + strcpy( input_box->informativeMessage, informativeMessage ); + + input_box->apparence = NULL; + input_box->answer = NULL; + change_geometry_input_box_NTS(input_box, sommetHautGaucheX, sommetHautGaucheY, width, height); + + MLV_change_input_box_colors(input_box, borderColor, textColor, backgroundColor ); + +// DEBUG("Add History Entry"); + input_box->history = MLV_prepend_list( NULL, MLV_MALLOC( 1, char ) ); + ((char*) input_box->history->data)[0] = '\0'; + input_box->positionHistory = input_box->history; + input_box->positionCursor = 0; + + input_box->lastTime = SDL_GetTicks(); + input_box->cursorIsVisible = 1; + input_box->isListenning = 0; + + lock_input_box_information(); + input_box_register_NTS( input_box ); + unlock_input_box_information(); + return input_box; +} + +MLV_Input_box* MLV_create_input_box_with_font_va( + int sommetHautGaucheX, int sommetHautGaucheY, + int width, int height, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, + const MLV_Font* font, va_list pile +){ + char* complete_informative_message; + if( + vasprintf( + &complete_informative_message, informativeMessage, pile + )==-1 + ){ + ERROR("Unexpected Error."); + } + MLV_Input_box* result = create_input_box_with_font( + sommetHautGaucheX, sommetHautGaucheY, width, height, borderColor, + textColor, backgroundColor, complete_informative_message, font + ); + free( complete_informative_message ); + return result; +} + +MLV_Input_box* MLV_create_input_box_with_font( + int sommetHautGaucheX, int sommetHautGaucheY, + int width, int height, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, + const MLV_Font* font, ... +){ + va_list pile; + va_start( pile, font ); + MLV_Input_box* result = MLV_create_input_box_with_font_va( + sommetHautGaucheX, sommetHautGaucheY, + width, height, + borderColor, textColor, + backgroundColor, + informativeMessage, + font, pile + ); + va_end( pile ); + return result; +} + +MLV_Input_box* MLV_create_input_box_va( + int sommetHautGaucheX, int sommetHautGaucheY, + int width, int height, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, + va_list pile +){ + return MLV_create_input_box_with_font_va( + sommetHautGaucheX, sommetHautGaucheY, + width, height, + borderColor, textColor, + backgroundColor, + informativeMessage, + MLV_data->defaultFont, pile + ); +} + +MLV_Input_box* MLV_create_input_box( + int sommetHautGaucheX, int sommetHautGaucheY, + int width, int height, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, ... +){ + va_list pile; + va_start( pile, informativeMessage ); + MLV_Input_box* result = MLV_create_input_box_va( + sommetHautGaucheX, sommetHautGaucheY, + width, height, + borderColor, textColor, + backgroundColor, + informativeMessage, pile + ); + va_end( pile ); + return result; +} + +void free_NTS( void* data, void* useless ){ +// DEBUG("Free Entry Hystory"); + MLV_FREE( data, char ); +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void suppressHistory_NTS( MLV_Input_box* input_box ){ + MLV_foreach_list( input_box->history, free_NTS, NULL ); +// DEBUG("Free history"); + MLV_free_list( input_box->history ); +} + +void MLV_suppress_history( MLV_Input_box* input_box ){ + lock_input_box( input_box ); + suppressHistory_NTS( input_box ); + unlock_input_box( input_box ); +} + +void MLV_free_input_box( MLV_Input_box* input_box ){ + lock_input_box_information( ); + lock_input_box( input_box ); + input_box_unregister_NTS( input_box ); +// DEBUG("Free apparence"); + SDL_FreeSurface(input_box->apparence); +// DEBUG("Free answer"); + SDL_FreeSurface( input_box->answer ); +// DEBUG("Free Informative message"); + MLV_FREE( input_box->informativeMessage, char ); +// MLV_FREE( input_box->history->data, char ); + suppressHistory_NTS( input_box ); +// DEBUG("Free semaphore"); + SDL_DestroySemaphore( input_box->semaphore ); + unlock_input_box_information( ); +// DEBUG("Free input_box"); + MLV_FREE( input_box, MLV_Input_box ); +} + +void change_informative_message_of_input_box( + MLV_Input_box* input_box, const char* message +){ + lock_input_box(input_box); + if( input_box->informativeMessage ){ +// DEBUG("Free Informative message"); + MLV_FREE( input_box->informativeMessage, char ); + } +// DEBUG("Add Informative message"); + input_box->informativeMessage = MLV_MALLOC( (strlen(message)+1), char ); + strcpy( input_box->informativeMessage, message ); + recalculateTextPositions_NTS( input_box ); + unlock_input_box(input_box); +} + +void MLV_change_informative_message_of_input_box_va( + MLV_Input_box* input_box, const char* message, va_list pile +){ + char* complete_message; + if( vasprintf( &complete_message, message, pile )==-1 ){ + ERROR("Unexpected Error."); + } + change_informative_message_of_input_box( + input_box, complete_message + ); + free( complete_message ); +} + +void MLV_change_informative_message_of_input_box( + MLV_Input_box* input_box, const char* message, ... +){ + va_list pile; + va_start( pile, message ); + MLV_change_informative_message_of_input_box_va( + input_box, message, pile + ); + va_end( pile ); +} + +void MLV_draw_input_box( MLV_Input_box* input_box ){ + lock_input_box( input_box ); + construct_input_box_NTS( input_box ); + SDL_BlitSurface( input_box->apparence, NULL, MLV_data->screen, &(input_box->rectangle)); + unlock_input_box( input_box ); +} + +void MLV_draw_all_input_boxes(){ + lock_input_box_information( ); + MLV_foreach_list( input_box_information.input_box_list, (void (*)(void*,void*)) MLV_draw_input_box , MLV_data->screen); + unlock_input_box_information( ); +} + +void init_input_box_mechanism(){ + SDL_EnableUNICODE(SDL_ENABLE); + input_box_information.semaphore = SDL_CreateSemaphore(1); + lock_input_box_information(); + input_box_information.input_box_list = NULL; + input_box_information.input_box_activated=NULL; + unlock_input_box_information(); +} + +void quit_input_box_mechanism(){ + SDL_DestroySemaphore(input_box_information.semaphore); +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void replaceEntreeByHistory_NTS( MLV_Input_box* input_box ){ + char* dst = input_box->history->data; + if( input_box->positionHistory != input_box->history ){ + char* src = (char*) input_box->positionHistory->data; + if( strlen(dst) >= strlen(src) ){ + strcpy( dst, src ); + }else{ +// DEBUG("Add Hystory Entry"); + input_box->history->data = MLV_MALLOC( (strlen(src) + 1), char ); + strcpy( input_box->history->data, src ); +// DEBUG("Suppress Hystory Entry"); + MLV_FREE( dst, char ); + } + }else{ + if(dst){ + dst[0] = '\0'; + } + } + input_box->positionCursor = strlen(input_box->history->data); +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void goDownInHistory_NTS( MLV_Input_box* input_box ){ + if( input_box->positionHistory->previous ){ + input_box->positionHistory = input_box->positionHistory->previous; + }else{ + return; + } + replaceEntreeByHistory_NTS( input_box ); +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void goUpInHistory_NTS( MLV_Input_box* input_box ){ + if( input_box->positionHistory->next ){ + input_box->positionHistory = input_box->positionHistory->next; + }else{ + return; + } + replaceEntreeByHistory_NTS( input_box ); +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void make_the_input_box_visible_NTS( MLV_Input_box* input_box ){ + input_box->lastTime = SDL_GetTicks(); + input_box->cursorIsVisible = 1; +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void input_box_move_left_answer_NTS( MLV_Input_box* input_box ){ + if( input_box->positionCursor > 0 ){ + input_box->positionCursor--; + } +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void input_box_move_right_answer_NTS( MLV_Input_box* input_box ){ + if( input_box->positionCursor < strlen( input_box->history->data ) ){ + input_box->positionCursor++; + } +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void validate_input_box_NTS( MLV_Input_box* input_box ){ + SDL_Event event; + event.type = SDL_USEREVENT; + event.user.code = MLV_INPUT_BOX; + event.user.data1 = input_box; + event.user.data2 = input_box->history->data; + SDL_PushEvent(&event); + input_box->history = MLV_prepend_list( input_box->history, input_box->history->data ); + input_box->positionHistory = input_box->history; +// DEBUG("Add Hystory Entry"); + input_box->history->data = MLV_MALLOC( 1, char ); + ((char*)input_box->history->data)[0] = '\0'; + input_box->positionCursor = 0; +} + + +int input_box_events_filter(const SDL_Event *event) { + int result = 1; + lock_input_box_information(); + switch(event->type){ + case SDL_KEYUP : + { //Une touche a ete appuyee + if( input_box_information.input_box_activated ) result = 0; + } + break; + case SDL_KEYDOWN : + { //Une touche a ete appuyee + // Si la touche echap a ete appuye, on laisse passe l'evenement + if ( event->key.keysym.sym == SDLK_ESCAPE ) break; + if( input_box_information.input_box_activated ){ + lock_input_box( input_box_information.input_box_activated ); + make_the_input_box_visible_NTS( input_box_information.input_box_activated); + //Si la touche est une fleche gauche ou droite on deplace le curseu + if( event->key.keysym.sym == SDLK_LEFT ){ + input_box_move_left_answer_NTS( input_box_information.input_box_activated ); + }else if( event->key.keysym.sym == SDLK_RIGHT ){ + input_box_move_right_answer_NTS( input_box_information.input_box_activated ); + }else if( event->key.keysym.sym == SDLK_UP ){//Si la touche est une fleche bas ou haut on se deplace dans l'historique + goUpInHistory_NTS( input_box_information.input_box_activated ); + }else if( event->key.keysym.sym == SDLK_DOWN ){ + goDownInHistory_NTS( input_box_information.input_box_activated ); + }else if( event->key.keysym.sym == SDLK_DELETE ){//Si la touche est une suppession on supprime une lettre + suppress_carac_input_box_NTS( input_box_information.input_box_activated ); + }else if( event->key.keysym.sym == SDLK_BACKSPACE ){ + return_deletion_carac_input_box_NTS( input_box_information.input_box_activated ); + }else if( (event->key.keysym.sym == SDLK_RETURN) || (event->key.keysym.sym == SDLK_KP_ENTER) ){ + validate_input_box_NTS(input_box_information.input_box_activated); + }else if( event->key.keysym.unicode != 0 ){ + //Si la lettre n'est pas \n On ajoute la lettre au mot courant + //Sinon on vide le mot et on cree un evenement du mot qui + //a ete attrappee par la boite de saisie + char* character = MLV_convert_unicode_to_string( + event->key.keysym.unicode + ); + int i=0; + while( character[i] != '\0' ){ + add_carac_input_box_NTS( + input_box_information.input_box_activated, + character[i] + ); + i++; + } + MLV_FREE( character, char ); + } + unlock_input_box( input_box_information.input_box_activated ); + result = 0; + } + } + break; + case SDL_MOUSEBUTTONDOWN : + { //Si on est dans une zone de boîte de saisie on active + // l'enregistrement des données. + MLV_Input_box* tmp = is_in_an_input_box_NTS( + event->button.x, event->button.y + ); + if( tmp ){ + lock_input_box( tmp ); + activate_imput_box_NTS( tmp ); + unlock_input_box( tmp ); + result=0; + }else{ + desactivate_input_box_NTS( ); + } + } + break; + default :; + } + unlock_input_box_information(); + return result; +} + diff --git a/MLV/input_box.h b/MLV/input_box.h new file mode 100644 index 0000000..c201196 --- /dev/null +++ b/MLV/input_box.h @@ -0,0 +1,34 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#ifndef __MLV__INPUT_BOX_H__ +#define __MLV__INPUT_BOX_H__ + +#ifndef MEMORY_DEBUG +#include +#else +#include "memory_debug.h" +#endif + +void init_input_box_mechanism(); +void quit_input_box_mechanism(); +int input_box_events_filter(const SDL_Event *event); + +#endif diff --git a/MLV/input_box_wait.c b/MLV/input_box_wait.c new file mode 100644 index 0000000..0b16914 --- /dev/null +++ b/MLV/input_box_wait.c @@ -0,0 +1,187 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include + +#include "platform.h" + +#ifdef OS_WINDOWS +/* Get va_list. */ +#if __STDC__ || defined __cplusplus || defined _MSC_VER +# include +#else +# include +#endif +extern int vasprintf (char **, const char *, va_list); +#endif + +#include "MLV_input_box.h" +#include "MLV_shape.h" +#include "MLV_color.h" +#include "MLV_window.h" +#include "MLV_event.h" +#include "data_structure.h" + +#include "warning_error.h" + +#include + +#include "memory_management.h" +#include "image.h" + +extern DataMLV* MLV_data; + +void MLV_wait_particular_input_box( MLV_Input_box* input_box, char** text){ + MLV_Input_box* tmp_input_box = NULL; + (*text) = NULL; + + //We activate the input_box + MLV_activate_input_box( input_box ); + + // We first flush the event queue + MLV_flush_event_queue(); + + // We wait for a input_box event + while( ! (*text) ){ + MLV_Event event_type = MLV_get_event( + NULL, NULL, NULL, + text, &tmp_input_box, + NULL, NULL, NULL, + NULL + ); + if( (event_type==MLV_INPUT_BOX ) && input_box != tmp_input_box ){ + MLV_FREE( (*text), char ); + (*text) = NULL; + } + MLV_draw_all_input_boxes(); + MLV_actualise_window(); + } +} + +void wait_input_box_with_font( + int sommetHautGaucheX, int sommetHautGaucheY, + int sommetBasDroitX, int sommetBasDroitY, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, + char** text, + const MLV_Font* font +){ + MLV_Input_box* input_box = MLV_create_input_box_with_font( + sommetHautGaucheX, sommetHautGaucheY, + sommetBasDroitX, sommetBasDroitY, + borderColor, textColor, + backgroundColor, + informativeMessage, + font + ); + + SDL_Surface *save_screen = create_surface( MLV_data->width, MLV_data->height ); + SDL_BlitSurface( MLV_data->screen, NULL, save_screen, &(MLV_data->rectangle)); + + MLV_wait_particular_input_box( input_box, text); + MLV_free_input_box( input_box ); + + SDL_BlitSurface( save_screen, NULL, MLV_data->screen, &(MLV_data->rectangle)); + SDL_FreeSurface( save_screen ); + + MLV_actualise_window(); +} + +void MLV_wait_input_box_with_font_va( + int sommetHautGaucheX, int sommetHautGaucheY, + int sommetBasDroitX, int sommetBasDroitY, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, + char** text, + const MLV_Font* font, va_list pile +){ + char* complete_informative_message; + if( + vasprintf( + &complete_informative_message, informativeMessage, pile + )==-1 + ){ + ERROR("Unexpected Error."); + } + wait_input_box_with_font( + sommetHautGaucheX, sommetHautGaucheY, sommetBasDroitX, sommetBasDroitY, + borderColor, textColor, backgroundColor, complete_informative_message, + text, font + ); + free( complete_informative_message ); +} + +void MLV_wait_input_box_with_font( + int sommetHautGaucheX, int sommetHautGaucheY, + int sommetBasDroitX, int sommetBasDroitY, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, + char** text, + const MLV_Font* font, ... +){ + va_list pile; + va_start( pile, font ); + MLV_wait_input_box_with_font_va( + sommetHautGaucheX, sommetHautGaucheY, sommetBasDroitX, sommetBasDroitY, + borderColor, textColor, backgroundColor, informativeMessage, + text, font, pile + ); + va_end( pile ); +} + +void MLV_wait_input_box_va( + int sommetHautGaucheX, int sommetHautGaucheY, + int sommetBasDroitX, int sommetBasDroitY, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, + char** text, va_list pile +){ + MLV_wait_input_box_with_font_va( + sommetHautGaucheX, sommetHautGaucheY, + sommetBasDroitX, sommetBasDroitY, + borderColor, textColor, + backgroundColor, + informativeMessage, + text, MLV_data->defaultFont, pile + ); +} + +void MLV_wait_input_box( + int sommetHautGaucheX, int sommetHautGaucheY, + int sommetBasDroitX, int sommetBasDroitY, + MLV_Color borderColor, MLV_Color textColor, + MLV_Color backgroundColor, + const char* informativeMessage, + char** text, ... +){ + va_list pile; + va_start( pile, text ); + MLV_wait_input_box_va( + sommetHautGaucheX, sommetHautGaucheY, sommetBasDroitX, sommetBasDroitY, + borderColor, textColor, backgroundColor, informativeMessage, text, pile + ); + va_end( pile ); +} + + diff --git a/MLV/key.c b/MLV/key.c new file mode 100644 index 0000000..38d752e --- /dev/null +++ b/MLV/key.c @@ -0,0 +1,97 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "key.h" + +#include "warning_error.h" +#include "memory_management.h" +#include + +struct _MLV_Key { + void* value; + void (* value_destroying_function )( void* value ); + int (* compare_values )( void* value1, void* value2 ); +}; + +MLV_Key* MLV_create_key( + void* value, + void (* value_destroying_function )( void* data ), + int (* compare_values )( void* value1, void* value2 ) +){ + MLV_Key* key = MLV_MALLOC( 1, MLV_Key ); + key->value = value; + key->value_destroying_function = value_destroying_function; + key->compare_values = compare_values; + return key; +} + +void MLV_free_key( MLV_Key* key ){ + if( key ){ + if( key->value_destroying_function ){ + key->value_destroying_function( key->value ); + } + MLV_FREE( key, MLV_Key ); + } +} + +int MLV_compare_keys( MLV_Key* key1, MLV_Key* key2 ){ + return key1->compare_values( key1->value, key2->value ); +} + +void free_string( char* text ){ + MLV_FREE( text, char ); +} + +int compare_strings( char* text1, char* text2 ){ + return strcmp( text1, text2 ); +} + +MLV_Key* MLV_string_to_key( const char* text ){ + size_t l = strlen( text ); + char* text_copy = MLV_MALLOC( ( l + 1 ), char ); + strncpy( text_copy, text, l+1); + return MLV_create_key( + text_copy, + ( void (*)( void* ) ) free_string, + ( int (*)( void*, void* ) ) compare_strings + ); +} + +void free_integer( int* integer ){ + MLV_FREE( integer, int ); +} + +int compare_integers( int* int1, int* int2 ){ + return (*int1) - (*int2); +} + +MLV_Key* MLV_integer_to_key( int integer ){ + int* value = MLV_MALLOC( 1, int ); + *value = integer; + return MLV_create_key( + value, + ( void (*)( void* ) ) free_integer, + (int (*)( void*, void* )) compare_integers + ); +} + +void* MLV_get_value_from_key( MLV_Key* key ){ + return key->value; +} diff --git a/MLV/key.h b/MLV/key.h new file mode 100644 index 0000000..0afcc8e --- /dev/null +++ b/MLV/key.h @@ -0,0 +1,42 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#ifndef __MLV__KEY_H__ +#define __MLV__KEY_H__ + +typedef struct _MLV_Key MLV_Key; + +MLV_Key* MLV_create_key( + void* value, + void (* value_destroying_function )( void* value ), + int (* compare_values )( void* value1, void* value2 ) +); + +void MLV_free_key( MLV_Key* key ); + +int MLV_compare_keys( MLV_Key* key1, MLV_Key* key2 ); + +MLV_Key* MLV_string_to_key( const char* text ); +MLV_Key* MLV_integer_to_key( int integer ); + +void* MLV_get_value_from_key( MLV_Key* key ); + +#endif + diff --git a/MLV/keyboard.c b/MLV/keyboard.c new file mode 100644 index 0000000..750ca0a --- /dev/null +++ b/MLV/keyboard.c @@ -0,0 +1,1678 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "MLV_keyboard.h" +#include "MLV_event.h" +#include "MLV_time.h" + +#ifndef MEMORY_DEBUG +#include +#else +#include "memory_debug.h" +#endif + +#include "warning_error.h" + +#include "memory_management.h" + + +void MLV_wait_keyboard( MLV_Keyboard_button* sym, MLV_Keyboard_modifier* mod, int* unicode ){ + MLV_Button_state state; + + // We remove all existing event from the queue + MLV_flush_event_queue(); + + //We wait for a new keyboard event + while( + ( + MLV_wait_event( + sym, mod, unicode, + NULL, NULL, + NULL, NULL, NULL, + &state + ) != MLV_KEY + ) || + ( state != MLV_PRESSED ) + ); +} + +int MLV_wait_keyboard_or_seconds( MLV_Keyboard_button* sym, MLV_Keyboard_modifier* mod, int* unicode, int seconds ){ + MLV_Button_state state; + + // We remove all existing event from the queue + MLV_flush_event_queue(); + + int time = MLV_get_time(); + + MLV_Keyboard_button tmp_sym; + MLV_Keyboard_modifier tmp_mod; + int tmp_unicode; + + //We wait for a new keyboard event + int resultat = 0; + while( + ( + ( + resultat = ( + MLV_wait_event_or_seconds( + &tmp_sym, &tmp_mod, &tmp_unicode, + NULL, NULL, + NULL, NULL, NULL, + &state, + seconds - (MLV_get_time() - time)/1000 + ) != MLV_KEY + ) + ) || + ( state != MLV_PRESSED ) + ) && ( + (MLV_get_time() - time) < seconds*1000 + ) + ); + + if( ! resultat && state == MLV_PRESSED ){ + if( sym ) *sym = tmp_sym; + if( mod ) *mod = tmp_mod; + if( unicode ) *unicode = tmp_unicode; + } + + return resultat; +} + +MLV_Keyboard_button MLV_convert_string_to_keyboard_button( const char* key_string ){ + + if(strcmp(key_string,"MLV_KEYBOARD_UNKNOWN") == 0){ + return MLV_KEYBOARD_UNKNOWN; + } + if(strcmp(key_string,"MLV_KEYBOARD_FIRST") == 0){ + return MLV_KEYBOARD_FIRST; + } + if(strcmp(key_string,"MLV_KEYBOARD_BACKSPACE") == 0){ + return MLV_KEYBOARD_BACKSPACE; + } + if(strcmp(key_string,"MLV_KEYBOARD_TAB") == 0){ + return MLV_KEYBOARD_TAB; + } + if(strcmp(key_string,"MLV_KEYBOARD_CLEAR") == 0){ + return MLV_KEYBOARD_CLEAR; + } + if(strcmp(key_string,"MLV_KEYBOARD_RETURN") == 0){ + return MLV_KEYBOARD_RETURN; + } + if(strcmp(key_string,"MLV_KEYBOARD_PAUSE") == 0){ + return MLV_KEYBOARD_PAUSE; + } + if(strcmp(key_string,"MLV_KEYBOARD_ESCAPE") == 0){ + return MLV_KEYBOARD_ESCAPE; + } + if(strcmp(key_string,"MLV_KEYBOARD_SPACE") == 0){ + return MLV_KEYBOARD_SPACE; + } + if(strcmp(key_string,"MLV_KEYBOARD_EXCLAIM") == 0){ + return MLV_KEYBOARD_EXCLAIM; + } + if(strcmp(key_string,"MLV_KEYBOARD_QUOTEDBL") == 0){ + return MLV_KEYBOARD_QUOTEDBL; + } + if(strcmp(key_string,"MLV_KEYBOARD_HASH") == 0){ + return MLV_KEYBOARD_HASH; + } + if(strcmp(key_string,"MLV_KEYBOARD_DOLLAR") == 0){ + return MLV_KEYBOARD_DOLLAR; + } + if(strcmp(key_string,"MLV_KEYBOARD_AMPERSAND") == 0){ + return MLV_KEYBOARD_AMPERSAND; + } + if(strcmp(key_string,"MLV_KEYBOARD_QUOTE") == 0){ + return MLV_KEYBOARD_QUOTE; + } + if(strcmp(key_string,"MLV_KEYBOARD_LEFTPAREN") == 0){ + return MLV_KEYBOARD_LEFTPAREN; + } + if(strcmp(key_string,"MLV_KEYBOARD_RIGHTPAREN") == 0){ + return MLV_KEYBOARD_RIGHTPAREN; + } + if(strcmp(key_string,"MLV_KEYBOARD_ASTERISK") == 0){ + return MLV_KEYBOARD_ASTERISK; + } + if(strcmp(key_string,"MLV_KEYBOARD_PLUS") == 0){ + return MLV_KEYBOARD_PLUS; + } + if(strcmp(key_string,"MLV_KEYBOARD_COMMA") == 0){ + return MLV_KEYBOARD_COMMA; + } + if(strcmp(key_string,"MLV_KEYBOARD_MINUS") == 0){ + return MLV_KEYBOARD_MINUS; + } + if(strcmp(key_string,"MLV_KEYBOARD_PERIOD") == 0){ + return MLV_KEYBOARD_PERIOD; + } + if(strcmp(key_string,"MLV_KEYBOARD_SLASH") == 0){ + return MLV_KEYBOARD_SLASH; + } + if(strcmp(key_string,"MLV_KEYBOARD_0") == 0){ + return MLV_KEYBOARD_0; + } + if(strcmp(key_string,"MLV_KEYBOARD_1") == 0){ + return MLV_KEYBOARD_1; + } + if(strcmp(key_string,"MLV_KEYBOARD_2") == 0){ + return MLV_KEYBOARD_2; + } + if(strcmp(key_string,"MLV_KEYBOARD_3") == 0){ + return MLV_KEYBOARD_3; + } + if(strcmp(key_string,"MLV_KEYBOARD_4") == 0){ + return MLV_KEYBOARD_4; + } + if(strcmp(key_string,"MLV_KEYBOARD_5") == 0){ + return MLV_KEYBOARD_5; + } + if(strcmp(key_string,"MLV_KEYBOARD_6") == 0){ + return MLV_KEYBOARD_6; + } + if(strcmp(key_string,"MLV_KEYBOARD_7") == 0){ + return MLV_KEYBOARD_7; + } + if(strcmp(key_string,"MLV_KEYBOARD_8") == 0){ + return MLV_KEYBOARD_8; + } + if(strcmp(key_string,"MLV_KEYBOARD_9") == 0){ + return MLV_KEYBOARD_9; + } + if(strcmp(key_string,"MLV_KEYBOARD_COLON") == 0){ + return MLV_KEYBOARD_COLON; + } + if(strcmp(key_string,"MLV_KEYBOARD_SEMICOLON") == 0){ + return MLV_KEYBOARD_SEMICOLON; + } + if(strcmp(key_string,"MLV_KEYBOARD_LESS") == 0){ + return MLV_KEYBOARD_LESS; + } + if(strcmp(key_string,"MLV_KEYBOARD_EQUALS") == 0){ + return MLV_KEYBOARD_EQUALS; + } + if(strcmp(key_string,"MLV_KEYBOARD_GREATER") == 0){ + return MLV_KEYBOARD_GREATER; + } + if(strcmp(key_string,"MLV_KEYBOARD_QUESTION") == 0){ + return MLV_KEYBOARD_QUESTION; + } + if(strcmp(key_string,"MLV_KEYBOARD_AT") == 0){ + return MLV_KEYBOARD_AT; + } + if(strcmp(key_string,"MLV_KEYBOARD_LEFTBRACKET") == 0){ + return MLV_KEYBOARD_LEFTBRACKET; + } + if(strcmp(key_string,"MLV_KEYBOARD_BACKSLASH") == 0){ + return MLV_KEYBOARD_BACKSLASH; + } + if(strcmp(key_string,"MLV_KEYBOARD_RIGHTBRACKET") == 0){ + return MLV_KEYBOARD_RIGHTBRACKET; + } + if(strcmp(key_string,"MLV_KEYBOARD_CARET") == 0){ + return MLV_KEYBOARD_CARET; + } + if(strcmp(key_string,"MLV_KEYBOARD_UNDERSCORE") == 0){ + return MLV_KEYBOARD_UNDERSCORE; + } + if(strcmp(key_string,"MLV_KEYBOARD_BACKQUOTE") == 0){ + return MLV_KEYBOARD_BACKQUOTE; + } + if(strcmp(key_string,"MLV_KEYBOARD_a") == 0){ + return MLV_KEYBOARD_a; + } + if(strcmp(key_string,"MLV_KEYBOARD_b") == 0){ + return MLV_KEYBOARD_b; + } + if(strcmp(key_string,"MLV_KEYBOARD_c") == 0){ + return MLV_KEYBOARD_c; + } + if(strcmp(key_string,"MLV_KEYBOARD_d") == 0){ + return MLV_KEYBOARD_d; + } + if(strcmp(key_string,"MLV_KEYBOARD_e") == 0){ + return MLV_KEYBOARD_e; + } + if(strcmp(key_string,"MLV_KEYBOARD_f") == 0){ + return MLV_KEYBOARD_f; + } + if(strcmp(key_string,"MLV_KEYBOARD_g") == 0){ + return MLV_KEYBOARD_g; + } + if(strcmp(key_string,"MLV_KEYBOARD_h") == 0){ + return MLV_KEYBOARD_h; + } + if(strcmp(key_string,"MLV_KEYBOARD_i") == 0){ + return MLV_KEYBOARD_i; + } + if(strcmp(key_string,"MLV_KEYBOARD_j") == 0){ + return MLV_KEYBOARD_j; + } + if(strcmp(key_string,"MLV_KEYBOARD_k") == 0){ + return MLV_KEYBOARD_k; + } + if(strcmp(key_string,"MLV_KEYBOARD_l") == 0){ + return MLV_KEYBOARD_l; + } + if(strcmp(key_string,"MLV_KEYBOARD_m") == 0){ + return MLV_KEYBOARD_m; + } + if(strcmp(key_string,"MLV_KEYBOARD_n") == 0){ + return MLV_KEYBOARD_n; + } + if(strcmp(key_string,"MLV_KEYBOARD_o") == 0){ + return MLV_KEYBOARD_o; + } + if(strcmp(key_string,"MLV_KEYBOARD_p") == 0){ + return MLV_KEYBOARD_p; + } + if(strcmp(key_string,"MLV_KEYBOARD_q") == 0){ + return MLV_KEYBOARD_q; + } + if(strcmp(key_string,"MLV_KEYBOARD_r") == 0){ + return MLV_KEYBOARD_r; + } + if(strcmp(key_string,"MLV_KEYBOARD_s") == 0){ + return MLV_KEYBOARD_s; + } + if(strcmp(key_string,"MLV_KEYBOARD_t") == 0){ + return MLV_KEYBOARD_t; + } + if(strcmp(key_string,"MLV_KEYBOARD_u") == 0){ + return MLV_KEYBOARD_u; + } + if(strcmp(key_string,"MLV_KEYBOARD_v") == 0){ + return MLV_KEYBOARD_v; + } + if(strcmp(key_string,"MLV_KEYBOARD_w") == 0){ + return MLV_KEYBOARD_w; + } + if(strcmp(key_string,"MLV_KEYBOARD_x") == 0){ + return MLV_KEYBOARD_x; + } + if(strcmp(key_string,"MLV_KEYBOARD_y") == 0){ + return MLV_KEYBOARD_y; + } + if(strcmp(key_string,"MLV_KEYBOARD_z") == 0){ + return MLV_KEYBOARD_z; + } + if(strcmp(key_string,"MLV_KEYBOARD_DELETE") == 0){ + return MLV_KEYBOARD_DELETE; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_0") == 0){ + return MLV_KEYBOARD_WORLD_0; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_1") == 0){ + return MLV_KEYBOARD_WORLD_1; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_2") == 0){ + return MLV_KEYBOARD_WORLD_2; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_3") == 0){ + return MLV_KEYBOARD_WORLD_3; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_4") == 0){ + return MLV_KEYBOARD_WORLD_4; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_5") == 0){ + return MLV_KEYBOARD_WORLD_5; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_6") == 0){ + return MLV_KEYBOARD_WORLD_6; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_7") == 0){ + return MLV_KEYBOARD_WORLD_7; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_8") == 0){ + return MLV_KEYBOARD_WORLD_8; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_9") == 0){ + return MLV_KEYBOARD_WORLD_9; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_10") == 0){ + return MLV_KEYBOARD_WORLD_10; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_11") == 0){ + return MLV_KEYBOARD_WORLD_11; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_12") == 0){ + return MLV_KEYBOARD_WORLD_12; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_13") == 0){ + return MLV_KEYBOARD_WORLD_13; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_14") == 0){ + return MLV_KEYBOARD_WORLD_14; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_15") == 0){ + return MLV_KEYBOARD_WORLD_15; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_16") == 0){ + return MLV_KEYBOARD_WORLD_16; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_17") == 0){ + return MLV_KEYBOARD_WORLD_17; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_18") == 0){ + return MLV_KEYBOARD_WORLD_18; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_19") == 0){ + return MLV_KEYBOARD_WORLD_19; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_20") == 0){ + return MLV_KEYBOARD_WORLD_20; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_21") == 0){ + return MLV_KEYBOARD_WORLD_21; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_22") == 0){ + return MLV_KEYBOARD_WORLD_22; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_23") == 0){ + return MLV_KEYBOARD_WORLD_23; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_24") == 0){ + return MLV_KEYBOARD_WORLD_24; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_25") == 0){ + return MLV_KEYBOARD_WORLD_25; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_26") == 0){ + return MLV_KEYBOARD_WORLD_26; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_27") == 0){ + return MLV_KEYBOARD_WORLD_27; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_28") == 0){ + return MLV_KEYBOARD_WORLD_28; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_29") == 0){ + return MLV_KEYBOARD_WORLD_29; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_30") == 0){ + return MLV_KEYBOARD_WORLD_30; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_31") == 0){ + return MLV_KEYBOARD_WORLD_31; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_32") == 0){ + return MLV_KEYBOARD_WORLD_32; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_33") == 0){ + return MLV_KEYBOARD_WORLD_33; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_34") == 0){ + return MLV_KEYBOARD_WORLD_34; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_35") == 0){ + return MLV_KEYBOARD_WORLD_35; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_36") == 0){ + return MLV_KEYBOARD_WORLD_36; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_37") == 0){ + return MLV_KEYBOARD_WORLD_37; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_38") == 0){ + return MLV_KEYBOARD_WORLD_38; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_39") == 0){ + return MLV_KEYBOARD_WORLD_39; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_40") == 0){ + return MLV_KEYBOARD_WORLD_40; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_41") == 0){ + return MLV_KEYBOARD_WORLD_41; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_42") == 0){ + return MLV_KEYBOARD_WORLD_42; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_43") == 0){ + return MLV_KEYBOARD_WORLD_43; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_44") == 0){ + return MLV_KEYBOARD_WORLD_44; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_45") == 0){ + return MLV_KEYBOARD_WORLD_45; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_46") == 0){ + return MLV_KEYBOARD_WORLD_46; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_47") == 0){ + return MLV_KEYBOARD_WORLD_47; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_48") == 0){ + return MLV_KEYBOARD_WORLD_48; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_49") == 0){ + return MLV_KEYBOARD_WORLD_49; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_50") == 0){ + return MLV_KEYBOARD_WORLD_50; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_51") == 0){ + return MLV_KEYBOARD_WORLD_51; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_52") == 0){ + return MLV_KEYBOARD_WORLD_52; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_53") == 0){ + return MLV_KEYBOARD_WORLD_53; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_54") == 0){ + return MLV_KEYBOARD_WORLD_54; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_55") == 0){ + return MLV_KEYBOARD_WORLD_55; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_56") == 0){ + return MLV_KEYBOARD_WORLD_56; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_57") == 0){ + return MLV_KEYBOARD_WORLD_57; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_58") == 0){ + return MLV_KEYBOARD_WORLD_58; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_59") == 0){ + return MLV_KEYBOARD_WORLD_59; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_60") == 0){ + return MLV_KEYBOARD_WORLD_60; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_61") == 0){ + return MLV_KEYBOARD_WORLD_61; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_62") == 0){ + return MLV_KEYBOARD_WORLD_62; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_63") == 0){ + return MLV_KEYBOARD_WORLD_63; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_64") == 0){ + return MLV_KEYBOARD_WORLD_64; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_65") == 0){ + return MLV_KEYBOARD_WORLD_65; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_66") == 0){ + return MLV_KEYBOARD_WORLD_66; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_67") == 0){ + return MLV_KEYBOARD_WORLD_67; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_68") == 0){ + return MLV_KEYBOARD_WORLD_68; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_69") == 0){ + return MLV_KEYBOARD_WORLD_69; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_70") == 0){ + return MLV_KEYBOARD_WORLD_70; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_71") == 0){ + return MLV_KEYBOARD_WORLD_71; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_72") == 0){ + return MLV_KEYBOARD_WORLD_72; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_73") == 0){ + return MLV_KEYBOARD_WORLD_73; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_74") == 0){ + return MLV_KEYBOARD_WORLD_74; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_75") == 0){ + return MLV_KEYBOARD_WORLD_75; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_76") == 0){ + return MLV_KEYBOARD_WORLD_76; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_77") == 0){ + return MLV_KEYBOARD_WORLD_77; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_78") == 0){ + return MLV_KEYBOARD_WORLD_78; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_79") == 0){ + return MLV_KEYBOARD_WORLD_79; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_80") == 0){ + return MLV_KEYBOARD_WORLD_80; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_81") == 0){ + return MLV_KEYBOARD_WORLD_81; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_82") == 0){ + return MLV_KEYBOARD_WORLD_82; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_83") == 0){ + return MLV_KEYBOARD_WORLD_83; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_84") == 0){ + return MLV_KEYBOARD_WORLD_84; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_85") == 0){ + return MLV_KEYBOARD_WORLD_85; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_86") == 0){ + return MLV_KEYBOARD_WORLD_86; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_87") == 0){ + return MLV_KEYBOARD_WORLD_87; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_88") == 0){ + return MLV_KEYBOARD_WORLD_88; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_89") == 0){ + return MLV_KEYBOARD_WORLD_89; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_90") == 0){ + return MLV_KEYBOARD_WORLD_90; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_91") == 0){ + return MLV_KEYBOARD_WORLD_91; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_92") == 0){ + return MLV_KEYBOARD_WORLD_92; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_93") == 0){ + return MLV_KEYBOARD_WORLD_93; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_94") == 0){ + return MLV_KEYBOARD_WORLD_94; + } + + if(strcmp(key_string,"MLV_KEYBOARD_WORLD_95") == 0){ + return MLV_KEYBOARD_WORLD_95; + } + + if(strcmp(key_string,"MLV_KEYBOARD_KP0") == 0){ + return MLV_KEYBOARD_KP0; + } + if(strcmp(key_string,"MLV_KEYBOARD_KP1") == 0){ + return MLV_KEYBOARD_KP1; + } + if(strcmp(key_string,"MLV_KEYBOARD_KP2") == 0){ + return MLV_KEYBOARD_KP2; + } + if(strcmp(key_string,"MLV_KEYBOARD_KP3") == 0){ + return MLV_KEYBOARD_KP3; + } + if(strcmp(key_string,"MLV_KEYBOARD_KP4") == 0){ + return MLV_KEYBOARD_KP4; + } + if(strcmp(key_string,"MLV_KEYBOARD_KP5") == 0){ + return MLV_KEYBOARD_KP5; + } + if(strcmp(key_string,"MLV_KEYBOARD_KP6") == 0){ + return MLV_KEYBOARD_KP6; + } + if(strcmp(key_string,"MLV_KEYBOARD_KP7") == 0){ + return MLV_KEYBOARD_KP7; + } + if(strcmp(key_string,"MLV_KEYBOARD_KP8") == 0){ + return MLV_KEYBOARD_KP8; + } + if(strcmp(key_string,"MLV_KEYBOARD_KP9") == 0){ + return MLV_KEYBOARD_KP9; + } + if(strcmp(key_string,"MLV_KEYBOARD_KP_PERIOD") == 0){ + return MLV_KEYBOARD_KP_PERIOD; + } + if(strcmp(key_string,"MLV_KEYBOARD_KP_DIVIDE") == 0){ + return MLV_KEYBOARD_KP_DIVIDE; + } + if(strcmp(key_string,"MLV_KEYBOARD_KP_MULTIPLY") == 0){ + return MLV_KEYBOARD_KP_MULTIPLY; + } + if(strcmp(key_string,"MLV_KEYBOARD_KP_MINUS") == 0){ + return MLV_KEYBOARD_KP_MINUS; + } + if(strcmp(key_string,"MLV_KEYBOARD_KP_PLUS") == 0){ + return MLV_KEYBOARD_KP_PLUS; + } + if(strcmp(key_string,"MLV_KEYBOARD_KP_ENTER") == 0){ + return MLV_KEYBOARD_KP_ENTER; + } + if(strcmp(key_string,"MLV_KEYBOARD_KP_EQUALS") == 0){ + return MLV_KEYBOARD_KP_EQUALS; + } + if(strcmp(key_string,"MLV_KEYBOARD_UP") == 0){ + return MLV_KEYBOARD_UP; + } + if(strcmp(key_string,"MLV_KEYBOARD_DOWN") == 0){ + return MLV_KEYBOARD_DOWN; + } + if(strcmp(key_string,"MLV_KEYBOARD_RIGHT") == 0){ + return MLV_KEYBOARD_RIGHT; + } + if(strcmp(key_string,"MLV_KEYBOARD_LEFT") == 0){ + return MLV_KEYBOARD_LEFT; + } + if(strcmp(key_string,"MLV_KEYBOARD_INSERT") == 0){ + return MLV_KEYBOARD_INSERT; + } + if(strcmp(key_string,"MLV_KEYBOARD_HOME") == 0){ + return MLV_KEYBOARD_HOME; + } + if(strcmp(key_string,"MLV_KEYBOARD_END") == 0){ + return MLV_KEYBOARD_END; + } + if(strcmp(key_string,"MLV_KEYBOARD_PAGEUP") == 0){ + return MLV_KEYBOARD_PAGEUP; + } + if(strcmp(key_string,"MLV_KEYBOARD_PAGEDOWN") == 0){ + return MLV_KEYBOARD_PAGEDOWN; + } + if(strcmp(key_string,"MLV_KEYBOARD_F1") == 0){ + return MLV_KEYBOARD_F1; + } + if(strcmp(key_string,"MLV_KEYBOARD_F2") == 0){ + return MLV_KEYBOARD_F2; + } + if(strcmp(key_string,"MLV_KEYBOARD_F3") == 0){ + return MLV_KEYBOARD_F3; + } + if(strcmp(key_string,"MLV_KEYBOARD_F4") == 0){ + return MLV_KEYBOARD_F4; + } + if(strcmp(key_string,"MLV_KEYBOARD_F5") == 0){ + return MLV_KEYBOARD_F5; + } + if(strcmp(key_string,"MLV_KEYBOARD_F6") == 0){ + return MLV_KEYBOARD_F6; + } + if(strcmp(key_string,"MLV_KEYBOARD_F7") == 0){ + return MLV_KEYBOARD_F7; + } + if(strcmp(key_string,"MLV_KEYBOARD_F8") == 0){ + return MLV_KEYBOARD_F8; + } + if(strcmp(key_string,"MLV_KEYBOARD_F9") == 0){ + return MLV_KEYBOARD_F9; + } + if(strcmp(key_string,"MLV_KEYBOARD_F10") == 0){ + return MLV_KEYBOARD_F10; + } + if(strcmp(key_string,"MLV_KEYBOARD_F11") == 0){ + return MLV_KEYBOARD_F11; + } + if(strcmp(key_string,"MLV_KEYBOARD_F12") == 0){ + return MLV_KEYBOARD_F12; + } + if(strcmp(key_string,"MLV_KEYBOARD_F13") == 0){ + return MLV_KEYBOARD_F13; + } + if(strcmp(key_string,"MLV_KEYBOARD_F14") == 0){ + return MLV_KEYBOARD_F14; + } + if(strcmp(key_string,"MLV_KEYBOARD_F15") == 0){ + return MLV_KEYBOARD_F15; + } + if(strcmp(key_string,"MLV_KEYBOARD_NUMLOCK") == 0){ + return MLV_KEYBOARD_NUMLOCK; + } + if(strcmp(key_string,"MLV_KEYBOARD_CAPSLOCK") == 0){ + return MLV_KEYBOARD_CAPSLOCK; + } + if(strcmp(key_string,"MLV_KEYBOARD_SCROLLOCK") == 0){ + return MLV_KEYBOARD_SCROLLOCK; + } + if(strcmp(key_string,"MLV_KEYBOARD_RSHIFT") == 0){ + return MLV_KEYBOARD_RSHIFT; + } + if(strcmp(key_string,"MLV_KEYBOARD_LSHIFT") == 0){ + return MLV_KEYBOARD_LSHIFT; + } + if(strcmp(key_string,"MLV_KEYBOARD_RCTRL") == 0){ + return MLV_KEYBOARD_RCTRL; + } + if(strcmp(key_string,"MLV_KEYBOARD_LCTRL") == 0){ + return MLV_KEYBOARD_LCTRL; + } + if(strcmp(key_string,"MLV_KEYBOARD_RALT") == 0){ + return MLV_KEYBOARD_RALT; + } + if(strcmp(key_string,"MLV_KEYBOARD_LALT") == 0){ + return MLV_KEYBOARD_LALT; + } + if(strcmp(key_string,"MLV_KEYBOARD_RMETA") == 0){ + return MLV_KEYBOARD_RMETA; + } + if(strcmp(key_string,"MLV_KEYBOARD_LMETA") == 0){ + return MLV_KEYBOARD_LMETA; + } + if(strcmp(key_string,"MLV_KEYBOARD_LSUPER") == 0){ + return MLV_KEYBOARD_LSUPER; + } + if(strcmp(key_string,"MLV_KEYBOARD_RSUPER") == 0){ + return MLV_KEYBOARD_RSUPER; + } + if(strcmp(key_string,"MLV_KEYBOARD_MODE") == 0){ + return MLV_KEYBOARD_MODE; + } + if(strcmp(key_string,"MLV_KEYBOARD_COMPOSE") == 0){ + return MLV_KEYBOARD_COMPOSE; + } + if(strcmp(key_string,"MLV_KEYBOARD_HELP") == 0){ + return MLV_KEYBOARD_HELP; + } + if(strcmp(key_string,"MLV_KEYBOARD_PRINT") == 0){ + return MLV_KEYBOARD_PRINT; + } + if(strcmp(key_string,"MLV_KEYBOARD_SYSREQ") == 0){ + return MLV_KEYBOARD_SYSREQ; + } + if(strcmp(key_string,"MLV_KEYBOARD_BREAK") == 0){ + return MLV_KEYBOARD_BREAK; + } + if(strcmp(key_string,"MLV_KEYBOARD_MENU") == 0){ + return MLV_KEYBOARD_MENU; + } + if(strcmp(key_string,"MLV_KEYBOARD_POWER") == 0){ + return MLV_KEYBOARD_POWER; + } + if(strcmp(key_string,"MLV_KEYBOARD_EURO") == 0){ + return MLV_KEYBOARD_EURO; + } + if(strcmp(key_string,"MLV_KEYBOARD_UNDO") == 0){ + return MLV_KEYBOARD_UNDO; + } + if(strcmp(key_string,"MLV_KEYBOARD_LAST") == 0){ + return MLV_KEYBOARD_LAST; + } + ERROR( "Keyboard type unexpected" ); + return 0; +} + +const char* MLV_convert_keyboard_button_to_string( MLV_Keyboard_button key_code ){ + switch( key_code ){ + case MLV_KEYBOARD_UNKNOWN : + return "MLV_KEYBOARD_UNKNOWN"; + case MLV_KEYBOARD_BACKSPACE : + return "MLV_KEYBOARD_BACKSPACE"; + case MLV_KEYBOARD_TAB : + return "MLV_KEYBOARD_TAB"; + case MLV_KEYBOARD_CLEAR : + return "MLV_KEYBOARD_CLEAR"; + case MLV_KEYBOARD_RETURN : + return "MLV_KEYBOARD_RETURN"; + case MLV_KEYBOARD_PAUSE : + return "MLV_KEYBOARD_PAUSE"; + case MLV_KEYBOARD_ESCAPE : + return "MLV_KEYBOARD_ESCAPE"; + case MLV_KEYBOARD_SPACE : + return "MLV_KEYBOARD_SPACE"; + case MLV_KEYBOARD_EXCLAIM : + return "MLV_KEYBOARD_EXCLAIM"; + case MLV_KEYBOARD_QUOTEDBL : + return "MLV_KEYBOARD_QUOTEDBL"; + case MLV_KEYBOARD_HASH : + return "MLV_KEYBOARD_HASH"; + case MLV_KEYBOARD_DOLLAR : + return "MLV_KEYBOARD_DOLLAR"; + case MLV_KEYBOARD_AMPERSAND : + return "MLV_KEYBOARD_AMPERSAND"; + case MLV_KEYBOARD_QUOTE : + return "MLV_KEYBOARD_QUOTE"; + case MLV_KEYBOARD_LEFTPAREN : + return "MLV_KEYBOARD_LEFTPAREN"; + case MLV_KEYBOARD_RIGHTPAREN : + return "MLV_KEYBOARD_RIGHTPAREN"; + case MLV_KEYBOARD_ASTERISK : + return "MLV_KEYBOARD_ASTERISK"; + case MLV_KEYBOARD_PLUS : + return "MLV_KEYBOARD_PLUS"; + case MLV_KEYBOARD_COMMA : + return "MLV_KEYBOARD_COMMA"; + case MLV_KEYBOARD_MINUS : + return "MLV_KEYBOARD_MINUS"; + case MLV_KEYBOARD_PERIOD : + return "MLV_KEYBOARD_PERIOD"; + case MLV_KEYBOARD_SLASH : + return "MLV_KEYBOARD_SLASH"; + case MLV_KEYBOARD_0 : + return "MLV_KEYBOARD_0"; + case MLV_KEYBOARD_1 : + return "MLV_KEYBOARD_1"; + case MLV_KEYBOARD_2 : + return "MLV_KEYBOARD_2"; + case MLV_KEYBOARD_3 : + return "MLV_KEYBOARD_3"; + case MLV_KEYBOARD_4 : + return "MLV_KEYBOARD_4"; + case MLV_KEYBOARD_5 : + return "MLV_KEYBOARD_5"; + case MLV_KEYBOARD_6 : + return "MLV_KEYBOARD_6"; + case MLV_KEYBOARD_7 : + return "MLV_KEYBOARD_7"; + case MLV_KEYBOARD_8 : + return "MLV_KEYBOARD_8"; + case MLV_KEYBOARD_9 : + return "MLV_KEYBOARD_9"; + case MLV_KEYBOARD_COLON : + return "MLV_KEYBOARD_COLON"; + case MLV_KEYBOARD_SEMICOLON : + return "MLV_KEYBOARD_SEMICOLON"; + case MLV_KEYBOARD_LESS : + return "MLV_KEYBOARD_LESS"; + case MLV_KEYBOARD_EQUALS : + return "MLV_KEYBOARD_EQUALS"; + case MLV_KEYBOARD_GREATER : + return "MLV_KEYBOARD_GREATER"; + case MLV_KEYBOARD_QUESTION : + return "MLV_KEYBOARD_QUESTION"; + case MLV_KEYBOARD_AT : + return "MLV_KEYBOARD_AT"; + case MLV_KEYBOARD_LEFTBRACKET : + return "MLV_KEYBOARD_LEFTBRACKET"; + case MLV_KEYBOARD_BACKSLASH : + return "MLV_KEYBOARD_BACKSLASH"; + case MLV_KEYBOARD_RIGHTBRACKET : + return "MLV_KEYBOARD_RIGHTBRACKET"; + case MLV_KEYBOARD_CARET : + return "MLV_KEYBOARD_CARET"; + case MLV_KEYBOARD_UNDERSCORE : + return "MLV_KEYBOARD_UNDERSCORE"; + case MLV_KEYBOARD_BACKQUOTE : + return "MLV_KEYBOARD_BACKQUOTE"; + case MLV_KEYBOARD_a : + return "MLV_KEYBOARD_a"; + case MLV_KEYBOARD_b : + return "MLV_KEYBOARD_b"; + case MLV_KEYBOARD_c : + return "MLV_KEYBOARD_c"; + case MLV_KEYBOARD_d : + return "MLV_KEYBOARD_d"; + case MLV_KEYBOARD_e : + return "MLV_KEYBOARD_e"; + case MLV_KEYBOARD_f : + return "MLV_KEYBOARD_f"; + case MLV_KEYBOARD_g : + return "MLV_KEYBOARD_g"; + case MLV_KEYBOARD_h : + return "MLV_KEYBOARD_h"; + case MLV_KEYBOARD_i : + return "MLV_KEYBOARD_i"; + case MLV_KEYBOARD_j : + return "MLV_KEYBOARD_j"; + case MLV_KEYBOARD_k : + return "MLV_KEYBOARD_k"; + case MLV_KEYBOARD_l : + return "MLV_KEYBOARD_l"; + case MLV_KEYBOARD_m : + return "MLV_KEYBOARD_m"; + case MLV_KEYBOARD_n : + return "MLV_KEYBOARD_n"; + case MLV_KEYBOARD_o : + return "MLV_KEYBOARD_o"; + case MLV_KEYBOARD_p : + return "MLV_KEYBOARD_p"; + case MLV_KEYBOARD_q : + return "MLV_KEYBOARD_q"; + case MLV_KEYBOARD_r : + return "MLV_KEYBOARD_r"; + case MLV_KEYBOARD_s : + return "MLV_KEYBOARD_s"; + case MLV_KEYBOARD_t : + return "MLV_KEYBOARD_t"; + case MLV_KEYBOARD_u : + return "MLV_KEYBOARD_u"; + case MLV_KEYBOARD_v : + return "MLV_KEYBOARD_v"; + case MLV_KEYBOARD_w : + return "MLV_KEYBOARD_w"; + case MLV_KEYBOARD_x : + return "MLV_KEYBOARD_x"; + case MLV_KEYBOARD_y : + return "MLV_KEYBOARD_y"; + case MLV_KEYBOARD_z : + return "MLV_KEYBOARD_z"; + case MLV_KEYBOARD_DELETE : + return "MLV_KEYBOARD_DELETE"; + case MLV_KEYBOARD_WORLD_0 : + return "MLV_KEYBOARD_WORLD_0"; + case MLV_KEYBOARD_WORLD_1 : + return "MLV_KEYBOARD_WORLD_1"; + case MLV_KEYBOARD_WORLD_2 : + return "MLV_KEYBOARD_WORLD_2"; + case MLV_KEYBOARD_WORLD_3 : + return "MLV_KEYBOARD_WORLD_3"; + case MLV_KEYBOARD_WORLD_4 : + return "MLV_KEYBOARD_WORLD_4"; + case MLV_KEYBOARD_WORLD_5 : + return "MLV_KEYBOARD_WORLD_5"; + case MLV_KEYBOARD_WORLD_6 : + return "MLV_KEYBOARD_WORLD_6"; + case MLV_KEYBOARD_WORLD_7 : + return "MLV_KEYBOARD_WORLD_7"; + case MLV_KEYBOARD_WORLD_8 : + return "MLV_KEYBOARD_WORLD_8"; + case MLV_KEYBOARD_WORLD_9 : + return "MLV_KEYBOARD_WORLD_9"; + case MLV_KEYBOARD_WORLD_10 : + return "MLV_KEYBOARD_WORLD_10"; + case MLV_KEYBOARD_WORLD_11 : + return "MLV_KEYBOARD_WORLD_11"; + case MLV_KEYBOARD_WORLD_12 : + return "MLV_KEYBOARD_WORLD_12"; + case MLV_KEYBOARD_WORLD_13 : + return "MLV_KEYBOARD_WORLD_13"; + case MLV_KEYBOARD_WORLD_14 : + return "MLV_KEYBOARD_WORLD_14"; + case MLV_KEYBOARD_WORLD_15 : + return "MLV_KEYBOARD_WORLD_15"; + case MLV_KEYBOARD_WORLD_16 : + return "MLV_KEYBOARD_WORLD_16"; + case MLV_KEYBOARD_WORLD_17 : + return "MLV_KEYBOARD_WORLD_17"; + case MLV_KEYBOARD_WORLD_18 : + return "MLV_KEYBOARD_WORLD_18"; + case MLV_KEYBOARD_WORLD_19 : + return "MLV_KEYBOARD_WORLD_19"; + case MLV_KEYBOARD_WORLD_20 : + return "MLV_KEYBOARD_WORLD_20"; + case MLV_KEYBOARD_WORLD_21 : + return "MLV_KEYBOARD_WORLD_21"; + case MLV_KEYBOARD_WORLD_22 : + return "MLV_KEYBOARD_WORLD_22"; + case MLV_KEYBOARD_WORLD_23 : + return "MLV_KEYBOARD_WORLD_23"; + case MLV_KEYBOARD_WORLD_24 : + return "MLV_KEYBOARD_WORLD_24"; + case MLV_KEYBOARD_WORLD_25 : + return "MLV_KEYBOARD_WORLD_25"; + case MLV_KEYBOARD_WORLD_26 : + return "MLV_KEYBOARD_WORLD_26"; + case MLV_KEYBOARD_WORLD_27 : + return "MLV_KEYBOARD_WORLD_27"; + case MLV_KEYBOARD_WORLD_28 : + return "MLV_KEYBOARD_WORLD_28"; + case MLV_KEYBOARD_WORLD_29 : + return "MLV_KEYBOARD_WORLD_29"; + case MLV_KEYBOARD_WORLD_30 : + return "MLV_KEYBOARD_WORLD_30"; + case MLV_KEYBOARD_WORLD_31 : + return "MLV_KEYBOARD_WORLD_31"; + case MLV_KEYBOARD_WORLD_32 : + return "MLV_KEYBOARD_WORLD_32"; + case MLV_KEYBOARD_WORLD_33 : + return "MLV_KEYBOARD_WORLD_33"; + case MLV_KEYBOARD_WORLD_34 : + return "MLV_KEYBOARD_WORLD_34"; + case MLV_KEYBOARD_WORLD_35 : + return "MLV_KEYBOARD_WORLD_35"; + case MLV_KEYBOARD_WORLD_36 : + return "MLV_KEYBOARD_WORLD_36"; + case MLV_KEYBOARD_WORLD_37 : + return "MLV_KEYBOARD_WORLD_37"; + case MLV_KEYBOARD_WORLD_38 : + return "MLV_KEYBOARD_WORLD_38"; + case MLV_KEYBOARD_WORLD_39 : + return "MLV_KEYBOARD_WORLD_39"; + case MLV_KEYBOARD_WORLD_40 : + return "MLV_KEYBOARD_WORLD_40"; + case MLV_KEYBOARD_WORLD_41 : + return "MLV_KEYBOARD_WORLD_41"; + case MLV_KEYBOARD_WORLD_42 : + return "MLV_KEYBOARD_WORLD_42"; + case MLV_KEYBOARD_WORLD_43 : + return "MLV_KEYBOARD_WORLD_43"; + case MLV_KEYBOARD_WORLD_44 : + return "MLV_KEYBOARD_WORLD_44"; + case MLV_KEYBOARD_WORLD_45 : + return "MLV_KEYBOARD_WORLD_45"; + case MLV_KEYBOARD_WORLD_46 : + return "MLV_KEYBOARD_WORLD_46"; + case MLV_KEYBOARD_WORLD_47 : + return "MLV_KEYBOARD_WORLD_47"; + case MLV_KEYBOARD_WORLD_48 : + return "MLV_KEYBOARD_WORLD_48"; + case MLV_KEYBOARD_WORLD_49 : + return "MLV_KEYBOARD_WORLD_49"; + case MLV_KEYBOARD_WORLD_50 : + return "MLV_KEYBOARD_WORLD_50"; + case MLV_KEYBOARD_WORLD_51 : + return "MLV_KEYBOARD_WORLD_51"; + case MLV_KEYBOARD_WORLD_52 : + return "MLV_KEYBOARD_WORLD_52"; + case MLV_KEYBOARD_WORLD_53 : + return "MLV_KEYBOARD_WORLD_53"; + case MLV_KEYBOARD_WORLD_54 : + return "MLV_KEYBOARD_WORLD_54"; + case MLV_KEYBOARD_WORLD_55 : + return "MLV_KEYBOARD_WORLD_55"; + case MLV_KEYBOARD_WORLD_56 : + return "MLV_KEYBOARD_WORLD_56"; + case MLV_KEYBOARD_WORLD_57 : + return "MLV_KEYBOARD_WORLD_57"; + case MLV_KEYBOARD_WORLD_58 : + return "MLV_KEYBOARD_WORLD_58"; + case MLV_KEYBOARD_WORLD_59 : + return "MLV_KEYBOARD_WORLD_59"; + case MLV_KEYBOARD_WORLD_60 : + return "MLV_KEYBOARD_WORLD_60"; + case MLV_KEYBOARD_WORLD_61 : + return "MLV_KEYBOARD_WORLD_61"; + case MLV_KEYBOARD_WORLD_62 : + return "MLV_KEYBOARD_WORLD_62"; + case MLV_KEYBOARD_WORLD_63 : + return "MLV_KEYBOARD_WORLD_63"; + case MLV_KEYBOARD_WORLD_64 : + return "MLV_KEYBOARD_WORLD_64"; + case MLV_KEYBOARD_WORLD_65 : + return "MLV_KEYBOARD_WORLD_65"; + case MLV_KEYBOARD_WORLD_66 : + return "MLV_KEYBOARD_WORLD_66"; + case MLV_KEYBOARD_WORLD_67 : + return "MLV_KEYBOARD_WORLD_67"; + case MLV_KEYBOARD_WORLD_68 : + return "MLV_KEYBOARD_WORLD_68"; + case MLV_KEYBOARD_WORLD_69 : + return "MLV_KEYBOARD_WORLD_69"; + case MLV_KEYBOARD_WORLD_70 : + return "MLV_KEYBOARD_WORLD_70"; + case MLV_KEYBOARD_WORLD_71 : + return "MLV_KEYBOARD_WORLD_71"; + case MLV_KEYBOARD_WORLD_72 : + return "MLV_KEYBOARD_WORLD_72"; + case MLV_KEYBOARD_WORLD_73 : + return "MLV_KEYBOARD_WORLD_73"; + case MLV_KEYBOARD_WORLD_74 : + return "MLV_KEYBOARD_WORLD_74"; + case MLV_KEYBOARD_WORLD_75 : + return "MLV_KEYBOARD_WORLD_75"; + case MLV_KEYBOARD_WORLD_76 : + return "MLV_KEYBOARD_WORLD_76"; + case MLV_KEYBOARD_WORLD_77 : + return "MLV_KEYBOARD_WORLD_77"; + case MLV_KEYBOARD_WORLD_78 : + return "MLV_KEYBOARD_WORLD_78"; + case MLV_KEYBOARD_WORLD_79 : + return "MLV_KEYBOARD_WORLD_79"; + case MLV_KEYBOARD_WORLD_80 : + return "MLV_KEYBOARD_WORLD_80"; + case MLV_KEYBOARD_WORLD_81 : + return "MLV_KEYBOARD_WORLD_81"; + case MLV_KEYBOARD_WORLD_82 : + return "MLV_KEYBOARD_WORLD_82"; + case MLV_KEYBOARD_WORLD_83 : + return "MLV_KEYBOARD_WORLD_83"; + case MLV_KEYBOARD_WORLD_84 : + return "MLV_KEYBOARD_WORLD_84"; + case MLV_KEYBOARD_WORLD_85 : + return "MLV_KEYBOARD_WORLD_85"; + case MLV_KEYBOARD_WORLD_86 : + return "MLV_KEYBOARD_WORLD_86"; + case MLV_KEYBOARD_WORLD_87 : + return "MLV_KEYBOARD_WORLD_87"; + case MLV_KEYBOARD_WORLD_88 : + return "MLV_KEYBOARD_WORLD_88"; + case MLV_KEYBOARD_WORLD_89 : + return "MLV_KEYBOARD_WORLD_89"; + case MLV_KEYBOARD_WORLD_90 : + return "MLV_KEYBOARD_WORLD_90"; + case MLV_KEYBOARD_WORLD_91 : + return "MLV_KEYBOARD_WORLD_91"; + case MLV_KEYBOARD_WORLD_92 : + return "MLV_KEYBOARD_WORLD_92"; + case MLV_KEYBOARD_WORLD_93 : + return "MLV_KEYBOARD_WORLD_93"; + case MLV_KEYBOARD_WORLD_94 : + return "MLV_KEYBOARD_WORLD_94"; + case MLV_KEYBOARD_WORLD_95 : + return "MLV_KEYBOARD_WORLD_95"; + case MLV_KEYBOARD_KP0 : + return "MLV_KEYBOARD_KP0"; + case MLV_KEYBOARD_KP1 : + return "MLV_KEYBOARD_KP1"; + case MLV_KEYBOARD_KP2 : + return "MLV_KEYBOARD_KP2"; + case MLV_KEYBOARD_KP3 : + return "MLV_KEYBOARD_KP3"; + case MLV_KEYBOARD_KP4 : + return "MLV_KEYBOARD_KP4"; + case MLV_KEYBOARD_KP5 : + return "MLV_KEYBOARD_KP5"; + case MLV_KEYBOARD_KP6 : + return "MLV_KEYBOARD_KP6"; + case MLV_KEYBOARD_KP7 : + return "MLV_KEYBOARD_KP7"; + case MLV_KEYBOARD_KP8 : + return "MLV_KEYBOARD_KP8"; + case MLV_KEYBOARD_KP9 : + return "MLV_KEYBOARD_KP9"; + case MLV_KEYBOARD_KP_PERIOD : + return "MLV_KEYBOARD_KP_PERIOD"; + case MLV_KEYBOARD_KP_DIVIDE : + return "MLV_KEYBOARD_KP_DIVIDE"; + case MLV_KEYBOARD_KP_MULTIPLY : + return "MLV_KEYBOARD_KP_MULTIPLY"; + case MLV_KEYBOARD_KP_MINUS : + return "MLV_KEYBOARD_KP_MINUS"; + case MLV_KEYBOARD_KP_PLUS : + return "MLV_KEYBOARD_KP_PLUS"; + case MLV_KEYBOARD_KP_ENTER : + return "MLV_KEYBOARD_KP_ENTER"; + case MLV_KEYBOARD_KP_EQUALS : + return "MLV_KEYBOARD_KP_EQUALS"; + case MLV_KEYBOARD_UP : + return "MLV_KEYBOARD_UP"; + case MLV_KEYBOARD_DOWN : + return "MLV_KEYBOARD_DOWN"; + case MLV_KEYBOARD_RIGHT : + return "MLV_KEYBOARD_RIGHT"; + case MLV_KEYBOARD_LEFT : + return "MLV_KEYBOARD_LEFT"; + case MLV_KEYBOARD_INSERT : + return "MLV_KEYBOARD_INSERT"; + case MLV_KEYBOARD_HOME : + return "MLV_KEYBOARD_HOME"; + case MLV_KEYBOARD_END : + return "MLV_KEYBOARD_END"; + case MLV_KEYBOARD_PAGEUP : + return "MLV_KEYBOARD_PAGEUP"; + case MLV_KEYBOARD_PAGEDOWN : + return "MLV_KEYBOARD_PAGEDOWN"; + case MLV_KEYBOARD_F1 : + return "MLV_KEYBOARD_F1"; + case MLV_KEYBOARD_F2 : + return "MLV_KEYBOARD_F2"; + case MLV_KEYBOARD_F3 : + return "MLV_KEYBOARD_F3"; + case MLV_KEYBOARD_F4 : + return "MLV_KEYBOARD_F4"; + case MLV_KEYBOARD_F5 : + return "MLV_KEYBOARD_F5"; + case MLV_KEYBOARD_F6 : + return "MLV_KEYBOARD_F6"; + case MLV_KEYBOARD_F7 : + return "MLV_KEYBOARD_F7"; + case MLV_KEYBOARD_F8 : + return "MLV_KEYBOARD_F8"; + case MLV_KEYBOARD_F9 : + return "MLV_KEYBOARD_F9"; + case MLV_KEYBOARD_F10 : + return "MLV_KEYBOARD_F10"; + case MLV_KEYBOARD_F11 : + return "MLV_KEYBOARD_F11"; + case MLV_KEYBOARD_F12 : + return "MLV_KEYBOARD_F12"; + case MLV_KEYBOARD_F13 : + return "MLV_KEYBOARD_F13"; + case MLV_KEYBOARD_F14 : + return "MLV_KEYBOARD_F14"; + case MLV_KEYBOARD_F15 : + return "MLV_KEYBOARD_F15"; + case MLV_KEYBOARD_NUMLOCK : + return "MLV_KEYBOARD_NUMLOCK"; + case MLV_KEYBOARD_CAPSLOCK : + return "MLV_KEYBOARD_CAPSLOCK"; + case MLV_KEYBOARD_SCROLLOCK : + return "MLV_KEYBOARD_SCROLLOCK"; + case MLV_KEYBOARD_RSHIFT : + return "MLV_KEYBOARD_RSHIFT"; + case MLV_KEYBOARD_LSHIFT : + return "MLV_KEYBOARD_LSHIFT"; + case MLV_KEYBOARD_RCTRL : + return "MLV_KEYBOARD_RCTRL"; + case MLV_KEYBOARD_LCTRL : + return "MLV_KEYBOARD_LCTRL"; + case MLV_KEYBOARD_RALT : + return "MLV_KEYBOARD_RALT"; + case MLV_KEYBOARD_LALT : + return "MLV_KEYBOARD_LALT"; + case MLV_KEYBOARD_RMETA : + return "MLV_KEYBOARD_RMETA"; + case MLV_KEYBOARD_LMETA : + return "MLV_KEYBOARD_LMETA"; + case MLV_KEYBOARD_LSUPER : + return "MLV_KEYBOARD_LSUPER"; + case MLV_KEYBOARD_RSUPER : + return "MLV_KEYBOARD_RSUPER"; + case MLV_KEYBOARD_MODE : + return "MLV_KEYBOARD_MODE"; + case MLV_KEYBOARD_COMPOSE : + return "MLV_KEYBOARD_COMPOSE"; + case MLV_KEYBOARD_HELP : + return "MLV_KEYBOARD_HELP"; + case MLV_KEYBOARD_PRINT : + return "MLV_KEYBOARD_PRINT"; + case MLV_KEYBOARD_SYSREQ : + return "MLV_KEYBOARD_SYSREQ"; + case MLV_KEYBOARD_BREAK : + return "MLV_KEYBOARD_BREAK"; + case MLV_KEYBOARD_MENU : + return "MLV_KEYBOARD_MENU"; + case MLV_KEYBOARD_POWER : + return "MLV_KEYBOARD_POWER"; + case MLV_KEYBOARD_EURO : + return "MLV_KEYBOARD_EURO"; + case MLV_KEYBOARD_UNDO : + return "MLV_KEYBOARD_UNDO"; + case MLV_KEYBOARD_LAST : + return "MLV_KEYBOARD_LAST"; + default : + ERROR("Keyboard code unexpected"); + } +} + +char* MLV_convert_keyboard_mod_to_string( MLV_Keyboard_modifier keymod_code ){ + int text_size = 0; + char* text; + char* result; + int nb = 0; + + if( keymod_code == MLV_KEYBOARD_KMOD_NONE ){ + text = "MLV_KEYBOARD_KMOD_NONE"; + result = MLV_MALLOC( strlen(text)+1, char ); + sprintf( result, "%s", text ); + return result; + } + + if( keymod_code & MLV_KEYBOARD_KMOD_NONE ){ + if( nb>0 ){ + text_size += 3; + } + text_size += strlen( "MLV_KEYBOARD_KMOD_NONE" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_LSHIFT ){ + if( nb>0 ){ + text_size += 3; + } + text_size += strlen( "MLV_KEYBOARD_KMOD_LSHIFT" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_RSHIFT ){ + if( nb>0 ){ + text_size += 3; + } + text_size += strlen( "MLV_KEYBOARD_KMOD_RSHIFT" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_LCTRL ){ + if( nb>0 ){ + text_size += 3; + } + text_size += strlen( "MLV_KEYBOARD_KMOD_LCTRL" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_RCTRL ){ + if( nb>0 ){ + text_size += 3; + } + text_size += strlen( "MLV_KEYBOARD_KMOD_RCTRL" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_LALT ){ + if( nb>0 ){ + text_size += 3; + } + text_size += strlen( "MLV_KEYBOARD_KMOD_LALT" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_RALT ){ + if( nb>0 ){ + text_size += 3; + } + text_size += strlen( "MLV_KEYBOARD_KMOD_RALT" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_LMETA ){ + if( nb>0 ){ + text_size += 3; + } + text_size += strlen( "MLV_KEYBOARD_KMOD_LMETA" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_RMETA ){ + if( nb>0 ){ + text_size += 3; + } + text_size += strlen( "MLV_KEYBOARD_KMOD_RMETA" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_NUM ){ + if( nb>0 ){ + text_size += 3; + } + text_size += strlen( "MLV_KEYBOARD_KMOD_NUM" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_CAPS ){ + if( nb>0 ){ + text_size += 3; + } + text_size += strlen( "MLV_KEYBOARD_KMOD_CAPS" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_MODE ){ + if( nb>0 ){ + text_size += 3; + } + text_size += strlen( "MLV_KEYBOARD_KMOD_MODE" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_RESERVED ){ + if( nb>0 ){ + text_size += 3; + } + text_size += strlen( "MLV_KEYBOARD_KMOD_RESERVED" ); + nb += 1; + } + + text = MLV_MALLOC( text_size+1, char ); + text[text_size] = '\0'; + result = text; + + nb = 0; + if( keymod_code & MLV_KEYBOARD_KMOD_NONE ){ + if( nb>0 ){ + text += sprintf( text, " | " ); + } + text += sprintf( text, "MLV_KEYBOARD_KMOD_NONE" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_LSHIFT ){ + if( nb>0 ){ + text += sprintf( text, " | " ); + } + text += sprintf( text, "MLV_KEYBOARD_KMOD_LSHIFT" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_RSHIFT ){ + if( nb>0 ){ + text += sprintf( text, " | " ); + } + text += sprintf( text, "MLV_KEYBOARD_KMOD_RSHIFT" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_LCTRL ){ + if( nb>0 ){ + text += sprintf( text, " | " ); + } + text += sprintf( text, "MLV_KEYBOARD_KMOD_LCTRL" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_RCTRL ){ + if( nb>0 ){ + text += sprintf( text, " | " ); + } + text += sprintf( text, "MLV_KEYBOARD_KMOD_RCTRL" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_LALT ){ + if( nb>0 ){ + text += sprintf( text, " | " ); + } + text += sprintf( text, "MLV_KEYBOARD_KMOD_LALT" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_RALT ){ + if( nb>0 ){ + text += sprintf( text, " | " ); + } + text += sprintf( text, "MLV_KEYBOARD_KMOD_RALT" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_LMETA ){ + if( nb>0 ){ + text += sprintf( text, " | " ); + } + text += sprintf( text, "MLV_KEYBOARD_KMOD_LMETA" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_RMETA ){ + if( nb>0 ){ + text += sprintf( text, " | " ); + } + text += sprintf( text, "MLV_KEYBOARD_KMOD_RMETA" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_NUM ){ + if( nb>0 ){ + text += sprintf( text, " | " ); + } + text += sprintf( text, "MLV_KEYBOARD_KMOD_NUM" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_CAPS ){ + if( nb>0 ){ + text += sprintf( text, " | " ); + } + text += sprintf( text, "MLV_KEYBOARD_KMOD_CAPS" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_MODE ){ + if( nb>0 ){ + text += sprintf( text, " | " ); + } + text += sprintf( text, "MLV_KEYBOARD_KMOD_MODE" ); + nb += 1; + } + if( keymod_code & MLV_KEYBOARD_KMOD_RESERVED ){ + if( nb>0 ){ + text += sprintf( text, " | " ); + } + text += sprintf( text, "MLV_KEYBOARD_KMOD_RESERVED" ); + nb += 1; + } + return result; +} + + +MLV_Button_state MLV_get_keyboard_state( MLV_Keyboard_button keyboard_code ){ + SDL_PumpEvents(); + Uint8* keyboard_states = SDL_GetKeyState( NULL ); + if( keyboard_states[ keyboard_code ] ) return MLV_PRESSED; + return MLV_RELEASED; +} + +int MLV_left_shift_key_was_pressed( + MLV_Keyboard_modifier modifier_code +){ + return modifier_code & MLV_KEYBOARD_KMOD_LSHIFT; +} + +int MLV_right_shift_key_was_pressed( + MLV_Keyboard_modifier modifier_code +){ + return modifier_code & MLV_KEYBOARD_KMOD_RSHIFT; +} + +int MLV_shift_key_was_pressed( + MLV_Keyboard_modifier modifier_code +){ + return modifier_code & ( MLV_KEYBOARD_KMOD_LSHIFT | MLV_KEYBOARD_KMOD_RSHIFT ); +} + +int MLV_left_ctrl_key_was_pressed( + MLV_Keyboard_modifier modifier_code +){ + return modifier_code & MLV_KEYBOARD_KMOD_LCTRL; +} + +int MLV_right_ctrl_key_was_pressed( + MLV_Keyboard_modifier modifier_code +){ + return modifier_code & MLV_KEYBOARD_KMOD_RCTRL; +} + +int MLV_ctrl_key_was_pressed( + MLV_Keyboard_modifier modifier_code +){ + return modifier_code & ( MLV_KEYBOARD_KMOD_LCTRL | MLV_KEYBOARD_KMOD_RCTRL ); +} + +int MLV_left_alt_key_was_pressed( + MLV_Keyboard_modifier modifier_code +){ + return modifier_code & MLV_KEYBOARD_KMOD_LALT; +} + +int MLV_right_alt_key_was_pressed( + MLV_Keyboard_modifier modifier_code +){ + return modifier_code & MLV_KEYBOARD_KMOD_RALT; +} + +int MLV_alt_key_was_pressed( + MLV_Keyboard_modifier modifier_code +){ + return modifier_code & ( MLV_KEYBOARD_KMOD_LALT | MLV_KEYBOARD_KMOD_RALT ); +} + +int MLV_left_meta_key_was_pressed( + MLV_Keyboard_modifier modifier_code +){ + return modifier_code & MLV_KEYBOARD_KMOD_LMETA; +} + +int MLV_right_meta_key_was_pressed( + MLV_Keyboard_modifier modifier_code +){ + return modifier_code & MLV_KEYBOARD_KMOD_RMETA; +} + +int MLV_meta_key_was_pressed( + MLV_Keyboard_modifier modifier_code +){ + return modifier_code & ( MLV_KEYBOARD_KMOD_LMETA | MLV_KEYBOARD_KMOD_RMETA ); +} + +int MLV_num_key_was_pressed( + MLV_Keyboard_modifier modifier_code +){ + return modifier_code & MLV_KEYBOARD_KMOD_NUM; +} + +int MLV_caps_key_was_pressed( + MLV_Keyboard_modifier modifier_code +){ + return modifier_code & MLV_KEYBOARD_KMOD_CAPS; +} + +int MLV_mode_key_was_pressed( + MLV_Keyboard_modifier modifier_code +){ + return modifier_code & MLV_KEYBOARD_KMOD_MODE; +} + + diff --git a/MLV/list.c b/MLV/list.c new file mode 100644 index 0000000..a8468ea --- /dev/null +++ b/MLV/list.c @@ -0,0 +1,79 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "list.h" +#include "memory_management.h" + +MLV_List* MLV_prepend_list( MLV_List* list, void* data ){ + MLV_List* result = MLV_MALLOC( 1, MLV_List ); + if( list ){ + list->previous = result; + } + result->previous = NULL; + result->next = list; + result->data = data; + return result; +} + +void MLV_free_list( MLV_List* list ){ + if( list ){ + MLV_free_list( list->next ); + MLV_FREE( list, MLV_List ); + } +} + +void MLV_foreach_list( + MLV_List* list, + void (* function )( void* data, void* user_data ), + void* user_data +){ + while( list ){ + function( list->data, user_data ); + list = list->next; + } +} + +MLV_List* MLV_find_list( MLV_List* list, void* data ){ + while( list ){ + if( list->data == data ){ + break; + } + list = list->next; + } + return list; +} + +MLV_List* MLV_remove_list( MLV_List* list, void* data ){ + MLV_List* result; + MLV_List* elem = MLV_find_list( list, data ); + if( elem->previous ){ + elem->previous->next = elem->next; + } + if( elem->next ){ + elem->next->previous = elem->previous; + } + if( elem==list ){ + result = elem->next; + }else{ + result = list; + } + return result; +} + diff --git a/MLV/list.h b/MLV/list.h new file mode 100644 index 0000000..3aa9b94 --- /dev/null +++ b/MLV/list.h @@ -0,0 +1,46 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#ifndef __MLV__LIST_H__ +#define __MLV__LIST_H__ + +typedef struct _MLV_List MLV_List; + +struct _MLV_List { + MLV_List* previous; + MLV_List* next; + void* data; +}; + +MLV_List* MLV_prepend_list( MLV_List* list, void* data ); + +void MLV_free_list( MLV_List* list ); + +void MLV_foreach_list( + MLV_List* list, + void (* function )( void* data, void* user_data ), + void* user_data +); + +MLV_List* MLV_find_list( MLV_List* list, void* data ); + +MLV_List* MLV_remove_list( MLV_List* list, void* data ); + +#endif diff --git a/MLV/mathematics.c b/MLV/mathematics.c new file mode 100644 index 0000000..48844b5 --- /dev/null +++ b/MLV/mathematics.c @@ -0,0 +1,26 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "mathematics.h" + +int max( int a, int b ){ + return (a>b)?a:b; +} + diff --git a/MLV/mathematics.h b/MLV/mathematics.h new file mode 100644 index 0000000..85b4af4 --- /dev/null +++ b/MLV/mathematics.h @@ -0,0 +1,27 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#ifndef __MLV__MATHEMATICS_H__ +#define __MLV__MATHEMATICS_H__ + +int max( int a, int b ); + +#endif + diff --git a/MLV/memory_debug.c b/MLV/memory_debug.c new file mode 100644 index 0000000..fbd18d5 --- /dev/null +++ b/MLV/memory_debug.c @@ -0,0 +1,575 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "memory_debug.h" + +#include +#include + +#define DEBUG_MEMORY_MSG(x) { fprintf(stderr,"Memory Debug : %s \n",(x)); } + +#include "memory_management.h" + +int memory_debug_n; +SDL_EventFilter memory_debug_filter; +SDL_Event memory_debug_event; + +Memory_debug_statistics memory_debug_statistics; + +void init_memory_debug(){ + memory_debug_statistics.nb_create_surface = 0; + memory_debug_statistics.nb_free_surface = 0; + memory_debug_statistics.nb_init_sdl = 0; + memory_debug_statistics.nb_close_sdl = 0; + memory_debug_statistics.nb_create_semaphore = 0; + memory_debug_statistics.nb_free_semaphore = 0; + memory_debug_statistics.nb_malloc = 0; + memory_debug_statistics.nb_free = 0; + memory_debug_statistics.nb_free_wave = 0; + memory_debug_statistics.nb_load_wave = 0; + memory_debug_statistics.nb_open_font = 0; + memory_debug_statistics.nb_close_font = 0; + memory_debug_statistics.nb_init_ttf = 0; + memory_debug_statistics.nb_quit_ttf = 0; +} + +void print_memory_statistics(){ + fprintf(stderr,"--------------------------STATISTICS---------------------\n"); + fprintf(stderr,"Memory Debug : nb_create_surface : %i \n", memory_debug_statistics.nb_create_surface); + fprintf(stderr,"Memory Debug : nb_free_surface : %i \n", memory_debug_statistics.nb_free_surface); + fprintf(stderr,"Memory Debug : nb_init_sdl : %i \n", memory_debug_statistics.nb_init_sdl); + fprintf(stderr,"Memory Debug : nb_close_sdl : %i \n", memory_debug_statistics.nb_close_sdl); + fprintf(stderr,"Memory Debug : nb_create_semaphore : %i \n", memory_debug_statistics.nb_create_semaphore); + fprintf(stderr,"Memory Debug : nb_free_semaphore : %i \n", memory_debug_statistics.nb_free_semaphore); + fprintf(stderr,"Memory Debug : nb_malloc : %i \n", memory_debug_statistics.nb_malloc); + fprintf(stderr,"Memory Debug : nb_calloc : %i \n", memory_debug_statistics.nb_calloc); + fprintf(stderr,"Memory Debug : nb_free : %i \n", memory_debug_statistics.nb_free); + fprintf(stderr,"Memory Debug : nb_free_wave : %i \n", memory_debug_statistics.nb_free_wave); + fprintf(stderr,"Memory Debug : nb_load_wave : %i \n", memory_debug_statistics.nb_load_wave); + fprintf(stderr,"Memory Debug : nb_open_font : %i \n", memory_debug_statistics.nb_open_font); + fprintf(stderr,"Memory Debug : nb_close_font : %i \n", memory_debug_statistics.nb_close_font); + fprintf(stderr,"Memory Debug : nb_init_ttf : %i \n", memory_debug_statistics.nb_init_ttf); + fprintf(stderr,"Memory Debug : nb_quit_ttf : %i \n", memory_debug_statistics.nb_quit_ttf); + fprintf(stderr,"----------------------END-STATISTICS---------------------\n"); +} + +typedef enum { + MEMORY_DEBUG_CREATE_SURFACE, + MEMORY_DEBUG_FREE_SURFACE, + MEMORY_DEBUG_INIT_SDL, + MEMORY_DEBUG_CLOSE_SDL, + MEMORY_DEBUG_CREATE_SEMAPHORE, + MEMORY_DEBUG_FREE_SEMAPHORE, + MEMORY_DEBUG_MALLOC, + MEMORY_DEBUG_CALLOC, + MEMORY_DEBUG_FREE, + MEMORY_DEBUG_FREE_WAVE, + MEMORY_DEBUG_LOAD_WAVE, + MEMORY_DEBUG_OPEN_FONT, + MEMORY_DEBUG_CLOSE_FONT, + MEMORY_DEBUG_QUIT_TTF, + MEMORY_DEBUG_INIT_TTF +} Memory_debug_statistics_type; + +void update_memory_statistics( Memory_debug_statistics_type type ){ + switch( type ){ + case MEMORY_DEBUG_CREATE_SURFACE : + { + memory_debug_statistics.nb_create_surface++; + } + break; + case MEMORY_DEBUG_FREE_SURFACE : + { + memory_debug_statistics.nb_free_surface++; + } + break; + case MEMORY_DEBUG_INIT_SDL : + { + memory_debug_statistics.nb_init_sdl++; + } + break; + case MEMORY_DEBUG_CLOSE_SDL : + { + memory_debug_statistics.nb_close_sdl++; + } + break; + case MEMORY_DEBUG_CREATE_SEMAPHORE : + { + memory_debug_statistics.nb_create_semaphore++; + } + break; + case MEMORY_DEBUG_FREE_SEMAPHORE : + { + memory_debug_statistics.nb_free_semaphore ++; + } + break; + case MEMORY_DEBUG_MALLOC : + { + memory_debug_statistics.nb_malloc ++; + } + break; + case MEMORY_DEBUG_CALLOC : + { + memory_debug_statistics.nb_calloc ++; + } + break; + case MEMORY_DEBUG_FREE : + { + memory_debug_statistics.nb_free ++; + } + break; + case MEMORY_DEBUG_FREE_WAVE : + { + memory_debug_statistics.nb_free_wave ++; + } + break; + case MEMORY_DEBUG_LOAD_WAVE : + { + memory_debug_statistics.nb_load_wave ++; + } + break; + case MEMORY_DEBUG_OPEN_FONT : + { + memory_debug_statistics.nb_open_font ++; + } + break; + case MEMORY_DEBUG_CLOSE_FONT : + { + memory_debug_statistics.nb_close_font ++; + } + break; + case MEMORY_DEBUG_QUIT_TTF : + { + memory_debug_statistics.nb_quit_ttf ++; + } + break; + case MEMORY_DEBUG_INIT_TTF : + { + memory_debug_statistics.nb_init_ttf ++; + } + break; + default:; + } +} + +void close_memory_debug(){ +} + +void filledCircleColor( SDL_Surface* screen, int x, int y, int radius, Uint32 color){ +} + +void circleColor( SDL_Surface* screen, int x, int y, int radius, Uint32 color){ +} + +void ellipseColor( SDL_Surface* screen, int x, int y, int radius_x, int radius_y, Uint32 color ){ +} + +void filledEllipseColor( SDL_Surface* screen, int x, int y, int radius_x, int radius_y, Uint32 color){ +} + +void polygonColor( SDL_Surface* screen, Sint16* vx, Sint16* vy, int npoints, Uint32 color){ +} + +void filledPolygonColor( SDL_Surface* screen, Sint16* vx, Sint16* vy, int npoints, Uint32 color){ +} + +void rectangleColor( SDL_Surface* screen, int x, int y, int width, int height, Uint32 color){ +} + +void boxColor( SDL_Surface* screen, int x, int y, int width, int height, Uint32 color){ +} + +void lineColor( SDL_Surface* screen, int x1, int y1, int x2, int y2, Uint32 color){ +} + +void pixelColor( SDL_Surface* screen, int x, int y, Uint32 color){ +} + +void stringColor( SDL_Surface* screen, int x, int y, const char *text, Uint32 color){ +} + +int SDL_BlitSurface( SDL_Surface* src, SDL_Rect* rectangle_src, SDL_Surface* dst, SDL_Rect* rectangle_dest){ + return 0; +} + + +int memory_debug_modulo; + +int SDL_PollEvent( SDL_Event* event ){ + memory_debug_n = (memory_debug_n+1)%memory_debug_modulo; + switch( memory_debug_n ){ + case 0: + { + DEBUG_MEMORY_MSG("Pas d'evenement") + return 0; + } + case 1: ; + { + DEBUG_MEMORY_MSG("souris deplace 10 10") + event->type=SDL_MOUSEMOTION; + event->motion.which = 0; + event->motion.state = SDL_RELEASED; + event->motion.x = 10; + event->motion.y = 10; + event->motion.xrel = -90; + event->motion.yrel = -90; + }; + break; + case 2: ; + { + DEBUG_MEMORY_MSG("bouton gauche souris tape") + event->type=SDL_MOUSEBUTTONDOWN; + event->button.which = 0; + event->button.button = SDL_BUTTON_LEFT; + event->button.state = SDL_PRESSED; + event->button.x = 10; + event->button.y = 10; + }; + break; + case 3: ; + { + DEBUG_MEMORY_MSG("bouton gauche souris relache") + event->type=SDL_MOUSEBUTTONUP; + event->button.which = 0; + event->button.button = SDL_BUTTON_LEFT; + event->button.state = SDL_RELEASED; + event->button.x = 10; + event->button.y = 10; + }; + break; + case 4: ; + { + DEBUG_MEMORY_MSG("souris deplace 100") + event->type=SDL_MOUSEMOTION; + event->motion.which = 0; + event->motion.state = SDL_RELEASED; + event->motion.x = 100; + event->motion.y = 100; + event->motion.xrel = 90; + event->motion.yrel = 90; + }; + break; + case 5: ; + { + DEBUG_MEMORY_MSG("bouton gauche souris tape") + event->type=SDL_MOUSEBUTTONDOWN; + event->button.which = 0; + event->button.button = SDL_BUTTON_LEFT; + event->button.state = SDL_PRESSED; + event->button.x = 100; + event->button.y = 100; + }; + break; + case 6: ; + { + DEBUG_MEMORY_MSG("bouton gausche souris relache") + event->type=SDL_MOUSEBUTTONUP; + event->button.which = 0; + event->button.button = SDL_BUTTON_LEFT; + event->button.state = SDL_RELEASED; + event->button.x = 100; + event->button.y = 100; + }; + break; + case 7: + { + DEBUG_MEMORY_MSG("a tape") + event->type=SDL_KEYDOWN; + event->key.type=SDL_KEYDOWN; + event->key.which=0; + event->key.state=SDL_PRESSED; + event->key.keysym.scancode = 0; + event->key.keysym.sym=SDLK_a; + event->key.keysym.mod=KMOD_NONE; + event->key.keysym.unicode=97; + }; + break; + case 8: ; + { + DEBUG_MEMORY_MSG("a relache") + event->type=SDL_KEYUP; + event->key.type=SDL_KEYUP; + event->key.which=0; + event->key.state=SDL_RELEASED; + event->key.keysym.scancode = 0; + event->key.keysym.sym=SDLK_a; + event->key.keysym.mod=KMOD_NONE; + event->key.keysym.unicode=97; + }; + break; + case 9: ; + { + DEBUG_MEMORY_MSG("b tape") + event->type=SDL_KEYDOWN; + event->key.type=SDL_KEYDOWN; + event->key.which=0; + event->key.state=SDL_PRESSED; + event->key.keysym.scancode = 0; + event->key.keysym.sym=SDLK_b; + event->key.keysym.mod=KMOD_NONE; + event->key.keysym.unicode=98; + }; + break; + case 10: ; + { + DEBUG_MEMORY_MSG("b relache") + event->type=SDL_KEYUP; + event->key.type=SDL_KEYUP; + event->key.which=0; + event->key.state=SDL_RELEASED; + event->key.keysym.scancode = 0; + event->key.keysym.sym=SDLK_b; + event->key.keysym.mod=KMOD_NONE; + event->key.keysym.unicode=98; + }; + break; + case 11: ; + { + DEBUG_MEMORY_MSG("return tape") + event->type=SDL_KEYDOWN; + event->key.type=SDL_KEYDOWN; + event->key.which=0; + event->key.state=SDL_PRESSED; + event->key.keysym.scancode = 0; + event->key.keysym.sym=SDLK_RETURN; + event->key.keysym.mod=KMOD_NONE; + event->key.keysym.unicode=13; + }; + break; + case 12: ; + { + DEBUG_MEMORY_MSG("Return relache") + event->type=SDL_KEYUP; + event->key.type=SDL_KEYUP; + event->key.which=0; + event->key.state=SDL_RELEASED; + event->key.keysym.scancode = 0; + event->key.keysym.sym=SDLK_RETURN; + event->key.keysym.mod=KMOD_NONE; + event->key.keysym.unicode=13; + }; + break; + case 13: + { + DEBUG_MEMORY_MSG("Evenement User") + (*event)=memory_debug_event; + }; + break; + default: ; + } + return memory_debug_filter( event ); +} + +void SDL_SetAlpha(SDL_Surface* surface, int prop1, int prop2){ +} + + +SDL_Surface* SDL_LoadBMP( const char* path ){ + update_memory_statistics( MEMORY_DEBUG_CREATE_SURFACE ); + return (SDL_Surface*) malloc( sizeof(SDL_Surface) ); +} + +SDL_Surface* SDL_CreateRGBSurface( int prop1, int w, int h, int resol, int r, int g, int b, int prop2 ){ + update_memory_statistics( MEMORY_DEBUG_CREATE_SURFACE ); + return (SDL_Surface*) malloc( sizeof(SDL_Surface) ); +} + +void SDL_FreeSurface( SDL_Surface* surface ){ + update_memory_statistics( MEMORY_DEBUG_FREE_SURFACE ); + free( surface ); +} + +SDL_Surface* rotozoomSurface( SDL_Surface* surface, double rotation, double zoom, int antialias){ + update_memory_statistics( MEMORY_DEBUG_CREATE_SURFACE ); + return (SDL_Surface*) malloc( sizeof(SDL_Surface) ); +} + + +SDL_Surface* rotozoomSurfaceXY( SDL_Surface* surface, double rotation, double zoomx, double zoomy, int antialias){ + update_memory_statistics( MEMORY_DEBUG_CREATE_SURFACE ); + return (SDL_Surface*) malloc( sizeof(SDL_Surface) ); +} + +char* memory_debug_sdl_init; + +int SDL_Init( int flags ){ + memory_debug_n = 0; + memory_debug_modulo = 14; + update_memory_statistics( MEMORY_DEBUG_INIT_SDL ); + memory_debug_sdl_init = (char*) malloc( sizeof(char) ); + return 0; +} + +void SDL_Quit(){ + update_memory_statistics( MEMORY_DEBUG_CLOSE_SDL ); + free(memory_debug_sdl_init); +} + +char* SDL_GetError(){ + return "TOTO"; +} + +SDL_Surface* SDL_SetVideoMode( int w, int h, int bits, int flags ){ + update_memory_statistics( MEMORY_DEBUG_CREATE_SURFACE ); + return (SDL_Surface*) malloc( sizeof( SDL_Surface ) ); +} + +void SDL_WM_SetCaption( const char* wind, const char* icon ){ +} + +void SDL_SetEventFilter( SDL_EventFilter filter ){ + memory_debug_filter = filter; +} + +void SDL_Flip( SDL_Surface* surface ){ +} + +int SDL_SemWait( SDL_sem* semaphore ){ + return 0; +} + +int SDL_SemPost( SDL_sem* semaphore ){ + return 0; +} + +SDL_sem* SDL_CreateSemaphore( int valeur ){ + update_memory_statistics( MEMORY_DEBUG_CREATE_SEMAPHORE ); + return (SDL_sem*) malloc( sizeof( SDL_sem ) ); +} + +void SDL_DestroySemaphore( SDL_sem* semaphore ){ + update_memory_statistics( MEMORY_DEBUG_FREE_SEMAPHORE ); + free(semaphore); +} + +void SDL_EnableUNICODE( int flags ){ +} + +int SDL_PushEvent( SDL_Event* event ){ + memory_debug_event = (*event); + memory_debug_n = memory_debug_modulo - 2 ; + return 0; +} + +int SDL_GetTicks(){ + return 1; +} + +void SDL_Delay( int milliseconds ){ +} + +void* memory_debug_malloc(size_t size, int line, char* file ){ + update_memory_statistics( MEMORY_DEBUG_MALLOC ); + fprintf(stderr, "Memory Debug : malloc ligne : %i, fichier : %s \n", line, file ); + return malloc( size ); +} + +void* memory_debug_calloc( size_t nmemb, size_t size, int line, char* file ){ + update_memory_statistics( MEMORY_DEBUG_CALLOC ); + fprintf(stderr, "Memory Debug : calloc ligne : %i, fichier : %s \n", line, file ); + return calloc( nmemb, size ); +} + +void memory_debug_free( void* ptr, int line, char* file ){ + update_memory_statistics( MEMORY_DEBUG_FREE ); + fprintf(stderr, "Memory Debug : free ligne : %i, fichier : %s \n", line, file ); + free( ptr ); +} + + +void SDL_LockAudio(){ +} + +void SDL_UnlockAudio(){ +} + +void SDL_MixAudio(Uint8 *dst, Uint8 *src, Uint32 len, int volume){ +} + +SDL_AudioSpec* SDL_LoadWAV(const char *file, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len){ + update_memory_statistics( MEMORY_DEBUG_LOAD_WAVE ); + (*audio_buf) = (Uint8*) malloc( 10000 * sizeof( Uint8 ) ); + (*audio_len) = 10000 * sizeof(Uint8); + return spec; +} + +void SDL_FreeWAV(Uint8 *audio_buf){ + update_memory_statistics( MEMORY_DEBUG_FREE_WAVE ); + free( audio_buf ); +} + +void SDL_PauseAudio(int pause_on){ +} + +int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained){ + return 0; +} + +void SDL_CloseAudio(){ +} + + + + + +int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key){ + return 0; +} + + + + +int TTF_SizeUTF8(TTF_Font *font, const char *text, int *w, int *h){ + return 0; +} + + +char* memory_debug_ttf_init; + +int TTF_Init(void){ + update_memory_statistics( MEMORY_DEBUG_INIT_TTF ); + memory_debug_ttf_init = (char*) malloc( sizeof(char) ); + return 0; +} + +void TTF_Quit(void){ + update_memory_statistics( MEMORY_DEBUG_QUIT_TTF ); + free( memory_debug_ttf_init ); +} + +TTF_Font * TTF_OpenFont(const char *file, int ptsize){ + update_memory_statistics( MEMORY_DEBUG_OPEN_FONT ); + return (TTF_Font*) malloc( sizeof(TTF_Font) ); +} + +void TTF_SetFontStyle(TTF_Font *font, int style){ +} + +void TTF_CloseFont(TTF_Font *font){ + update_memory_statistics( MEMORY_DEBUG_CLOSE_FONT ); + free( font ); +} + +SDL_Surface * TTF_RenderUTF8_Solid(TTF_Font *font, const char *text, SDL_Color fg){ + update_memory_statistics( MEMORY_DEBUG_CREATE_SURFACE ); + return (SDL_Surface*) malloc( sizeof(SDL_Surface) ); +} + + diff --git a/MLV/memory_debug.h b/MLV/memory_debug.h new file mode 100644 index 0000000..5ec78be --- /dev/null +++ b/MLV/memory_debug.h @@ -0,0 +1,556 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#ifndef __MLV__MEMMORY_DEBUG_H__ +#define __MLV__MEMMORY_DEBUG_H__ + +#include + +void init_memory_debug(); + +void print_memory_statistics(); + +void close_memory_debug(); + +typedef struct _Memory_debug_statistics { + int nb_create_surface; + int nb_free_surface; + int nb_init_sdl; + int nb_close_sdl; + int nb_create_semaphore; + int nb_free_semaphore; + int nb_malloc; + int nb_calloc; + int nb_free; + int nb_free_wave; + int nb_load_wave; + int nb_open_font; + int nb_close_font; + int nb_init_ttf; + int nb_quit_ttf; +} Memory_debug_statistics; + +typedef int Uint32; +typedef int Uint16; +typedef int Uint8; +typedef int Sint32; +typedef int Sint16; + +typedef struct SDL_Rect { + Sint16 x, y; + Uint16 w, h; +} SDL_Rect; + +typedef struct _SDL_Screen { + int h; + int w; +} SDL_Surface; + +typedef enum { + SDLK_UNKNOWN, + SDLK_FIRST, + SDLK_BACKSPACE, + SDLK_TAB, + SDLK_CLEAR, + SDLK_RETURN, + SDLK_PAUSE, + SDLK_ESCAPE, + SDLK_SPACE, + SDLK_EXCLAIM, + SDLK_QUOTEDBL, + SDLK_HASH, + SDLK_DOLLAR, + SDLK_AMPERSAND, + SDLK_QUOTE, + SDLK_LEFTPAREN, + SDLK_RIGHTPAREN, + SDLK_ASTERISK, + SDLK_PLUS, + SDLK_COMMA, + SDLK_MINUS, + SDLK_PERIOD, + SDLK_SLASH, + SDLK_0, + SDLK_1, + SDLK_2, + SDLK_3, + SDLK_4, + SDLK_5, + SDLK_6, + SDLK_7, + SDLK_8, + SDLK_9, + SDLK_COLON, + SDLK_SEMICOLON, + SDLK_LESS, + SDLK_EQUALS, + SDLK_GREATER, + SDLK_QUESTION, + SDLK_AT, + + SDLK_LEFTBRACKET, + SDLK_BACKSLASH, + SDLK_RIGHTBRACKET, + SDLK_CARET, + SDLK_UNDERSCORE, + SDLK_BACKQUOTE, + SDLK_a, + SDLK_b, + SDLK_c, + SDLK_d, + SDLK_e, + SDLK_f, + SDLK_g, + SDLK_h, + SDLK_i, + SDLK_j, + SDLK_k, + SDLK_l, + SDLK_m, + SDLK_n, + SDLK_o, + SDLK_p, + SDLK_q, + SDLK_r, + SDLK_s, + SDLK_t, + SDLK_u, + SDLK_v, + SDLK_w, + SDLK_x, + SDLK_y, + SDLK_z, + SDLK_DELETE, + + SDLK_KP0, + SDLK_KP1, + SDLK_KP2, + SDLK_KP3, + SDLK_KP4, + SDLK_KP5, + SDLK_KP6, + SDLK_KP7, + SDLK_KP8, + SDLK_KP9, + SDLK_KP_PERIOD, + SDLK_KP_DIVIDE, + SDLK_KP_MULTIPLY, + SDLK_KP_MINUS, + SDLK_KP_PLUS, + SDLK_KP_ENTER, + SDLK_KP_EQUALS, + + SDLK_UP, + SDLK_DOWN, + SDLK_RIGHT, + SDLK_LEFT, + SDLK_INSERT, + SDLK_HOME, + SDLK_END, + SDLK_PAGEUP, + SDLK_PAGEDOWN, + + SDLK_F1, + SDLK_F2, + SDLK_F3, + SDLK_F4, + SDLK_F5, + SDLK_F6, + SDLK_F7, + SDLK_F8, + SDLK_F9, + SDLK_F10, + SDLK_F11, + SDLK_F12, + SDLK_F13, + SDLK_F14, + SDLK_F15, + + SDLK_NUMLOCK, + SDLK_CAPSLOCK, + SDLK_SCROLLOCK, + SDLK_RSHIFT, + SDLK_LSHIFT, + SDLK_RCTRL, + SDLK_LCTRL, + SDLK_RALT, + SDLK_LALT, + SDLK_RMETA, + SDLK_LMETA, + SDLK_LSUPER, + SDLK_RSUPER, + SDLK_MODE, + SDLK_COMPOSE, + + SDLK_HELP, + SDLK_PRINT, + SDLK_SYSREQ, + SDLK_BREAK, + SDLK_MENU, + SDLK_POWER, + SDLK_EURO, + SDLK_UNDO, + + SDLK_LAST +} SDLKey; + +typedef enum { + KMOD_NONE, + KMOD_LSHIFT, + KMOD_RSHIFT, + KMOD_LCTRL, + KMOD_RCTRL, + KMOD_LALT, + KMOD_RALT, + KMOD_LMETA, + KMOD_RMETA, + KMOD_NUM, + KMOD_CAPS, + KMOD_MODE, + KMOD_RESERVED +} SDLMod; + +typedef struct SDL_keysym { + Uint8 scancode; /* hardware specific scancode */ + SDLKey sym; /* SDL virtual keysym */ + SDLMod mod; /* current key modifiers */ + Uint16 unicode; /* translated character */ +} SDL_keysym; + +/* Event enumerations */ +typedef enum SDL_Events { + SDL_NOEVENT = 0, /* Unused (do not remove) */ + SDL_ACTIVEEVENT, /* Application loses/gains visibility */ + SDL_KEYDOWN, /* Keys pressed */ + SDL_KEYUP, /* Keys released */ + SDL_MOUSEMOTION, /* Mouse moved */ + SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */ + SDL_MOUSEBUTTONUP, /* Mouse button released */ + SDL_JOYAXISMOTION, /* Joystick axis motion */ + SDL_JOYBALLMOTION, /* Joystick trackball motion */ + SDL_JOYHATMOTION, /* Joystick hat position change */ + SDL_JOYBUTTONDOWN, /* Joystick button pressed */ + SDL_JOYBUTTONUP, /* Joystick button released */ + SDL_QUIT, /* User-requested quit */ + SDL_SYSWMEVENT, /* System specific event */ + SDL_EVENT_RESERVEDA, /* Reserved for future use.. */ + SDL_EVENT_RESERVEDB, /* Reserved for future use.. */ + SDL_VIDEORESIZE, /* User resized video mode */ + SDL_VIDEOEXPOSE, /* Screen needs to be redrawn */ + SDL_EVENT_RESERVED2, /* Reserved for future use.. */ + SDL_EVENT_RESERVED3, /* Reserved for future use.. */ + SDL_EVENT_RESERVED4, /* Reserved for future use.. */ + SDL_EVENT_RESERVED5, /* Reserved for future use.. */ + SDL_EVENT_RESERVED6, /* Reserved for future use.. */ + SDL_EVENT_RESERVED7, /* Reserved for future use.. */ + /* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */ + SDL_USEREVENT = 24, + /* This last event is only for bounding internal arrays + It is the number of bits in the event mask datatype -- Uint32 + */ + SDL_NUMEVENTS = 32 +} SDL_EventType; + +/* Application visibility event structure */ +typedef struct SDL_ActiveEvent { + Uint8 type; /* SDL_ACTIVEEVENT */ + Uint8 gain; /* Whether given states were gained or lost (1/0) */ + Uint8 state; /* A mask of the focus states */ +} SDL_ActiveEvent; + +/* Keyboard event structure */ +typedef struct SDL_KeyboardEvent { + Uint8 type; /* SDL_KEYDOWN or SDL_KEYUP */ + Uint8 which; /* The keyboard device index */ + Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ + SDL_keysym keysym; +} SDL_KeyboardEvent; + +/* Mouse motion event structure */ +typedef struct SDL_MouseMotionEvent { + Uint8 type; /* SDL_MOUSEMOTION */ + Uint8 which; /* The mouse device index */ + Uint8 state; /* The current button state */ + Uint16 x, y; /* The X/Y coordinates of the mouse */ + Sint16 xrel; /* The relative motion in the X direction */ + Sint16 yrel; /* The relative motion in the Y direction */ +} SDL_MouseMotionEvent; + +/* Mouse button event structure */ +typedef struct SDL_MouseButtonEvent { + Uint8 type; /* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */ + Uint8 which; /* The mouse device index */ + Uint8 button; /* The mouse button index */ + Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ + Uint16 x, y; /* The X/Y coordinates of the mouse at press time */ +} SDL_MouseButtonEvent; + +/* Joystick axis motion event structure */ +typedef struct SDL_JoyAxisEvent { + Uint8 type; /* SDL_JOYAXISMOTION */ + Uint8 which; /* The joystick device index */ + Uint8 axis; /* The joystick axis index */ + Sint16 value; /* The axis value (range: -32768 to 32767) */ +} SDL_JoyAxisEvent; + +/* Joystick trackball motion event structure */ +typedef struct SDL_JoyBallEvent { + Uint8 type; /* SDL_JOYBALLMOTION */ + Uint8 which; /* The joystick device index */ + Uint8 ball; /* The joystick trackball index */ + Sint16 xrel; /* The relative motion in the X direction */ + Sint16 yrel; /* The relative motion in the Y direction */ +} SDL_JoyBallEvent; + +/* Joystick hat position change event structure */ +typedef struct SDL_JoyHatEvent { + Uint8 type; /* SDL_JOYHATMOTION */ + Uint8 which; /* The joystick device index */ + Uint8 hat; /* The joystick hat index */ + Uint8 value; /* The hat position value: + SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP + SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT + SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN + Note that zero means the POV is centered. + */ +} SDL_JoyHatEvent; + +/* Joystick button event structure */ +typedef struct SDL_JoyButtonEvent { + Uint8 type; /* SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */ + Uint8 which; /* The joystick device index */ + Uint8 button; /* The joystick button index */ + Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ +} SDL_JoyButtonEvent; + +/* The "window resized" event + When you get this event, you are responsible for setting a new video + mode with the new width and height. + */ +typedef struct SDL_ResizeEvent { + Uint8 type; /* SDL_VIDEORESIZE */ + int w; /* New width */ + int h; /* New height */ +} SDL_ResizeEvent; + +/* The "screen redraw" event */ +typedef struct SDL_ExposeEvent { + Uint8 type; /* SDL_VIDEOEXPOSE */ +} SDL_ExposeEvent; + +/* The "quit requested" event */ +typedef struct SDL_QuitEvent { + Uint8 type; /* SDL_QUIT */ +} SDL_QuitEvent; + +/* A user-defined event type */ +typedef struct SDL_UserEvent { + Uint8 type; /* SDL_USEREVENT through SDL_NUMEVENTS-1 */ + int code; /* User defined event code */ + void *data1; /* User defined data pointer */ + void *data2; /* User defined data pointer */ +} SDL_UserEvent; + +/* If you want to use this event, you should include SDL_syswm.h */ +struct SDL_SysWMmsg; +typedef struct SDL_SysWMmsg SDL_SysWMmsg; +typedef struct SDL_SysWMEvent { + Uint8 type; + SDL_SysWMmsg *msg; +} SDL_SysWMEvent; + +/* General event structure */ +typedef union SDL_Event { + Uint8 type; + SDL_ActiveEvent active; + SDL_KeyboardEvent key; + SDL_MouseMotionEvent motion; + SDL_MouseButtonEvent button; + SDL_JoyAxisEvent jaxis; + SDL_JoyBallEvent jball; + SDL_JoyHatEvent jhat; + SDL_JoyButtonEvent jbutton; + SDL_ResizeEvent resize; + SDL_ExposeEvent expose; + SDL_QuitEvent quit; + SDL_UserEvent user; + SDL_SysWMEvent syswm; +} SDL_Event; + +#define SDL_BUTTON_LEFT 1 +#define SDL_BUTTON_MIDDLE 2 +#define SDL_BUTTON_RIGHT 3 + +void filledCircleColor( SDL_Surface* screen, int x, int y, int radius, Uint32 color); +void circleColor( SDL_Surface* screen, int x, int y, int radius, Uint32 color); +void ellipseColor( SDL_Surface* screen, int x, int y, int radius_x, int radius_y, Uint32 color ); +void filledEllipseColor( SDL_Surface* screen, int x, int y, int radius_x, int radius_y, Uint32 color); +void polygonColor( SDL_Surface* screen, Sint16* vx, Sint16* vy, int npoints, Uint32 color); +void filledPolygonColor( SDL_Surface* screen, Sint16* vx, Sint16* vy, int npoints, Uint32 color); +void rectangleColor( SDL_Surface* screen, int x, int y, int width, int height, Uint32 color); +void boxColor( SDL_Surface* screen, int x, int y, int width, int height, Uint32 color); +void lineColor( SDL_Surface* screen, int x1, int y1, int x2, int y2, Uint32 color); +void pixelColor( SDL_Surface* screen, int x, int y, Uint32 color); +void stringColor( SDL_Surface* screen, int x, int y, const char *text, Uint32 color); + +int SDL_BlitSurface( SDL_Surface* src, SDL_Rect* rectangle_src, SDL_Surface* dst, SDL_Rect* rectangle_dest); + +int SDL_PollEvent( SDL_Event* event ); + +#define SDL_HWSURFACE 1 +#define SDL_SRCALPHA 1 +#define SDL_ALPHA_TRANSPARENT 1 +#define SDL_RLEACCEL 1 +#define SDL_ALPHA_OPAQUE 1 + +void SDL_SetAlpha(SDL_Surface* surface, int prop1, int prop2); + +SDL_Surface* SDL_LoadBMP( const char* path ); +SDL_Surface* SDL_CreateRGBSurface( int prop1, int w, int h, int resol, int r, int g, int b, int prop2 ); +void SDL_FreeSurface( SDL_Surface* surface ); +SDL_Surface* rotozoomSurface( SDL_Surface* surface, double rotation, double zoom, int antialias); + +SDL_Surface* rotozoomSurfaceXY( SDL_Surface* surface, double rotation, double zoomx, double zoomy, int antialias); + +#define SDL_INIT_VIDEO 1 +#define SDL_INIT_TIMER 1 +#define SDL_INIT_AUDIO 1 +#define SDL_DOUBLEBUF 1 +#define SDL_INIT_EVENTTHREAD 1 + +typedef int (*SDL_EventFilter)(const SDL_Event *event); + + +int SDL_Init( int flags ); +void SDL_Quit(); +char* SDL_GetError(); +SDL_Surface* SDL_SetVideoMode( int w, int h, int bits, int flags ); +void SDL_WM_SetCaption( const char* wind, const char* icon ); +void SDL_SetEventFilter( SDL_EventFilter filter ); +void SDL_Flip( SDL_Surface* surface ); + +#define SDL_PRESSED 0 +#define SDL_RELEASED 1 + +#define SDL_ENABLE 1 + +typedef struct _SDL_sem { +} SDL_sem; + +int SDL_SemWait( SDL_sem* semaphore ); +int SDL_SemPost( SDL_sem* semaphore ); + +SDL_sem* SDL_CreateSemaphore( int ); +void SDL_DestroySemaphore( SDL_sem* semaphore ); + +void SDL_EnableUNICODE( int flags ); + +int SDL_PushEvent( SDL_Event* event ); + +int SDL_GetTicks(); + +void SDL_Delay( int milliseconds ); + +void* memory_debug_malloc( size_t size, int line, char* file ); + +void* memory_debug_calloc( size_t nmemb, size_t size, int line, char* file ); + +void memory_debug_free( void* ptr, int line, char* file ); + +typedef struct{ + int freq; + Uint16 format; + Uint8 channels; + Uint8 silence; + Uint16 samples; + Uint32 size; + void (*callback)(void *userdata, Uint8 *stream, int len); + void *userdata; +} SDL_AudioSpec; + +void SDL_LockAudio(); + +void SDL_UnlockAudio(); + +void SDL_MixAudio(Uint8 *dst, Uint8 *src, Uint32 len, int volume); + +SDL_AudioSpec* SDL_LoadWAV(const char *file, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len); + +void SDL_FreeWAV(Uint8 *audio_buf); + +void SDL_PauseAudio(int pause_on); + +int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained); + +void SDL_CloseAudio(); + + +/* Audio format flags (defaults to LSB byte order) */ +#define AUDIO_U8 0x0008 /* Unsigned 8-bit samples */ +#define AUDIO_S8 0x8008 /* Signed 8-bit samples */ +#define AUDIO_U16LSB 0x0010 /* Unsigned 16-bit samples */ +#define AUDIO_S16LSB 0x8010 /* Signed 16-bit samples */ +#define AUDIO_U16MSB 0x1010 /* As above, but big-endian byte order */ +#define AUDIO_S16MSB 0x9010 /* As above, but big-endian byte order */ +#define AUDIO_U16 AUDIO_U16LSB +#define AUDIO_S16 AUDIO_S16LSB + +#define SDL_MIX_MAXVOLUME 128 + + +typedef struct { + Uint8 r; + Uint8 g; + Uint8 b; + Uint8 unused; +} SDL_Color; + +#define SDL_SRCCOLORKEY 0x00001000 /* Blit uses a source color key */ + +int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key); + + +/* +typedef struct { +} GList; +*/ + +typedef struct { +} TTF_Font; + +int TTF_SizeUTF8(TTF_Font *font, const char *text, int *w, int *h); + +int TTF_Init(void); + +void TTF_Quit(void); + +TTF_Font * TTF_OpenFont(const char *file, int ptsize); + +#define TTF_GetError SDL_GetError + +void TTF_SetFontStyle(TTF_Font *font, int style); + +#define TTF_STYLE_NORMAL 0x00 + +void TTF_CloseFont(TTF_Font *font); + +SDL_Surface * TTF_RenderUTF8_Solid(TTF_Font *font, const char *text, SDL_Color fg); + +#endif diff --git a/MLV/memory_management.h b/MLV/memory_management.h new file mode 100644 index 0000000..a79ca41 --- /dev/null +++ b/MLV/memory_management.h @@ -0,0 +1,38 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#ifndef __MLV__MEMORY_MANAGEMENT_H__ +#define __MLV__MEMORY_MANAGEMENT_H__ + +#include + +#ifndef MEMORY_DEBUG + #define MLV_MALLOC( size, type ) (type *) malloc( (size) * sizeof( type ) ) + #define MLV_CALLOC( nmemb, size, type ) (type *) calloc( nmemb, (size) * sizeof( type ) ) + #define MLV_FREE( ptr, type ) free( (ptr) ) +#else + #include "memory_debug.h" + + #define MLV_MALLOC( size, type ) (type *) memory_debug_malloc( (size) * sizeof( type ), __LINE__, __FILE__ ) + #define MLV_CALLOC( size, type ) (type *) memory_debug_calloc( (size) * sizeof( type ), __LINE__ , __FILE__ ) + #define MLV_FREE( ptr, type ) memory_debug_free( (ptr), __LINE__, __FILE__ ) +#endif + +#endif diff --git a/MLV/mouse.c b/MLV/mouse.c new file mode 100644 index 0000000..caf3f56 --- /dev/null +++ b/MLV/mouse.c @@ -0,0 +1,139 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "MLV_mouse.h" +#include "MLV_event.h" +#include "MLV_time.h" + +#ifndef MEMORY_DEBUG +#include +#else +#include "memory_debug.h" +#endif + +#include "warning_error.h" + +#include "memory_management.h" + +void MLV_wait_mouse(int *x, int *y){ + MLV_Button_state state; + MLV_Mouse_button mouse_button; + + // We remove all existing event from the queue + MLV_flush_event_queue(); + + //We wait for a new mouse event + while( + ( + MLV_wait_event( + NULL, NULL, NULL, + NULL, NULL, + x, y, &mouse_button, + &state + ) != MLV_MOUSE_BUTTON + ) || + ( mouse_button != MLV_BUTTON_LEFT ) || + ( state != MLV_PRESSED ) + ); +}; + +int MLV_wait_mouse_or_seconds(int *x, int *y, int seconds){ + MLV_Button_state state; + MLV_Mouse_button mouse_button; + + // We remove all existing event from the queue + MLV_flush_event_queue(); + + int time = MLV_get_time(); + + //We wait for a new mouse event + int resultat = 0; + int tmp_x, tmp_y; + while( + ( + resultat = + ( + MLV_wait_event_or_seconds( + NULL, NULL, NULL, + NULL, NULL, + &tmp_x, &tmp_y, &mouse_button, + &state, + seconds - ( MLV_get_time() - time )/1000 + ) != MLV_MOUSE_BUTTON + ) || + ( mouse_button != MLV_BUTTON_LEFT ) || + ( state != MLV_PRESSED ) + ) && ( + (MLV_get_time() - time) < seconds*1000 + ) + ); + if( + ! resultat && + mouse_button == MLV_BUTTON_LEFT && + state == MLV_PRESSED + ){ + if( x ) *x = tmp_x; + if( y ) *y = tmp_y; + } + return !resultat; +} + +const char* MLV_convert_mouse_button_to_string( MLV_Mouse_button button_code ){ + switch( button_code ){ + case MLV_BUTTON_LEFT: + return "MLV_BUTTON_LEFT"; + case MLV_BUTTON_MIDDLE: + return "MLV_BUTTON_MIDDLE"; + case MLV_BUTTON_RIGHT: + return "MLV_BUTTON_RIGHT"; + default: + ERROR("Button code unexpected"); + } + return NULL; +} + +MLV_Mouse_button MLV_convert_string_to_mouse_button( const char* button_string ){ + if( strcmp( button_string, "MLV_BUTTON_LEFT" )==0 ){ + return MLV_BUTTON_LEFT; + } + if( strcmp( button_string, "MLV_BUTTON_MIDDLE" )==0 ){ + return MLV_BUTTON_MIDDLE; + } + if( strcmp( button_string, "MLV_BUTTON_RIGHT" )==0 ){ + return MLV_BUTTON_RIGHT; + } + ERROR("Button name unexpected"); + return -1; +} + +void MLV_get_mouse_position( int* x, int* y ){ + SDL_PumpEvents(); + SDL_GetMouseState(x,y); +} + +MLV_Button_state MLV_get_mouse_button_state( MLV_Mouse_button mouse_button ){ + SDL_PumpEvents(); + if( SDL_GetMouseState(NULL,NULL) & SDL_BUTTON( mouse_button ) ){ + return MLV_PRESSED; + } + return MLV_RELEASED; +} + + diff --git a/MLV/path.c b/MLV/path.c new file mode 100644 index 0000000..cfad8b8 --- /dev/null +++ b/MLV/path.c @@ -0,0 +1,122 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "MLV_path.h" + +#include "warning_error.h" +#include "memory_management.h" +#include "data_structure.h" + +#include +#include + +char* MLV_get_base_name( const char* path ){ + return g_path_get_basename( path ); +} + +char* MLV_get_directory_name( const char* path ){ + return g_path_get_dirname( path ); +} + +int MLV_path_is_absolute( const char* path ){ + return g_path_is_absolute( path ); +} + +int MLV_path_is_relative( const char* path ){ + return ! MLV_path_is_absolute( path ); +} + +char* MLV_build_path_v( char** elements ){ + gchar* tmp_res = g_build_filenamev( elements ); + char* result = strdup( tmp_res ); + g_free( tmp_res ); // tmp_res have to be freed with g_free ( + // see glib documentation + // ) + return result; +} + +char* MLV_build_path( const char* first_element, ...){ + char *result; + + if( !first_element ) return NULL; + + va_list pile; + const char* type; + int compteur; + + va_start( pile, first_element ); + compteur = 2; + while( + ( + type = va_arg( pile, char* ) + ) != NULL + ){ + compteur ++; + } + va_end( pile ); + + char** elements = MLV_MALLOC( compteur, char* ); + elements[0] = strdup( first_element ); + + va_start( pile, first_element ); + int i; + for( i=1; i. + */ + +#ifndef __MLV__PLATFORM_H__ +#define __MLV__PLATFORM_H__ + +#if defined( __WIN32__ ) || defined( _WIN32 ) || defined( __CYGWIN__ ) +# define OS_WINDOWS +#elif defined( __APPLE_CC__) +# define OS_APPLE +#elif defined( __MLV_ANDROID__ ) +# define OS_ANDROID +#else +# define OS_LINUX +#endif + +#endif diff --git a/MLV/playlist.c b/MLV/playlist.c new file mode 100644 index 0000000..615cab6 --- /dev/null +++ b/MLV/playlist.c @@ -0,0 +1,205 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "MLV_playlist.h" + +#include "MLV_audio.h" + +#include "data_structure.h" +#include "list.h" +#include "memory_management.h" + +#include "warning_error.h" + +#ifndef MEMORY_DEBUG +#include +#else +#include "memory_debug.h" +#endif + +extern DataMLV* MLV_data; + +typedef struct _Music_item { + int interne; + MLV_Music* music; +} Music_item; + +struct _MLV_Playlist { + MLV_List* music_items; + int playing; + int current; + int size; + SDL_sem* semaphore; + double volume; + int loop; +}; + +void MLV_init_playlists(){ + MLV_data->playlists = NULL; + MLV_data->active_playlists = NULL; +} + +void MLV_close_playlists(){ + MLV_List* playlists = NULL; + MLV_List* tmp = MLV_data->playlists; + while(tmp){ + playlists = MLV_prepend_list( + playlists, + tmp->data + ); + tmp = tmp->next; + } + MLV_foreach_list( + playlists, + (void (*)(void*,void*)) MLV_close_playlist + , NULL + ); + MLV_free_list( MLV_data->playlists ); + MLV_free_list( MLV_data->active_playlists ); +} + +MLV_Playlist* MLV_create_playlist( int loop ){ + MLV_Playlist* playlist = MLV_MALLOC( 1, MLV_Playlist ); + playlist->music_items = NULL; + playlist->semaphore = SDL_CreateSemaphore(1); + playlist->volume = 1.0; + playlist->size = 0; + playlist->loop = loop; + if( SDL_SemWait( MLV_data->audio_semaphore ) ){ + ERROR_FULL("Probleme de semaphore"); + } + MLV_data->playlists = MLV_prepend_list( + MLV_data->playlists, + playlist + ); + if( SDL_SemPost( MLV_data->audio_semaphore ) ){ + ERROR_FULL("Probleme de semaphore"); + } + return playlist; +} + +void MLV_close_playlist( MLV_Playlist* playlist ){ + if( SDL_SemWait( MLV_data->audio_semaphore ) ){ + ERROR_FULL("Probleme de semaphore"); + } + MLV_data->playlists = MLV_remove_list( MLV_data->playlists, playlist ); + if( SDL_SemPost( MLV_data->audio_semaphore ) ){ + ERROR_FULL("Probleme de semaphore"); + } + MLV_playlist_clear( playlist ); + MLV_free_list( playlist->music_items ); + SDL_DestroySemaphore( playlist->semaphore ); +} + +void MLV_playlist_add( MLV_Playlist* playlist, const char* file_music ){ + Music_item* item = MLV_MALLOC(1, Music_item); + item->interne = 1; + item->music = MLV_load_music( file_music ); + if( SDL_SemWait( playlist->semaphore ) ){ + ERROR_FULL("Probleme de semaphore"); + } + playlist->music_items = MLV_prepend_list( + playlist->music_items, + item + ); + playlist->size ++; + if( SDL_SemPost( playlist->semaphore ) ){ + ERROR_FULL("Probleme de semaphore"); + } +} + +void MLV_playlist_add_sheet_music( MLV_Playlist* playlist, MLV_Music* music ){ + Music_item* item = MLV_MALLOC(1, Music_item); + item->interne = 0; + item->music = music; + if( SDL_SemWait( playlist->semaphore ) ){ + ERROR_FULL("Probleme de semaphore"); + } + playlist->music_items = MLV_prepend_list( + playlist->music_items, + item + ); + if( SDL_SemPost( playlist->semaphore ) ){ + ERROR_FULL("Probleme de semaphore"); + } +} + +void MLV_playlist_remove( MLV_Playlist* playlist, int index ){ + TODO +} + +void MLV_playlist_clear( MLV_Playlist* playlist ){ + TODO +} + +void MLV_playlist_volume( MLV_Playlist* playlist, double volume ){ + if( SDL_SemWait( playlist->semaphore ) ){ + ERROR_FULL("Probleme de semaphore"); + } + playlist->volume = volume; + if( SDL_SemPost( playlist->semaphore ) ){ + ERROR_FULL("Probleme de semaphore"); + } +} + +void MLV_playlist_play( MLV_Playlist* playlist ){ + if( SDL_SemWait( playlist->semaphore ) ){ + ERROR_FULL("Probleme de semaphore"); + } + playlist->playing = 1; + if( SDL_SemPost( playlist->semaphore ) ){ + ERROR_FULL("Probleme de semaphore"); + } +} + +void MLV_playlist_pause( MLV_Playlist* playlist ){ + if( SDL_SemWait( playlist->semaphore ) ){ + ERROR_FULL("Probleme de semaphore"); + } + playlist->playing = 0; + if( SDL_SemPost( playlist->semaphore ) ){ + ERROR_FULL("Probleme de semaphore"); + } +} + +void MLV_playlist_stop( MLV_Playlist* playlist ){ + TODO +} + +void MLV_playlist_next( MLV_Playlist* playlist ){ + TODO +} + +void MLV_playlist_previous( MLV_Playlist* playlist ){ + TODO +} + +void MLV_playlist_first( MLV_Playlist* playlist ){ + TODO +} + +void MLV_playlist_last( MLV_Playlist* playlist ){ + TODO +} + +void MLV_playlist_index( MLV_Playlist* playlist, int index){ + TODO +} + diff --git a/MLV/random.c b/MLV/random.c new file mode 100644 index 0000000..9ebdb2b --- /dev/null +++ b/MLV/random.c @@ -0,0 +1,44 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "MLV_random.h" + +#ifndef MEMORY_DEBUG +#include +#else +#include "memory_debug.h" +#endif + +#include + +#include "warning_error.h" +#include "memory_management.h" + +int MLV_get_random_boolean(int begin, int end){ + return g_random_boolean( ); +} + +int MLV_get_random_integer(int begin, int end){ + return g_random_int_range( begin, end ); +} + +double MLV_get_random_double(double begin, double end){ + return g_random_double_range( begin, end ); +} diff --git a/MLV/sdlkeyboardtochar.c b/MLV/sdlkeyboardtochar.c new file mode 100644 index 0000000..50591c5 --- /dev/null +++ b/MLV/sdlkeyboardtochar.c @@ -0,0 +1,198 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "sdlkeyboardtochar.h" + +#include "memory_management.h" + +int sldKeyIsACharacter( SDLKey key){ + int result = 1; + + switch( key ) { + case SDLK_TAB : result = 1; break; + case SDLK_SPACE : result = 1; break; + case SDLK_EXCLAIM : result = 1; break; + case SDLK_QUOTEDBL : result = 1; break; + case SDLK_HASH : result = 1; break; + case SDLK_DOLLAR : result = 1; break; + case SDLK_AMPERSAND : result = 1; break; + case SDLK_QUOTE : result = 1; break; + case SDLK_LEFTPAREN : result = 1; break; + case SDLK_RIGHTPAREN : result = 1; break; + case SDLK_ASTERISK : result = 1; break; + case SDLK_PLUS : result = 1; break; + case SDLK_COMMA : result = 1; break; + case SDLK_MINUS : result = 1; break; + case SDLK_PERIOD : result = 1; break; + case SDLK_SLASH : result = 1; break; + case SDLK_0 : result = 1; break; + case SDLK_1 : result = 1; break; + case SDLK_2 : result = 1; break; + case SDLK_3 : result = 1; break; + case SDLK_4 : result = 1; break; + case SDLK_5 : result = 1; break; + case SDLK_6 : result = 1; break; + case SDLK_7 : result = 1; break; + case SDLK_8 : result = 1; break; + case SDLK_9 : result = 1; break; + case SDLK_COLON : result = 1; break; + case SDLK_SEMICOLON : result = 1; break; + case SDLK_LESS : result = 1; break; + case SDLK_EQUALS : result = 1; break; + case SDLK_GREATER : result = 1; break; + case SDLK_QUESTION : result = 1; break; + case SDLK_AT : result = 1; break; + case SDLK_LEFTBRACKET : result = 1; break; + case SDLK_BACKSLASH : result = 1; break; + case SDLK_RIGHTBRACKET : result = 1; break; + case SDLK_CARET : result = 1; break; + case SDLK_UNDERSCORE : result = 1; break; + case SDLK_BACKQUOTE : result = 1; break; + case SDLK_a : result = 1; break; + case SDLK_b : result = 1; break; + case SDLK_c : result = 1; break; + case SDLK_d : result = 1; break; + case SDLK_e : result = 1; break; + case SDLK_f : result = 1; break; + case SDLK_g : result = 1; break; + case SDLK_h : result = 1; break; + case SDLK_i : result = 1; break; + case SDLK_j : result = 1; break; + case SDLK_k : result = 1; break; + case SDLK_l : result = 1; break; + case SDLK_m : result = 1; break; + case SDLK_n : result = 1; break; + case SDLK_o : result = 1; break; + case SDLK_p : result = 1; break; + case SDLK_q : result = 1; break; + case SDLK_r : result = 1; break; + case SDLK_s : result = 1; break; + case SDLK_t : result = 1; break; + case SDLK_u : result = 1; break; + case SDLK_v : result = 1; break; + case SDLK_w : result = 1; break; + case SDLK_x : result = 1; break; + case SDLK_y : result = 1; break; + case SDLK_z : result = 1; break; + case SDLK_KP_PERIOD : result = 1; break; + case SDLK_KP_DIVIDE : result = 1; break; + case SDLK_KP_MULTIPLY : result = 1; break; + case SDLK_KP_MINUS : result = 1; break; + case SDLK_KP_PLUS : result = 1; break; + case SDLK_KP_EQUALS : result = 1; break; + default: result = 0; + } + return result; +} + + +int converSdlKeyToChar( SDLKey key, SDLMod mod, char* character ){ + int result = 0; +/* + * if( mod & KMOD_NUM ) printf( "NUMLOCK " ); + * if( mod & KMOD_CAPS ) printf( "CAPSLOCK " ); + * if( mod & KMOD_LCTRL ) printf( "LCTRL " ); + * if( mod & KMOD_RCTRL ) printf( "RCTRL " ); + * if( mod & KMOD_RSHIFT ) printf( "RSHIFT " ); + * if( mod & KMOD_LSHIFT ) printf( "LSHIFT " ); + * if( mod & KMOD_RALT ) printf( "RALT " ); + * if( mod & KMOD_LALT ) printf( "LALT " ); + * if( mod & KMOD_CTRL ) printf( "CTRL " ); + * if( mod & KMOD_SHIFT ) printf( "SHIFT " ); + * if( mod & KMOD_ALT ) printf( "ALT " ); + * */ + + switch( key ) { + case SDLK_TAB : (*character) = '\t'; break; + case SDLK_SPACE : (*character) = ' '; break; + case SDLK_EXCLAIM : (*character) = '!'; break; + case SDLK_QUOTEDBL : (*character) = '"'; break; + case SDLK_HASH : (*character) = '#'; break; + case SDLK_DOLLAR : (*character) = '$'; break; + case SDLK_AMPERSAND : (*character) = '&'; break; + case SDLK_QUOTE : (*character) = '\''; break; + case SDLK_LEFTPAREN : (*character) = '('; break; + case SDLK_RIGHTPAREN : (*character) = ')'; break; + case SDLK_ASTERISK : (*character) = '*'; break; + case SDLK_PLUS : (*character) = '+'; break; + case SDLK_COMMA : (*character) = ','; break; + case SDLK_MINUS : (*character) = '-'; break; + case SDLK_PERIOD : (*character) = '.'; break; + case SDLK_SLASH : (*character) = '/'; break; + case SDLK_0 : (*character) = '0'; break; + case SDLK_1 : (*character) = '1'; break; + case SDLK_2 : (*character) = '2'; break; + case SDLK_3 : (*character) = '3'; break; + case SDLK_4 : (*character) = '4'; break; + case SDLK_5 : (*character) = '5'; break; + case SDLK_6 : (*character) = '6'; break; + case SDLK_7 : (*character) = '7'; break; + case SDLK_8 : (*character) = '8'; break; + case SDLK_9 : (*character) = '9'; break; + case SDLK_COLON : (*character) = ':'; break; + case SDLK_SEMICOLON : (*character) = ';'; break; + case SDLK_LESS : (*character) = '<'; break; + case SDLK_EQUALS : (*character) = '='; break; + case SDLK_GREATER : (*character) = '>'; break; + case SDLK_QUESTION : (*character) = '?'; break; + case SDLK_AT : (*character) = '@'; break; + case SDLK_LEFTBRACKET : (*character) = '['; break; + case SDLK_BACKSLASH : (*character) = '\\'; break; + case SDLK_RIGHTBRACKET : (*character) = ']'; break; + case SDLK_CARET : (*character) = '^'; break; + case SDLK_UNDERSCORE : (*character) = '_'; break; + case SDLK_BACKQUOTE : (*character) = '`'; break; + case SDLK_a : (*character) = 'a'; break; + case SDLK_b : (*character) = 'b'; break; + case SDLK_c : (*character) = 'c'; break; + case SDLK_d : (*character) = 'd'; break; + case SDLK_e : (*character) = 'e'; break; + case SDLK_f : (*character) = 'f'; break; + case SDLK_g : (*character) = 'g'; break; + case SDLK_h : (*character) = 'h'; break; + case SDLK_i : (*character) = 'i'; break; + case SDLK_j : (*character) = 'j'; break; + case SDLK_k : (*character) = 'k'; break; + case SDLK_l : (*character) = 'l'; break; + case SDLK_m : (*character) = 'm'; break; + case SDLK_n : (*character) = 'n'; break; + case SDLK_o : (*character) = 'o'; break; + case SDLK_p : (*character) = 'p'; break; + case SDLK_q : (*character) = 'q'; break; + case SDLK_r : (*character) = 'r'; break; + case SDLK_s : (*character) = 's'; break; + case SDLK_t : (*character) = 't'; break; + case SDLK_u : (*character) = 'u'; break; + case SDLK_v : (*character) = 'v'; break; + case SDLK_w : (*character) = 'w'; break; + case SDLK_x : (*character) = 'x'; break; + case SDLK_y : (*character) = 'y'; break; + case SDLK_z : (*character) = 'z'; break; + case SDLK_KP_PERIOD : (*character) = '.'; break; + case SDLK_KP_DIVIDE : (*character) = '/'; break; + case SDLK_KP_MULTIPLY : (*character) = '*'; break; + case SDLK_KP_MINUS : (*character) = '-'; break; + case SDLK_KP_PLUS : (*character) = '+'; break; + case SDLK_KP_EQUALS : (*character) = '='; break; + default: result = 1; + } + return result; +} + diff --git a/MLV/sdlkeyboardtochar.h b/MLV/sdlkeyboardtochar.h new file mode 100644 index 0000000..9bf68d8 --- /dev/null +++ b/MLV/sdlkeyboardtochar.h @@ -0,0 +1,34 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#ifndef __MLV__SDLKEYBOARDTOCHAR_H__ +#define __MLV__SDLKEYBOARDTOCHAR_H__ + +#ifndef MEMORY_DEBUG +#include +#else +#include "memory_debug.h" +#endif + +int converSdlKeyToChar( SDLKey key, SDLMod mod, char* character ); +int sldKeyIsACharacter( SDLKey key ); + +#endif + diff --git a/MLV/shapes.c b/MLV/shapes.c new file mode 100644 index 0000000..24568a2 --- /dev/null +++ b/MLV/shapes.c @@ -0,0 +1,267 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "MLV_shape.h" + +#include "platform.h" +#include "image.h" + +#ifndef MEMORY_DEBUG +#if defined( OS_WINDOWS ) +# include +#elif defined( OS_APPLE ) +# include +#else +# include +#endif +#else +#include "memory_debug.h" +#endif + +#include "data_structure.h" +#include "warning_error.h" + +#include "memory_management.h" + +#include + +#include "data_structure.h" + +extern DataMLV *MLV_data; + + +/////////////////////////////////////////////////////////////////////////////// +// Drawing operation on images // +/////////////////////////////////////////////////////////////////////////////// + + +void MLV_draw_circle_on_image(int x, int y, int radius, MLV_Color color, MLV_Image* image){ + circleColor( image->surface, x, y, radius, color ); +} + +void MLV_draw_filled_circle_on_image(int x, int y, int radius, MLV_Color color, MLV_Image* image){ + filledCircleColor( image->surface, x, y, radius, color); +} + +void MLV_draw_ellipse_on_image(int x, int y, int radius_x, int radius_y, MLV_Color color, MLV_Image* image){ + ellipseColor(image->surface,x,y,radius_x,radius_y,color); +} + +void MLV_draw_filled_ellipse_on_image(int x, int y, int radius_x, int radius_y, MLV_Color color, MLV_Image* image){ + filledEllipseColor(image->surface,x,y,radius_x,radius_y,color); +} + +void MLV_draw_polygon_on_image( const int* vx, const int* vy, int nb_points, MLV_Color color, MLV_Image* image){ + Sint16* tmp_vx = MLV_MALLOC( nb_points, Sint16 ); + Sint16* tmp_vy = MLV_MALLOC( nb_points, Sint16 ); + int i; + for( i=0; i< nb_points; i++){ + tmp_vx[i] = vx[i]; + tmp_vy[i] = vy[i]; + } + polygonColor( image->surface, tmp_vx, tmp_vy, nb_points, color); + MLV_FREE( tmp_vx, Sint16 ); + MLV_FREE( tmp_vy, Sint16 ); +} + +void MLV_draw_filled_polygon_on_image( const int* vx, const int* vy, int nb_points, MLV_Color color, MLV_Image* image){ + Sint16* tmp_vx = MLV_MALLOC( nb_points, Sint16 ); + Sint16* tmp_vy = MLV_MALLOC( nb_points, Sint16 ); + int i; + for( i=0; i< nb_points; i++){ + tmp_vx[i] = vx[i]; + tmp_vy[i] = vy[i]; + } + filledPolygonColor( image->surface, tmp_vx, tmp_vy, nb_points, color); + MLV_FREE( tmp_vx, Sint16 ); + MLV_FREE( tmp_vy, Sint16 ); +} + + +void MLV_draw_bezier_curve_on_image( const int* vx, const int* vy, int nb_points, MLV_Color color, MLV_Image* image){ + Sint16* tmp_vx = MLV_MALLOC( nb_points, Sint16 ); + Sint16* tmp_vy = MLV_MALLOC( nb_points, Sint16 ); + int i; + for( i=0; i< nb_points; i++){ + tmp_vx[i] = vx[i]; + tmp_vy[i] = vy[i]; + } + bezierColor( image->surface, tmp_vx, tmp_vy, nb_points, 6 , color); + MLV_FREE( tmp_vx, Sint16 ); + MLV_FREE( tmp_vy, Sint16 ); +} + + +void MLV_draw_rectangle_on_image(int x, int y, int width, int height, MLV_Color color, MLV_Image* image){ + rectangleColor(image->surface, x, y, x+width-1, y+height-1, color); +} + +void MLV_draw_filled_rectangle_on_image(int x, int y, int width, int height, MLV_Color color, MLV_Image* image){ + boxColor(image->surface, x, y, x+width-1, y+height-1, color); +} + +void MLV_draw_line_on_image(int x1, int y1, int x2, int y2, MLV_Color color, MLV_Image* image){ + lineColor( image->surface, x1, y1, x2, y2, color); +} + +void draw_pixel_on_sdl_surface( SDL_Surface* surface, int x, int y, MLV_Color color ){ +#if 0 // Je ne me souvient plus pourquoi pexelColor ne fonctionnait pas. Je crois que c'est la composante alpha qui pose problème. + pixelColor(MLV_data->screen, x, y, color); +#else + SDL_LockSurface(surface); + + SDL_PixelFormat *fmt; + Uint32 *pixel; + + fmt = surface->format; + pixel = ((Uint32*) surface->pixels)+ y*surface->pitch/4 + x; + + Uint8 red, blue, green, alpha; + MLV_convert_color_to_rgba( color, &red, &green, &blue, &alpha ); + + int red_image, green_image, blue_image, alpha_image; + + get_pixel_on_image_unsafe( + surface, x, y, + &red_image, &green_image, &blue_image, &alpha_image + ); + + int inv_alpha = 255 - alpha; + Uint32 red32 = ( alpha * red + inv_alpha * red_image )/255; + Uint32 blue32 = ( alpha * blue + inv_alpha * blue_image )/255; + Uint32 green32 = ( alpha * green + inv_alpha * green_image )/255; + Uint32 alpha32 = alpha_image; + + /* set the Red component */ + red32 = red32 >> fmt->Rloss; + red32 = red32 << fmt->Rshift; + + /* set the Green component */ + green32 = green32 >> fmt->Gloss; + green32 = green32 << fmt->Gshift; + + /* set the Blue component */ + blue32 = blue32 >> fmt->Bloss; + blue32 = blue32 << fmt->Bshift; + + /* set the Alpha component */ + alpha32 = alpha32 >> fmt->Aloss; + alpha32 = alpha32 << fmt->Ashift; + + *pixel = red32 | green32 | blue32 | alpha32; + + SDL_UnlockSurface(surface); +#endif +} + +void draw_pixel( MLV_Image* image, int x, int y, MLV_Color color ){ + SDL_Surface* surface = image->surface; + draw_pixel_on_sdl_surface( surface, x, y, color ); +} + +void MLV_draw_pixel_on_image(int x, int y, MLV_Color color, MLV_Image* image){ + draw_pixel( image, x, y, color); +} + +void MLV_draw_point_on_image(int x, int y, MLV_Color color, MLV_Image* image){ + MLV_draw_pixel_on_image( x, y, color, image); +} + + + +/////////////////////////////////////////////////////////////////////////////// +// Drawing operation on iscreen // +/////////////////////////////////////////////////////////////////////////////// + +void MLV_draw_circle(int x, int y, int radius, MLV_Color color){ + circleColor( MLV_data->screen, x, y, radius, color ); +} + +void MLV_draw_filled_circle(int x, int y, int radius, MLV_Color color){ + filledCircleColor( MLV_data->screen, x, y, radius, color); +} + +void MLV_draw_ellipse(int x, int y, int radius_x, int radius_y, MLV_Color color){ + ellipseColor(MLV_data->screen,x,y,radius_x,radius_y,color); +} + +void MLV_draw_filled_ellipse(int x, int y, int radius_x, int radius_y, MLV_Color color){ + filledEllipseColor(MLV_data->screen,x,y,radius_x,radius_y,color); +} + +void MLV_draw_polygon( const int* vx, const int* vy, int nb_points, MLV_Color color){ + Sint16* tmp_vx = MLV_MALLOC( nb_points, Sint16 ); + Sint16* tmp_vy = MLV_MALLOC( nb_points, Sint16 ); + int i; + for( i=0; i< nb_points; i++){ + tmp_vx[i] = vx[i]; + tmp_vy[i] = vy[i]; + } + polygonColor( MLV_data->screen, tmp_vx, tmp_vy, nb_points, color); + MLV_FREE( tmp_vx, Sint16 ); + MLV_FREE( tmp_vy, Sint16 ); +} + +void MLV_draw_filled_polygon( const int* vx, const int* vy, int nb_points, MLV_Color color){ + Sint16* tmp_vx = MLV_MALLOC( nb_points, Sint16 ); + Sint16* tmp_vy = MLV_MALLOC( nb_points, Sint16 ); + int i; + for( i=0; i< nb_points; i++){ + tmp_vx[i] = vx[i]; + tmp_vy[i] = vy[i]; + } + filledPolygonColor( MLV_data->screen, tmp_vx, tmp_vy, nb_points, color); + MLV_FREE( tmp_vx, Sint16 ); + MLV_FREE( tmp_vy, Sint16 ); +} + +void MLV_draw_bezier_curve( const int* vx, const int* vy, int nb_points, MLV_Color color){ + Sint16* tmp_vx = MLV_MALLOC( nb_points, Sint16 ); + Sint16* tmp_vy = MLV_MALLOC( nb_points, Sint16 ); + int i; + for( i=0; i< nb_points; i++){ + tmp_vx[i] = vx[i]; + tmp_vy[i] = vy[i]; + } + bezierColor( MLV_data->screen, tmp_vx, tmp_vy, nb_points, 6 , color); + MLV_FREE( tmp_vx, Sint16 ); + MLV_FREE( tmp_vy, Sint16 ); +} + +void MLV_draw_rectangle(int x, int y, int width, int height, MLV_Color color){ + rectangleColor(MLV_data->screen, x, y, x+width-1, y+height-1, color); +} + +void MLV_draw_filled_rectangle(int x, int y, int width, int height, MLV_Color color){ + boxColor(MLV_data->screen, x, y, x+width-1, y+height-1, color); +} + +void MLV_draw_line(int x1, int y1, int x2, int y2, MLV_Color color){ + lineColor( MLV_data->screen, x1, y1, x2, y2, color); +} + +void MLV_draw_pixel(int x, int y, MLV_Color color){ + draw_pixel_on_sdl_surface( MLV_data->screen, x, y, color ); +} + +void MLV_draw_point(int x, int y, MLV_Color color){ + MLV_draw_pixel( x, y, color); +} + diff --git a/MLV/text.c b/MLV/text.c new file mode 100644 index 0000000..e06e332 --- /dev/null +++ b/MLV/text.c @@ -0,0 +1,940 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include + +#include "platform.h" + +#ifdef OS_WINDOWS +/* Get va_list. */ +#if __STDC__ || defined __cplusplus || defined _MSC_VER +# include +#else +# include +#endif +extern int vasprintf (char **, const char *, va_list); +#endif + +#include "MLV_text.h" +#include "MLV_text_va.h" + +#include "platform.h" + +#ifndef MEMORY_DEBUG +#if defined( OS_WINDOWS ) +# include +# include +# include +#elif defined( OS_APPLE ) +# include +# include +# include +#else +# include +# include +# include +#endif +#else +#include "memory_debug.h" +#endif + +#include + +#include "text.h" +#include "MLV_shape.h" + +#include "data_structure.h" +#include "image.h" +#include "memory_management.h" + +#include "warning_error.h" + +#define SIZE_FONT 8 + +extern DataMLV* MLV_data; + +void MLV_get_size_of_text_va( + const char *text, int *width, int *height, va_list pile +){ + MLV_get_size_of_text_with_font_va( + text, width, height, MLV_data->defaultFont, pile + ); +} + +void MLV_get_size_of_text( const char *text, int *width, int *height, ... ){ + va_list pile; + va_start( pile, height ); + MLV_get_size_of_text_va( text, width, height, pile ); + va_end( pile ); +} + +void MLV_get_size_of_text_with_font_va( + const char *text, int *width, int *height, const MLV_Font* font, + va_list pile +){ + char* complete_text; + if( vasprintf( &complete_text, text, pile )==-1 ){ + ERROR("Unexpected Error."); + } + if( strlen( complete_text ) ){ + TTF_SizeUTF8(font->font, complete_text, width, height); + }else{ + TTF_SizeUTF8(font->font, " ", width, height); + } + free( complete_text ); +} + +void MLV_get_size_of_text_with_font( + const char *text, int *width, int *height, const MLV_Font* font, ... +){ + va_list pile; + va_start( pile, font ); + MLV_get_size_of_text_with_font_va( text, width, height, font, pile ); + va_end( pile ); +} + +void init_font(){ + if ( TTF_Init() < 0 ) { + fprintf( + stderr, "Couldn't initialize TTF: %s - file : %s, ligne : %i\n", + SDL_GetError(), __FILE__, __LINE__ + ); + exit(1); + } +} + +void quit_font(){ + TTF_Quit(); +} + +MLV_Font* MLV_load_font( const char* file_font, int size ){ + if( !MLV_data ){ + ERROR("To use MLV_load_font, please initialise first the MLV_Library by calling MLV_create_window before MLV_load_font.") + } + MLV_Font* font = MLV_MALLOC( 1, MLV_Font ); + font->size = size; + font->font = TTF_OpenFont( file_font, size ); + if(!font->font) { + printf( + "TTF_OpenFont: %s - file : %s, ligne : %i\n", + TTF_GetError(), __FILE__, __LINE__ + ); + exit(1); + } + TTF_SetFontStyle( font->font , TTF_STYLE_NORMAL ); + return font; +} + +void MLV_free_font( MLV_Font* font ){ + TTF_CloseFont( font->font ); + MLV_FREE( font, MLV_Font ); +} + +void convertionColor( MLV_Color src, SDL_Color* dst ){ + src = src >> 8; + dst->b = (Uint8) src; + src = src >> 8; + dst->g = (Uint8) src; + src = src >> 8; + dst->r = (Uint8) src; +} + +void getDefaultFont( MLV_Font** const font ){ + if( *font ) return; + *font = MLV_data->defaultFont; +} + +void drawString( + SDL_Surface* textBox, int x, int y, + const char* message, MLV_Color color, TTF_Font* font +){ + SDL_Color sdl_color; + convertionColor( color, &sdl_color); + SDL_Surface* text; + if( strlen( message ) ){ + text = TTF_RenderUTF8_Solid( + font, + message, + sdl_color + ); + }else{ + text = TTF_RenderUTF8_Solid( + font, + " ", + sdl_color + ); + } + + SDL_Rect rectangle; + rectangle.x = x; + rectangle.y = y; + rectangle.w = text->w; + rectangle.h = text->h; + SDL_BlitSurface( text, NULL, textBox, &rectangle); + SDL_FreeSurface( text ); +} + + +void MLV_draw_text_on_image_va( + int x, int y, const char *text, MLV_Color color, MLV_Image* image, + va_list pile +){ + MLV_draw_text_with_font_on_image_va( + x, y, text, MLV_data->defaultFont, color, image, pile + ); +} + +void MLV_draw_text_on_image( + int x, int y, const char *text, MLV_Color color, MLV_Image* image, ... +){ + va_list pile; + va_start( pile, image ); + MLV_draw_text_on_image_va( x, y, text, color, image, pile ); + va_end( pile ); +} + +void MLV_draw_text_with_font_on_image_va( + int x, int y, const char *text, const MLV_Font* font, MLV_Color color, + MLV_Image* image, va_list pile +){ + char* complete_text; + if( vasprintf( &complete_text, text, pile )==-1 ){ + ERROR("Unexpected Error."); + } + drawString( image->surface, x, y, complete_text, color, font->font ); + free( complete_text ); +} + + +void MLV_draw_text_with_font_on_image( + int x, int y, const char *text, const MLV_Font* font, MLV_Color color, + MLV_Image* image, ... +){ + va_list pile; + va_start( pile, image ); + MLV_draw_text_with_font_on_image_va( x, y, text, font, color, image, pile ); + va_end( pile ); +} + +void MLV_draw_text_va( + int x, int y, const char *text, MLV_Color color, va_list pile +){ + MLV_draw_text_with_font_va( + x, y, text, MLV_data->defaultFont, color, pile + ); +} + + +void MLV_draw_text(int x, int y, const char *text, MLV_Color color, ... ){ + va_list pile; + va_start( pile, color ); + MLV_draw_text_va( x, y, text, color, pile ); + va_end( pile ); +} + +void MLV_draw_text_with_font_va( + int x, int y, const char *text, const MLV_Font* font, MLV_Color color, + va_list pile +){ + char* complete_text; + if( vasprintf( &complete_text, text, pile )==-1 ){ + ERROR("Unexpected Error."); + } + drawString( MLV_data->screen, x, y, complete_text, color, font->font ); + free( complete_text ); +} + +void MLV_draw_text_with_font( + int x, int y, const char *text, const MLV_Font* font, MLV_Color color, ... +){ + va_list pile; + va_start( pile, color ); + MLV_draw_text_with_font_va( x, y, text, font, color, pile ); + va_end( pile ); +} + +int internal_draw_adapted_text_box_size_with_font( + char* copy, + const MLV_Font* font, + int sizeInterligne, + int *width, int *height, + int * width_text +){ + int nb_line=1; + *width = 0; + *height = 0; + if( copy[0] != '\0' ){ + int width_line,height_line; + char * new = copy; + char* old = new; + while( ( new = strchr( new ,'\n') ) ){ + (*new) = '\0'; + ++nb_line; + MLV_get_size_of_text_with_font( + old, &width_line, &height_line, font + ); + if( width_line > *width ){ + *width = width_line; + } + *height += height_line + sizeInterligne; + new ++; + old=new; + } + MLV_get_size_of_text_with_font( old, &width_line, &height_line, font ); + if( width_line > *width ){ + *width = width_line; + } + *height += height_line + sizeInterligne; + } + if( width_text ){ + *width_text = *width; + } + //Ajout des bords + *width += 2*sizeInterligne; + *height += sizeInterligne; + return nb_line; +} + +void internal_draw_text_box_with_font( + char* copy , + const MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + int corner_position_x, + int corner_position_y, + int width_text, + int nb_line, + SDL_Surface* textBox +){ + char * new = copy; + char* old = new; + int position = corner_position_y + sizeInterligne; + int horizontal_offset = corner_position_x + sizeInterligne; + int i; + for( i=0; ifont + ); + break; + case MLV_TEXT_LEFT: + drawString( + textBox, + horizontal_offset , position , + old, textColor, font->font + ); + break; + case MLV_TEXT_RIGHT: + drawString( + textBox, + horizontal_offset+width_text-width_line+sizeInterligne, + position, + old, textColor, font->font + ); + break; + default: + ERROR("Valeur impossible pour horizontal_position."); + } + position += height_line + sizeInterligne; + new ++; + old=new; + } +} + +void internal_draw_adapted_text_box_with_font_on_image( + int x, int y, + const char* message, + const MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + SDL_Surface *screen +){ + char* copy = (char*) MLV_MALLOC( (strlen(message)+1), char ); + snprintf(copy, strlen(message)+1, "%s", message); + int width,height,width_text; + + int nb_line = internal_draw_adapted_text_box_size_with_font( + copy, font, sizeInterligne, &width, &height, &width_text + ); + + SDL_Rect rectangle; + rectangle.x = x; + rectangle.y = y; + rectangle.w = width; + rectangle.h = height; + + SDL_Surface* textBox= create_surface( + width, height + ); + SDL_SetAlpha(textBox, SDL_SRCALPHA, SDL_ALPHA_OPAQUE); + SDL_SetColorKey(textBox, SDL_SRCCOLORKEY, backgroundColor); + + boxColor( textBox , 0, 0, width-1, height-1, backgroundColor); + + internal_draw_text_box_with_font( + copy , + font, + sizeInterligne, + borderColor, textColor, backgroundColor, + text_justification, + 0, + 0, + width_text, + nb_line, + textBox + ); + + rectangleColor( textBox , 0, 0, width-1, height-1, borderColor); + + SDL_BlitSurface( textBox, NULL, screen, &rectangle); + SDL_FreeSurface( textBox ); + MLV_FREE(copy, char); +} + +void MLV_draw_adapted_text_box_with_font_va( + int x, int y, + const char* message, + const MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + va_list pile +){ + char* complete_message; + if( vasprintf( &complete_message, message, pile )==-1 ){ + ERROR("Unexpected Error."); + } + internal_draw_adapted_text_box_with_font_on_image( + x, y, + complete_message, + font, + sizeInterligne, + borderColor, textColor, backgroundColor, + text_justification, + MLV_data->screen + ); + free( complete_message ); +} + +void MLV_draw_adapted_text_box_va( + int x, int y, + const char* message, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, va_list pile +){ + MLV_draw_adapted_text_box_with_font_va( + x, y, message, MLV_data->defaultFont, sizeInterligne, + borderColor, textColor, backgroundColor, + text_justification, pile + ); +} + +void MLV_draw_adapted_text_box( + int x, int y, + const char* message, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, ... +){ + va_list pile; + va_start( pile, text_justification ); + MLV_draw_adapted_text_box_va( + x, y, message, sizeInterligne, borderColor, textColor, backgroundColor, + text_justification, pile + ); + va_end( pile ); +} + +void MLV_draw_adapted_text_box_with_font_on_image_va( + int x, int y, + const char* message, + const MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Image* image, va_list pile +){ + char* complete_message; + if( vasprintf( &complete_message, message, pile )==-1 ){ + ERROR("Unexpected Error."); + } + internal_draw_adapted_text_box_with_font_on_image( + x, y, + complete_message, + font, + sizeInterligne, + borderColor, textColor, backgroundColor, + text_justification, + image->surface + ); + free( complete_message ); +} + +void MLV_draw_adapted_text_box_on_image_va( + int x, int y, + const char* message, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Image* image, va_list pile +){ + MLV_draw_adapted_text_box_with_font_on_image_va( + x, y, message, MLV_data->defaultFont, sizeInterligne, + borderColor, textColor, backgroundColor, + text_justification, + image, pile + ); +} + +void MLV_draw_adapted_text_box_on_image( + int x, int y, + const char* message, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Image* image, ... +){ + va_list pile; + va_start( pile, image ); + MLV_draw_adapted_text_box_on_image_va( + x, y, message, sizeInterligne, + borderColor, textColor, backgroundColor, + text_justification, + image, pile + ); + va_end( pile ); +} + +int MLV_get_size_of_adapted_text_box_with_font_va( + const char* message, + const MLV_Font* font, + int sizeInterligne, + int *result_width, int *result_height, + va_list pile +){ + char* complete_message; + if( vasprintf( &complete_message, message, pile )==-1 ){ + ERROR("Unexpected Error."); + } + char* copy = (char*) MLV_MALLOC( (strlen(complete_message)+1), char ); + snprintf(copy, strlen(complete_message)+1, "%s", complete_message); + int result = internal_draw_adapted_text_box_size_with_font( + copy, + font, + sizeInterligne, + result_width, result_height, + NULL + ); + MLV_FREE(copy, char); + free( complete_message ); + return result; +} + +int MLV_get_size_of_adapted_text_box_va( + const char* message, + int sizeInterligne, + int *result_width, int *result_height, + va_list pile +){ + return MLV_get_size_of_adapted_text_box_with_font_va( + message, + MLV_data->defaultFont, + sizeInterligne, + result_width, result_height, + pile + ); +} + +int MLV_get_size_of_adapted_text_box( + const char* message, + int sizeInterligne, + int *result_width, int *result_height, + ... +){ + int result; + va_list pile; + va_start( pile, result_height ); + result = MLV_get_size_of_adapted_text_box_va( + message, sizeInterligne, result_width, result_height, pile + ); + va_end( pile ); + return result; +} + +void MLV_draw_adapted_text_box_with_font( + int x, int y, + const char* message, + const MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, ... +){ + va_list pile; + va_start( pile, text_justification ); + MLV_draw_adapted_text_box_with_font_va( + x, y, message, font, sizeInterligne, borderColor, textColor, + backgroundColor, text_justification, pile + ); + va_end( pile ); +} + +void MLV_draw_adapted_text_box_with_font_on_image( + int x, int y, + const char* message, + const MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Image* image, ... +){ + va_list pile; + va_start( pile, image ); + MLV_draw_adapted_text_box_with_font_on_image_va( + x, y, message, font, sizeInterligne, borderColor, textColor, + backgroundColor, text_justification, image, pile + ); + va_end( pile ); +} + +int MLV_get_size_of_adapted_text_box_with_font( + const char* message, + const MLV_Font* font, + int sizeInterligne, + int *result_width, int *result_height, ... +){ + int result; + va_list pile; + va_start( pile, result_height ); + result = MLV_get_size_of_adapted_text_box_with_font_va( + message, font, sizeInterligne, result_width, result_height, pile + ); + va_end( pile ); + return result; +} + +void internal_draw_text_box_with_font_on_image( + int x, int y, + int width, int height, + const char* message , + const MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + SDL_Surface* image +){ + SDL_Rect rectangle; + rectangle.x = x; + rectangle.y = y; + rectangle.w = width; + rectangle.h = height; + + SDL_Surface* textBox= create_surface( + width, height + ); + SDL_SetAlpha(textBox, SDL_SRCALPHA, SDL_ALPHA_OPAQUE); + SDL_SetColorKey(textBox, SDL_SRCCOLORKEY, backgroundColor); + + boxColor( textBox , 0, 0, width-1, height-1, backgroundColor); + + char* copy = (char*) MLV_MALLOC( (strlen(message)+1), char ); + snprintf(copy, strlen(message)+1, "%s", message); + + int real_width,real_height,width_text; + + int nb_line = internal_draw_adapted_text_box_size_with_font( + copy, font, sizeInterligne, &real_width, &real_height, &width_text + ); + + int position_corner_x; + switch( horizontal_position ){ + case MLV_HORIZONTAL_LEFT: + position_corner_x = 0; + break; + case MLV_HORIZONTAL_RIGHT: + position_corner_x = width - real_width; + break; + case MLV_HORIZONTAL_CENTER: + position_corner_x = (width - real_width)/2; + break; + default: + ERROR("MLV_Vertical_position ne contient pas de bonnes valeurs."); + } + int position_corner_y; + switch( vertical_position ){ + case MLV_VERTICAL_TOP: + position_corner_y = 0; + break; + case MLV_VERTICAL_BOTTOM: + position_corner_y = height - real_height; + break; + case MLV_VERTICAL_CENTER: + position_corner_y = (height - real_height)/2; + break; + default: + ERROR("MLV_Vertical_position ne contient pas de bonnes valeurs."); + } + internal_draw_text_box_with_font( + copy , + font, + sizeInterligne, + borderColor, textColor, backgroundColor, + text_justification, + position_corner_x, + position_corner_y, + width_text, + nb_line, + textBox + ); + + rectangleColor( textBox , 0, 0, width-1, height-1, borderColor); + SDL_BlitSurface( textBox, NULL, image, &rectangle); + SDL_FreeSurface( textBox ); + MLV_FREE(copy, char); +} + +void MLV_draw_text_box_with_font_va( + int x, int y, + int width, int height, + const char* message , + const MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + va_list pile +){ + char* complete_message; + if( vasprintf( &complete_message, message, pile )==-1 ){ + ERROR("Unexpected Error."); + } + internal_draw_text_box_with_font_on_image( + x, y, + width, height, + complete_message, + font, + sizeInterligne, + borderColor, textColor, backgroundColor, + text_justification, + horizontal_position, + vertical_position, + MLV_data->screen + ); + free( complete_message ); +} + +void MLV_draw_text_box_va( + int x, int y, + int width, int height, + const char* message , + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + va_list pile +){ + MLV_draw_text_box_with_font_va( + x, y, width, height, message , MLV_data->defaultFont, sizeInterligne, + borderColor, textColor, backgroundColor, text_justification, + horizontal_position, vertical_position, pile + ); +} + +void MLV_draw_text_box( + int x, int y, + int width, int height, + const char* message , + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + ... +){ + va_list pile; + va_start( pile, vertical_position ); + MLV_draw_text_box_va( + x, y, width, height, message , sizeInterligne, borderColor, textColor, + backgroundColor, text_justification, horizontal_position, + vertical_position, pile + ); + va_end( pile ); +} + +void MLV_draw_text_box_with_font( + int x, int y, + int width, int height, + const char* message , + const MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + ... +){ + va_list pile; + va_start( pile, vertical_position ); + MLV_draw_text_box_with_font_va( + x, y, width, height, message, font, sizeInterligne, + borderColor, textColor, backgroundColor, text_justification, + horizontal_position, vertical_position, pile + ); + va_end( pile ); +} + +void MLV_draw_text_box_with_font_on_image_va( + int x, int y, + int width, int height, + const char* message , + MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + MLV_Image* image, + va_list pile +){ + char* complete_message; + if( vasprintf( &complete_message, message, pile )==-1 ){ + ERROR("Unexpected Error."); + } + internal_draw_text_box_with_font_on_image( + x, y, + width, height, + complete_message, + font, + sizeInterligne, + borderColor, textColor, backgroundColor, + text_justification, + horizontal_position, + vertical_position, + image->surface + ); + free( complete_message ); +} + +void MLV_draw_text_box_with_font_on_image( + int x, int y, + int width, int height, + const char* message , + MLV_Font* font, + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + MLV_Image* image, + ... +){ + va_list pile; + va_start( pile, image ); + MLV_draw_text_box_with_font_on_image_va( + x, y, width, height, message, font, sizeInterligne, borderColor, + textColor, backgroundColor, text_justification, horizontal_position, + vertical_position, image, pile + ); + va_end( pile ); +} + +void MLV_draw_text_box_on_image_va( + int x, int y, + int width, int height, + const char* message , + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + MLV_Image* image, + va_list pile +){ + MLV_draw_text_box_with_font_on_image_va( + x, y, width, height, message, MLV_data->defaultFont, sizeInterligne, + borderColor, textColor, backgroundColor, text_justification, + horizontal_position, vertical_position, image, pile + ); +} + + +void MLV_draw_text_box_on_image( + int x, int y, + int width, int height, + const char* message , + int sizeInterligne, + MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor, + MLV_Text_justification text_justification, + MLV_Horizontal_position horizontal_position, + MLV_Vertical_position vertical_position, + MLV_Image* image, + ... +){ + va_list pile; + va_start( pile, image ); + MLV_draw_text_box_on_image_va( + x, y, width, height, message, sizeInterligne, borderColor, textColor, + backgroundColor, text_justification, horizontal_position, + vertical_position, image, pile + ); + va_end( pile ); +} + +char* MLV_convert_unicode_to_string( int unicode ){ + gunichar v = unicode; + gchar* message; + + int size = g_unichar_to_utf8(v,NULL); + message = (char*) MLV_MALLOC( size + 1, gchar ); + message[ size ] = '\0'; + g_unichar_to_utf8(v, message); + +// const char* encodage; +// g_get_charset( &encodage ); +// printf("encodage : %s\n",encodage); + +// GError* error; +// +// gchar* result = g_locale_from_utf8( +// message, +// -1, +// NULL, +// NULL, +// &error // pas d'erreur +// ); +// +// +// MLV_FREE( message, gchar* ); +// return result; + return message; +} + diff --git a/MLV/text.h b/MLV/text.h new file mode 100644 index 0000000..e4a9eeb --- /dev/null +++ b/MLV/text.h @@ -0,0 +1,52 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#ifndef __MLV__TEXT_H__ +#define __MLV__TEXT_H__ + +#include "platform.h" + +#ifndef MEMORY_DEBUG +#if defined( OS_WINDOWS ) +# include +#elif defined( OS_APPLE ) +# include +#else +# include +#endif +#else +#include "memory_debug.h" +#endif + +struct _MLV_Font { + int size; + TTF_Font* font; +}; + +void init_font(); + +void quit_font(); + +void drawString( + SDL_Surface* textBox, int x, int y, + const char* message, MLV_Color color, TTF_Font* font +); + +#endif diff --git a/MLV/time.c b/MLV/time.c new file mode 100644 index 0000000..82e071a --- /dev/null +++ b/MLV/time.c @@ -0,0 +1,107 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "MLV_time.h" + +#include "platform.h" + +#ifndef MEMORY_DEBUG +#if defined( OS_WINDOWS ) +# include +# include +#elif defined( OS_APPLE ) +# include +# include +#else +# include +# include +#endif +#else +#include "memory_debug.h" +#endif + +#include + +#include "warning_error.h" +#include "memory_management.h" + +#include "data_structure.h" + +extern DataMLV* MLV_data; + + +void MLV_wait_milliseconds(int milliseconds){ + SDL_Delay( milliseconds ); +} + +void MLV_wait_seconds(int seconds){ + SDL_Delay( seconds * 1000 ); +} + +int MLV_get_time(){ + return SDL_GetTicks(); +} + +int MLV_get_date( + int* seconds, int* minutes, int* hours, + int* day, int* month, int* year, + int* day_of_the_week +){ + time_t current_time; + time(¤t_time); + struct tm * timeinfo = localtime (¤t_time); + + if( seconds ){ + *seconds = timeinfo->tm_sec; + } + if( minutes ){ + *minutes = timeinfo->tm_min; + } + if( hours ){ + *hours = timeinfo->tm_hour; + } + if( day ){ + *day = timeinfo->tm_mday; + } + if( month ){ + *month = timeinfo->tm_mon; + } + if( year ){ + *year = timeinfo->tm_year+1900; + } + if( day_of_the_week ){ + *day_of_the_week = timeinfo->tm_wday; + } + return timeinfo->tm_isdst; +} + +void MLV_change_frame_rate( int rate ){ + SDL_setFramerate( &(MLV_data->frame_rate_manager), rate ); +} + +int MLV_get_frame_rate( ){ + return( SDL_getFramerate( &(MLV_data->frame_rate_manager) ) ); +} + +void MLV_delay_according_to_frame_rate( ){ + SDL_framerateDelay( &(MLV_data->frame_rate_manager) ); +} + + diff --git a/MLV/tree_map.c b/MLV/tree_map.c new file mode 100644 index 0000000..efdb6cc --- /dev/null +++ b/MLV/tree_map.c @@ -0,0 +1,182 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "tree_map.h" + +#include "tree_set.h" +#include "warning_error.h" +#include "memory_management.h" + +struct _MLV_TreeMap { + MLV_TreeSet* set; +}; +typedef struct { + MLV_Key* key; + void* data; + void (* data_destroying_function )( void* data ); +} PairKeyData; + +PairKeyData* create_pair_key_data( + MLV_Key* key, + void* data, + void (* data_destroying_function )( void* data ) +){ + PairKeyData* result = MLV_MALLOC( 1, PairKeyData ); + result->key = key; + result->data = data; + result->data_destroying_function = data_destroying_function; + return result; +} + +void free_pair_key_data( PairKeyData* pair ){ + if( pair ){ + MLV_free_key( pair->key ); + if( pair->data_destroying_function ){ + pair->data_destroying_function( pair->data ); + } + } + MLV_FREE( pair, PairKeyData ); +} + +void free_pair_key_data_without_key( PairKeyData* pair ){ + if( pair ){ + if( pair->data_destroying_function ){ + pair->data_destroying_function( pair->data ); + } + } + MLV_FREE( pair, PairKeyData ); +} + + +int compare_pairs_key_data( PairKeyData* pair1, PairKeyData* pair2 ){ + return MLV_compare_keys( pair1->key, pair2->key ); +} + +MLV_TreeMap* MLV_create_tree_map(){ + MLV_TreeMap* result = MLV_MALLOC( 1, MLV_TreeMap ); + result->set = NULL; + return result; +} + +void MLV_add_data_in_tree_map( + MLV_Key* key, void* data, + void (* data_destroying_function)( void* data ), + MLV_TreeMap* tree_map +){ + tree_map->set = MLV_add_data_in_tree_set( + create_pair_key_data( + key, data, data_destroying_function + ), + ( void (*)( void* ) ) free_pair_key_data, + ( int (*)( void*, void* ) ) compare_pairs_key_data, + tree_map->set + ); +} + +void* MLV_get_data_from_tree_map( MLV_Key* key, MLV_TreeMap* tree_map ){ + PairKeyData* key_data = create_pair_key_data( key, NULL, NULL ); + MLV_TreeSet* elem = MLV_find_tree_set( key_data, tree_map->set ); + PairKeyData* founded_key_data = (PairKeyData*) elem->data; + free_pair_key_data_without_key( key_data ); + return founded_key_data->data; +} + +void free_key_of_pair_key_data( PairKeyData* pair ){ + MLV_free_key( pair->key ); +} + +void wrapper_free_key_of_pair_key_data( void* pair, void* useless_data ){ + free_key_of_pair_key_data( ( PairKeyData* ) pair ); +} + +void MLV_init_tree_map( MLV_TreeMap* tree_map ){ + // On supprime les clés + MLV_foreach_data_tree_set( + wrapper_free_key_of_pair_key_data, + NULL, + tree_map->set + ); + // On réinitialise la table + MLV_init_tree_set( tree_map->set ); +} + + +typedef struct { + void* data_user; + void (* key_data_function )( MLV_Key* key, void* data, void* data_user ); +} Wrapper_data_user; + +Wrapper_data_user* create_wrapper_data_user( + void* data_user, + void (* key_data_function )( MLV_Key* key, void* data, void* data_user ) +){ + Wrapper_data_user* result = MLV_MALLOC( 1, Wrapper_data_user ); + result->data_user = data_user; + result->key_data_function = key_data_function; + return result; +} + +void free_wrapper_data_user( Wrapper_data_user* data ){ + MLV_FREE( data, Wrapper_data_user ); +} + +void wrapper_key_data_function( + void* data, + void* data_user +){ + PairKeyData* pair = ( PairKeyData* ) data; + Wrapper_data_user* wrapper_data_user = (Wrapper_data_user*) data_user; + if( wrapper_data_user->key_data_function ){ + wrapper_data_user->key_data_function( + pair->key, pair->data, wrapper_data_user->data_user + ); + } +} + +void MLV_foreach_key_data_tree_map( + void (* key_data_function )( MLV_Key* key, void* data, void* data_user ), + void* data_user, + MLV_TreeMap* tree_map +){ + + Wrapper_data_user* wrapper_data = create_wrapper_data_user( + data_user, key_data_function + ); + MLV_foreach_data_tree_set( + wrapper_key_data_function, + wrapper_data, + tree_map->set + ); + free_wrapper_data_user( wrapper_data ); +} + +void MLV_clear_tree_map( MLV_TreeMap* tree_map ){ + MLV_clear_tree_set( tree_map->set ); +} + +void MLV_free_tree_map( MLV_TreeMap* tree_map ){ + MLV_clear_tree_map( tree_map ); + MLV_FREE( tree_map, MLV_TreeMap ); +} + +void MLV_superficial_free_tree_map( MLV_TreeMap* tree_map ){ + MLV_init_tree_map( tree_map ); + MLV_FREE( tree_map, MLV_TreeMap ); +} diff --git a/MLV/tree_map.h b/MLV/tree_map.h new file mode 100644 index 0000000..9ea5eb8 --- /dev/null +++ b/MLV/tree_map.h @@ -0,0 +1,52 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#ifndef __MLV__TREE_MAP_H__ +#define __MLV__TREE_MAP_H__ + +#include "key.h" + +typedef struct _MLV_TreeMap MLV_TreeMap; + +MLV_TreeMap* MLV_create_tree_map(); + +void MLV_free_tree_map( MLV_TreeMap* tree_map ); + +void MLV_superficial_free_tree_map( MLV_TreeMap* tree_map ); + +void MLV_add_data_in_tree_map( + MLV_Key* key, void* data, + void (* data_destroying_function)( void* data ), + MLV_TreeMap* tree_map +); + +void MLV_init_tree_map( MLV_TreeMap* tree_map ); + +void MLV_clear_tree_map( MLV_TreeMap* tree_map ); + +void* MLV_get_data_from_tree_map( MLV_Key* key, MLV_TreeMap* tree_map ); + +void MLV_foreach_key_data_tree_map( + void (* key_data_function )( MLV_Key* key, void* data, void* data_user ), + void* data_user, + MLV_TreeMap* tree_map +); + +#endif diff --git a/MLV/tree_set.c b/MLV/tree_set.c new file mode 100644 index 0000000..979fa48 --- /dev/null +++ b/MLV/tree_set.c @@ -0,0 +1,527 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "tree_set.h" +#include "warning_error.h" +#include "memory_management.h" +#include "mathematics.h" + +/* + * Renvoie la hauteur d'un arbre + */ +int MLV_get_height_tree_set( MLV_TreeSet* tree_set ){ + if( tree_set==NULL ){ + return 0; + } + return tree_set->height; +} + +/* + * Cette fonction substitue node par new_node + * dans le père de node. + * + * Avant : + * + <-- father + * / \ + * + <-- node + * + * Après : + * + <-- father + * / \ + * + <-- new_node + * + * Cette fonction ne modifie pas le contenu de new_node. + * Cette fonction renvoie un pointeur vers le père. + * Cette fonction n'accepte pas de node NULL. + * + */ +MLV_TreeSet* substitute_in_father_tree_Set( + MLV_TreeSet* node, MLV_TreeSet* new_node +){ + if( node ){ + ERROR_FULL("Node can't be NULL !"); + } + MLV_TreeSet* father = node->father; + if( father ){ + if( father->left_son == node ){ + father->left_son = new_node; + }else{ + father->right_son = new_node; + } + } + new_node->father = father; + return father; +} + +/* + * Renvoie le noeud de l'arbre de valeur de clé maximale. + */ +MLV_TreeSet* MLV_get_maximal_node_of_tree_set( MLV_TreeSet* tree_set ){ + MLV_TreeSet* result = NULL; + while( tree_set ){ + result = tree_set; + tree_set = tree_set->right_son; + } + return result; +} + +/* + * TODO + * + * Cette fonction retire un noeud de l'arbre. + * Cette focntion renvoi un pointeur vers le nouvel arbre + * obtenu. + * + */ +MLV_TreeSet* remove_node_of_tree_set( MLV_TreeSet* tree_set ){ + NOT_IMPLEMENTED; + return NULL; +} + +/* + * Cette fonction détruit les données contenues dans un noeud de l'arbre. + * + */ +void destroy_node_data_of_tree_set( MLV_TreeSet* tree_set ){ + if( tree_set && tree_set->data_destroying_function ){ + tree_set->data_destroying_function( tree_set->data ); + } +} + + +/* + * Cette fonction suprime le noeud (en libérant la mémoire), mais + * ne suprrime pas la donnée qu'elle contient. + * + * Cette fonction renvoie un pointeur vers le nouvel arbre obtenu. + */ +MLV_TreeSet* destroy_node_of_tree_set( MLV_TreeSet* tree_set ){ + MLV_TreeSet* new_tree; + new_tree = remove_node_of_tree_set( tree_set ); + MLV_FREE( tree_set, MLV_TreeSet ); + return new_tree; +} + +/* + * Cette fonction détruit les données contenues dans un noeud, puis suprime le noeud + * de l'arbre et libère la mémoire associée à tree_set. + * + * Cette fonction renvoie un pointeur vers le nouvel arbre obtenu. + * + */ +MLV_TreeSet* destroy_node_and_his_data_of_tree_set( MLV_TreeSet* tree_set ){ + MLV_TreeSet* new_tree; + destroy_node_data_of_tree_set( tree_set ); + new_tree = remove_node_of_tree_set( tree_set ); + MLV_FREE( tree_set, MLV_TreeSet ); + return new_tree; +} + +/* + * Cette fonction cherche un noeud ayant une donnée particulière. + * Cette fonction rencoie le noeud associé à cette donnée. + */ +MLV_TreeSet* MLV_find_tree_set( void* data, MLV_TreeSet* tree_set ){ + if( tree_set == NULL ){ + return NULL; + } + int comparaison = tree_set->sorting_function( data, tree_set->data ); + if( comparaison == 0 ){ + return tree_set; + }else if( comparaison < 0 ){ + return MLV_find_tree_set( data, tree_set->left_son ); + }else{ + return MLV_find_tree_set( data, tree_set->right_son ); + } +} + +/* + * Supprime les données conetenu dans un tree_set et + * les remplaces par une autre donnée. + * La mémoire de l'ancienne donnée est suprimée. + * + */ +void change_data_of_node_tree_set( + void* data, + void (* data_destroying_function )( void* data ), + MLV_TreeSet * tree_set +){ + destroy_node_data_of_tree_set( tree_set ); + tree_set->data = data; + tree_set->data_destroying_function = data_destroying_function; +} + +/* + * Créer un nouveau noeud. + */ +MLV_TreeSet* create_node_tree_set( + MLV_TreeSet* father, MLV_TreeSet* left_son, MLV_TreeSet* right_son, + void* data, + void (* data_destroying_function )( void* data ), + int (* sorting_function )( void* data1, void* data2 ), + int height +){ + MLV_TreeSet* result = MLV_MALLOC( 1, MLV_TreeSet ); + result->father = father; + result->left_son = left_son; + result->right_son = right_son; + result->data = data; + result->data_destroying_function = data_destroying_function; + result->sorting_function = sorting_function; + result->height = height; + return result; +} + +/* + * Cette fonction équilibre localement le sous-arbre tree_set en équilibrant + * que sa racine. + * + * A l'issue de l'équilibrage, elle met à jour les hauteurs de tous les noeuds + * du sous-arbre associée à tree_set. + * Si les fils à tree_set étaient équilibrés, alors, tree_set devient lui aussi + * équilibré. + * + */ +MLV_TreeSet* equilibrate_localy_the_tree_set( MLV_TreeSet* tree_set ){ + if( ! tree_set ) return NULL; + MLV_TreeSet *A, *B, *C, *D, *E, *F, *G; + MLV_TreeSet* father = tree_set->father; + int height_left = MLV_get_height_tree_set( tree_set->left_son ); + int height_right = MLV_get_height_tree_set( tree_set->right_son ); + int comparaison = height_left-height_right; + // Si les fils ont des tailles qui diffèrent d'au plus 1, alors le sous-arbre + // est déjà équilibré et il y a rien à faire. + if( abs( comparaison ) <= 1 ) return tree_set; + // Le sous arbres n'est pas équilibré. + // 4 type d'arbres non équilibrés peuvent se présenter + if( comparaison < 0 ){ + /* B + * / \ + * A \ + * + + */ + B = tree_set; + A = B->left_son; + int height_right_left = MLV_get_height_tree_set( B->right_son->left_son ); + int height_right_right = MLV_get_height_tree_set( B->right_son->right_son ); + if( height_right_left > height_right_right ){ + /* 1er type : + * + * B + * / \ + * A F + * / \ + * D G + * / \ + * C E + */ + F = B->right_son; + D = F->left_son; + G = F->right_son; + C = D->left_son; + E = D->right_son; + }else{ + /* 2ème type : + * + * B + * / \ + * A D + * / \ + * C F + * / \ + * E G + */ + D = B->right_son; + C = D->left_son; + F = D->right_son; + E = F->left_son; + G = F->right_son; + } + }else{ + /* F + * / \ + * / G + * + + */ + F = tree_set; + G = F->right_son; + int height_left_left = MLV_get_height_tree_set( F->left_son->left_son ); + int height_left_right = MLV_get_height_tree_set( F->left_son->right_son ); + if( height_left_right > height_left_left ){ + /* 3ème type : + * + * F + * / \ + * B G + * / \ + * A D + * / \ + * C E + */ + B = F->left_son; + A = B->left_son; + D = B->right_son; + C = D->left_son; + E = D->right_son; + }else{ + /* 4ème type : + * + * F + * / \ + * D G + * / \ + * B E + * / \ + * A C + */ + D = F->left_son; + B = D->left_son; + E = D->right_son; + A = B->left_son; + C = B->right_son; + } + } + /* + * On réordonne l'arbre de façon à obtenir + * + * D + * / \ + * B F + * / \ / \ + * A C E G + */ + A->father = B; + C->father = B; + E->father = F; + G->father = F; + + B->left_son = A; + B->right_son = C; + B->father = D; + B->height = max( A->height, C->height ) + 1; + + F->left_son = E; + F->right_son = G; + F->father = D; + F->height = max( E->height, G->height ) + 1; + + D->left_son = B; + D->right_son = F; + D->father = father; + D->height = max( B->height, F->height ) + 1; + + // On met à jour le père du sous-arbre d'origine + if( father ){ + if( father->left_son == tree_set ){ + father->left_son = D; + }else{ + father->right_son = D; + } + } + return D; +} + +/* + * Algorithme d'insertion d'une nouvelle (cle, data) dans un arbre. + */ +MLV_TreeSet* MLV_add_data_in_tree_set( + void* data, + void (* data_destroying_function )( void* data ), + int (* sorting_function )( void* data1, void* data2 ), + MLV_TreeSet * tree_set +){ + if( tree_set==NULL ){ + return create_node_tree_set( + NULL, NULL, NULL, + data, + data_destroying_function, sorting_function, + 1 + ); + } + // On cherche l'endroit où il faut insérer le noeud dans l'arbre. + MLV_TreeSet* current = tree_set; + MLV_TreeSet* father_of_insertion_point = NULL; + int comparaison; + while( current ){ + comparaison = current->sorting_function( data, current->data ); + if( comparaison == 0 ){ + change_data_of_node_tree_set( + data, data_destroying_function, current + ); + return tree_set; + }else if( comparaison < 0 ){ + father_of_insertion_point = current; + current = current->left_son; + }else{ + father_of_insertion_point = current; + current = current->right_son; + } + } + // on créé un nouveau noeud + current = create_node_tree_set( + father_of_insertion_point, NULL, NULL, + data, + data_destroying_function, sorting_function, + 1 + ); + // On insère le nouveau noeud dans l'arbre. + // Ici, comme tree_set ne peut pas valoir NULL, + // father_of_insertion_point ne peut pas être NULL et + // comparaison contient une valeur. + // Le point d'insertion à donc toujours un père. + if( comparaison<0 ){ + father_of_insertion_point->left_son = current; + }else{ + father_of_insertion_point->right_son = current; + } + // On équilibre l'arbre. + // Pour cela on remonte l'arbre en paratn du sommet ajouté jusqu'à la + // racine et on rééqulibre localement chaque noeud rencontré. + current = father_of_insertion_point; // On part du père car le nouveau + // noeud est toujours équilibré. + MLV_TreeSet* new_root; // La nouvelle racine issue du rééquilibrage local. + while( current ){ + new_root = equilibrate_localy_the_tree_set( current ); + current = new_root->father; + } + // Comme father_of_inserion_point n'est pas NULL (voir explication + // précédente), current n'est pas NULL. Donc, new_root contient un valeur. + // D'après equilibrate_localy_the_tree_set, new_root est un arbre équilibré. + return new_root; +} + +/* + * Execute un fonction sur chaque clé et donné de l'arbre. + */ +void MLV_foreach_data_tree_set( + void (* data_function )( void* data, void* data_user ), + void* data_user, + MLV_TreeSet* tree_set +){ + if( tree_set ){ + if( tree_set->left_son ){ + MLV_foreach_data_tree_set( data_function, data_user, tree_set->left_son ); + } + if( tree_set->right_son ){ + MLV_foreach_data_tree_set( data_function, data_user, tree_set->right_son ); + } + data_function( tree_set->data, data_user ); + } +} + +/* + * Execute un fonction sur chaque noeud de l'arbre. + */ +void foreach_node_tree_set( + void (* node_function)(MLV_TreeSet* tree_set, void* data_user), + void* data_user, + MLV_TreeSet* tree_set +){ + if( tree_set ){ + if( tree_set->left_son ){ + foreach_node_tree_set( node_function, data_user, tree_set->left_son ); + } + if( tree_set->right_son ){ + foreach_node_tree_set( node_function, data_user, tree_set->right_son ); + } + node_function( tree_set, data_user ); + } +} + +/* + * Un wrapper à utiliser avec foreach_node_tree_set. + */ +void wrapper_destroy_node_data_of_tree_set( MLV_TreeSet* tree_set, void* useless_data ){ + destroy_node_data_of_tree_set( tree_set ); +} + +/* + * Un wrapper à utiliser avec foreach_node_tree_set. + */ +void wrapper_remove_node_of_tree_set( MLV_TreeSet* tree_set, void* useless_data ){ + remove_node_of_tree_set( tree_set ); +} + +/* + * Un wrapper à utiliser avec foreach_node_tree_set. + */ +void wrapper_destroy_node_and_his_data_of_tree_set( MLV_TreeSet* tree_set, void* useless_data ){ + destroy_node_and_his_data_of_tree_set( tree_set ); +} + +/* + * Un wrapper à utiliser avec foreach_node_tree_set. + */ +void wrapper_destroy_node_of_tree_set( MLV_TreeSet* tree_set, void* useless_data ){ + destroy_node_of_tree_set( tree_set ); +} + +void free_tree_set( MLV_TreeSet* tree_set, void* useless_data ){ + MLV_FREE( tree_set, MLV_TreeSet ); +} + +/* + * Cette fonction supprime tous les noeuds de l'abre sans détruire les données. + */ +void MLV_init_tree_set( MLV_TreeSet* tree_set ){ + foreach_node_tree_set( free_tree_set, NULL, tree_set ); +} + +void deep_free_tree_set( MLV_TreeSet* tree_set, void* useless_data ){ + destroy_node_data_of_tree_set( tree_set ); + free_tree_set( tree_set, useless_data ); +} + +/* + * Cette fonction supprime tous les noeuds de l'abre et détruit les données + * associé à l'arbre. + */ +void MLV_clear_tree_set( MLV_TreeSet* tree_set ){ + foreach_node_tree_set( deep_free_tree_set, NULL, tree_set ); +} + +/* + * Enlève une donnée de l'esemble. + * La donnée n'est pas supprimée. + */ +MLV_TreeSet* MLV_remove_data_from_tree_set( void* data, MLV_TreeSet* tree_set ){ + MLV_TreeSet* node = MLV_find_tree_set( data, tree_set ); + return destroy_node_of_tree_set( node ); +} + +/* + * Supprime une donnée de l'ensemble. + * La donnée est supprimée. + */ +MLV_TreeSet* MLV_remove_data_and_data_from_tree_set( void* data, MLV_TreeSet* tree_set ){ + MLV_TreeSet* node = MLV_find_tree_set( data, tree_set ); + destroy_node_data_of_tree_set( node ); + return destroy_node_and_his_data_of_tree_set( node ); +} + +/* + * Supprime une donnée de l'ensemble. + * La donnée est supprimée. + */ +int MLV_is_in_tree_set( void* data, MLV_TreeSet* tree_set ){ + return MLV_find_tree_set( data, tree_set )!=NULL ; +} + + diff --git a/MLV/tree_set.h b/MLV/tree_set.h new file mode 100644 index 0000000..9be401c --- /dev/null +++ b/MLV/tree_set.h @@ -0,0 +1,57 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#ifndef __MLV__TREE_SET_H__ +#define __MLV__TREE_SET_H__ + +typedef struct _MLV_TreeSet MLV_TreeSet; + +struct _MLV_TreeSet { + MLV_TreeSet* father; + MLV_TreeSet* left_son; + MLV_TreeSet* right_son; + void* data; + void (* data_destroying_function )( void* data ); + int (* sorting_function )( void* data1, void*data2 ); + int height; +}; + +MLV_TreeSet* MLV_add_data_in_tree_set( + void* data, + void (* data_destroying_function)( void* data ), + int (* sorting_function)( void* data1, void* data2 ), + MLV_TreeSet * tree_set +); + +void MLV_init_tree_set( MLV_TreeSet* tree_set ); + +void MLV_clear_tree_set( MLV_TreeSet* tree_set ); + +void* MLV_get_data_from_tree_set( void* data, MLV_TreeSet* tree_set ); + +MLV_TreeSet* MLV_find_tree_set( void* data, MLV_TreeSet* tree_set ); + +void MLV_foreach_data_tree_set( + void (* data_function )( void* data, void* data_user ), + void* data_user, + MLV_TreeSet* tree_set +); + +#endif diff --git a/MLV/warning_error.h b/MLV/warning_error.h new file mode 100644 index 0000000..bea99ec --- /dev/null +++ b/MLV/warning_error.h @@ -0,0 +1,43 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#ifndef __MLV__WARNING_ERROR_H__ +#define __MLV__WARNING_ERROR_H__ + +#include +#include + +#define ERROR(x) { fprintf( stderr, "Error detected by the function %s() in LibMLV : %s \n", __FUNCTION__, (x) ); exit(1); } + +#define WARNING(x) { fprintf( stderr, "Warning generated by the function %s() in LibMLV : %s \n", __FUNCTION__, (x) ); } + +#define TODO { fprintf( stderr, "The function %s() in LibThis Library is not implemented. \n", __FUNCTION__ ); exit(1); } + +#define DEPRECATED(x) { fprintf( stderr, "The function %s() is deprecated. In the future, this function will disapear. Please use the %s() function instead of.\n", __FUNCTION__, (x) ); } + +#define ERROR_FULL(x) { fprintf( stderr, "Error detected by the function %s() in LibMLV : %s ( file : %s, line : %i) \n", __FUNCTION__, (x), __FILE__, __LINE__ ); exit(1); } + +#define WARNING_FULL(x) { fprintf( stderr, "Warning generated by the function %s() in LibMLV : %s ( file : %s, line : %i) \n", __FUNCTION__, (x), __FILE__, __LINE__ ); } + +#define DEBUG(x) { fprintf( stderr, "DEBUG : %s - line : %i, file : %s\n", (x), __LINE__, __FILE__ ); } + +#define NOT_IMPLEMENTED { fprintf( stderr, "The function %s() in LibMLV ( file : %s, line : %i ) is not implemented.\n", __FUNCTION__, __FILE__, __LINE__ ); exit(1); } + +#endif diff --git a/MLV/window.c b/MLV/window.c new file mode 100644 index 0000000..34640f1 --- /dev/null +++ b/MLV/window.c @@ -0,0 +1,387 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include "MLV_window.h" +#include "MLV_color.h" +#include "MLV_shape.h" + +#include "config.h" + +#include "text.h" + +#include "input_box.h" +#include "MLV_color.h" +#include "MLV_audio.h" +#include +#include + +#include "platform.h" + +#ifndef MEMORY_DEBUG +#if defined( OS_WINDOWS ) +# include +# include +#elif defined( OS_APPLE ) +# include +# include +#else +# include +# include +#endif +#else +#include "memory_debug.h" +#endif + +#include "warning_error.h" + +#include "data_structure.h" +#include "image.h" +#include "memory_management.h" + +#define SIZE_DEFAULT_FONT 12 + +int mlv_sdl_is_initialised = 0; +Uint32 mlv_width_of_desktop = 0; +Uint32 mlv_height_of_desktop = 0; + +DataMLV *MLV_data = NULL; +void (*MLV_call_back_function_for_exit)(void*) = NULL; +void *MLV_call_back_data = NULL; + +int events_filter(const SDL_Event *event){ + if( event->type == SDL_QUIT ){ + if( MLV_call_back_function_for_exit ){ + (*(MLV_call_back_function_for_exit))(MLV_call_back_data); + return 1; + }else{ + exit(0); + } + } + return input_box_events_filter(event); +} + + +/**************************************************************************/ +/* Initialisation and closing functions for default font */ +/**************************************************************************/ +void initialize_default_font( + const char* path_to_font, unsigned int size_font +){ + if( !MLV_data ){ + ERROR("The MLV library has not been yet initialised. To initialise the \ +MLV Library, create a new window with the MLV_create_window function." + ); + } + MLV_data->defaultFont = MLV_load_font( path_to_font, size_font ); +} + +void free_default_font(){ + if( !MLV_data ){ + ERROR("The MLV library has not been yet initialised. To initialise the \ +MLV Library, create a new window with the MLV_create_window function." + ); + } + MLV_free_font( MLV_data->defaultFont ); +} + + + +/**************************************************************************/ +/* Creation d'un fenetre graphique */ +/**************************************************************************/ +void initialise_graphic_window( + unsigned int width, unsigned int height, int full_screen_is_required +){ + #if defined( OS_ANDROID ) + Uint32 video_mode_flags = SDL_SWSURFACE | SDL_SRCALPHA; + #else + Uint32 video_mode_flags = SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_SRCALPHA; + #endif + if( full_screen_is_required ){ + video_mode_flags |= SDL_FULLSCREEN; + } + MLV_data->full_screen_is_enable = full_screen_is_required; + + if( MLV_data->screen ){ + SDL_FreeSurface( MLV_data->screen ); + } + + MLV_data->screen = SDL_SetVideoMode( width, height, MLV_BPP, video_mode_flags ); + width = MLV_data->screen->w; + height = MLV_data->screen->h; + + MLV_data->width = width; + MLV_data->height = height; + MLV_data->rectangle.x = 0; + MLV_data->rectangle.y = 0; + MLV_data->rectangle.w = width; + MLV_data->rectangle.h = height; + if( MLV_data->save_screen ){ + SDL_FreeSurface( MLV_data->screen ); + } + MLV_data->save_screen = create_surface( width, height ); // do we have to use SDL_ALPHA_OPAQUE here ? + if ( MLV_data->screen == NULL ){ + fprintf(stderr,"Unable to set %dx%d video: %s\n", width, height, SDL_GetError()); + exit(1); + } + + /**************************************************************************/ + /* Initialisation de la couleur du fond de la fenetre en noir. */ + /**************************************************************************/ + MLV_draw_filled_rectangle(0,0,width,height,MLV_COLOR_BLACK); + MLV_actualise_window(); +} + + +void initialise_sdl(){ + if( ! mlv_sdl_is_initialised ){ + if( + SDL_Init( + SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO + #if defined( OS_LINUX ) // SDL thread is not supported on Windows and MacOSX + | SDL_INIT_EVENTTHREAD // Cette option est importante ! + // Elle permet de faire en sorte + // que le filtrage des évenements soit fait dés + // réception d'un evenement de la part de l'OS + // Si cette option n'est pas activée, le filtre + // d'evenement est applique seulement après un + // appel à poll_event. Dans ce cas la gestion + // de l'arret automatique du programme après + // utilisation de la croix des fenetre ne + // fonctione plus correctement. En effet, si + // l'utilisateur n'utilise pas de fonction mettant + // en jeu des évènement, le filtre n'est jamais + // appelé et le mécanisme d'arret automatique + // non plus. + #endif + ) <0 + ){ + printf("Unable to init SDL: %s\n", SDL_GetError()); + exit(1); + } + } +} + +void initialise_size_of_desktop(){ + initialise_sdl(); + if( mlv_width_of_desktop==0 || mlv_height_of_desktop==0 ){ + const SDL_VideoInfo* info = SDL_GetVideoInfo(); + mlv_width_of_desktop = info->current_w; + mlv_height_of_desktop = info->current_h; + } +} + +void MLV_create_window_with_default_font( + const char* window_name, const char* icone_name, + unsigned int width, unsigned int height, + const char* path_to_font, unsigned int size_font +){ + if( MLV_data ){ + ERROR("The MLV library has yet been initialised."); + } + /**************************************************************************/ + /* Initialisation de la strcutre de MLV */ + /**************************************************************************/ + MLV_data = MLV_MALLOC( 1, DataMLV ); + MLV_data->screen = NULL; + MLV_data->save_screen = NULL; + + /**************************************************************************/ + /* Initialisation de la libriaire SDL pour l'uilisation de la video et du */ + /* temps */ + /**************************************************************************/ + initialise_sdl(); + + /**************************************************************************/ + /* Save the size of the desktop */ + /**************************************************************************/ + initialise_size_of_desktop(); + + /**************************************************************************/ + /* Creation d'un fenetre graphique */ + /**************************************************************************/ + initialise_graphic_window( width, height, 0 ); + + /**************************************************************************/ + /* Configuration des noms de la fenetre */ + /**************************************************************************/ + SDL_WM_SetCaption(window_name, icone_name); + + /**************************************************************************/ + /* Configuration du mechanisme permettant d'utiliser les boîtes de saisie */ + /**************************************************************************/ + init_input_box_mechanism(); + + /**************************************************************************/ + /* Configuration des fonts */ + /**************************************************************************/ + init_font(); + + /**************************************************************************/ + /* Création d'une font par default */ + /**************************************************************************/ + initialize_default_font( path_to_font, size_font ); + + /**************************************************************************/ + /* Initialise the Framerate Manager */ + /**************************************************************************/ + SDL_initFramerate( &(MLV_data->frame_rate_manager) ); + SDL_setFramerate( &(MLV_data->frame_rate_manager), 100 ); + + /**************************************************************************/ + /* Initialise the internal Framerate Manager for MLV_wait_event */ + /**************************************************************************/ + SDL_initFramerate( &(MLV_data->frame_rate_manager_for_MLV_wait_event) ); + SDL_setFramerate( &(MLV_data->frame_rate_manager_for_MLV_wait_event), 24 ); + + SDL_SetEventFilter(events_filter); +} + +void MLV_create_window( + const char* window_name, const char* icone_name, + unsigned int width, unsigned int height +){ + MLV_create_window_with_default_font( + window_name, icone_name, width, height, + DATA_PATH "/font/DejaVuSerif-Bold.ttf" , SIZE_DEFAULT_FONT + ); +} + +void MLV_change_default_font( + const char* path_to_font, unsigned int size_font +){ + free_default_font(); + initialize_default_font( path_to_font, size_font ); +} + +void MLV_enable_full_screen(){ + initialise_graphic_window( MLV_data->width, MLV_data->height, 1 ); +} + +void MLV_create_full_screen_window( + const char* window_name, const char* icone_name, + unsigned int width, unsigned int height +){ + MLV_create_window( window_name, icone_name, width, height ); + MLV_enable_full_screen(); +} + +void MLV_create_full_screen_window_with_default_font( + const char* window_name, const char* icone_name, + unsigned int width, unsigned int height, + const char* path_to_font, unsigned int size_font +){ + MLV_create_window_with_default_font( + window_name, icone_name, width, height, path_to_font, size_font + ); + MLV_enable_full_screen(); +} + +void MLV_disable_full_screen(){ + initialise_graphic_window( MLV_data->width, MLV_data->height, 0 ); +} + +int MLV_is_full_screen(){ + return MLV_data->full_screen_is_enable; +} + +void MLV_change_window_size( unsigned int with, unsigned int height ){ + initialise_graphic_window( with, height, MLV_data->full_screen_is_enable ); +} + +void MLV_change_window_caption( + const char* window_name, const char* icone_name +){ + SDL_WM_SetCaption( window_name, icone_name ); +} + +void MLV_get_window_size( unsigned int* width, unsigned int* height ){ + *width = MLV_data->width; + *height = MLV_data->height; +} + +int MLV_get_window_height(){ + return MLV_data->height; +} + +int MLV_get_window_width(){ + return MLV_data->width; +} + +void MLV_clear_window( MLV_Color color ){ + MLV_draw_filled_rectangle( + 0, 0, MLV_get_window_width( ), MLV_get_window_height( ), color + ); +} + +void MLV_free_window(){ + if( ! MLV_data ){ + ERROR("No window has been created."); + } + SDL_FreeSurface(MLV_data->screen); + SDL_FreeSurface(MLV_data->save_screen); + free_default_font(); + quit_font(); + MLV_FREE( MLV_data, DataMLV ); + MLV_data = NULL; + SDL_Quit(); + quit_input_box_mechanism(); +} + +void MLV_update_window(){ + if( (! MLV_data ) || (! MLV_data->screen) ){ + ERROR("A window can't be displayed whitout being created."); + } + SDL_Flip(MLV_data->screen); +} + +#ifndef OS_APPLE // Hack to compile with MAC OS 10.9 (maverick) +inline +#endif +void MLV_actualise_window(){ + MLV_update_window(); +} + +void MLV_execute_at_exit( void (*function)(void*), void* data ){ + if( MLV_data ){ + ERROR("The mlv window is yet initialized. The function execute_at_exit() must be executed before the create_window() function."); + } + if( MLV_call_back_function_for_exit ){ + ERROR("The call back function for exiting program is yet initialized."); + } + MLV_call_back_function_for_exit = function; + MLV_call_back_data = data; +} + +void MLV_get_desktop_size( unsigned int* width, unsigned int* height ){ + initialise_size_of_desktop(); + *width = mlv_width_of_desktop; + *height = mlv_height_of_desktop; +} + +int MLV_get_desktop_height( ){ + initialise_size_of_desktop(); + return mlv_height_of_desktop; +} + +int MLV_get_desktop_width( ){ + initialise_size_of_desktop(); + return mlv_width_of_desktop; +} diff --git a/MLV/xml.c b/MLV/xml.c new file mode 100644 index 0000000..5c6a1d7 --- /dev/null +++ b/MLV/xml.c @@ -0,0 +1,376 @@ +/* + * This file is part of the MLV Library. + * + * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein + * + * + * This Library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Library. If not, see . + */ + +#include + +#include "platform.h" + +#ifdef OS_WINDOWS +/* Get va_list. */ +#if __STDC__ || defined __cplusplus || defined _MSC_VER +# include +#else +# include +#endif +extern int vasprintf (char **, const char *, va_list); +extern int asprintf (char **, const char *, ...); +#endif + +#include "MLV_xml.h" +#include "MLV_xml_va.h" + +#include "warning_error.h" + +#include "memory_management.h" + +#include "data_structure.h" + +#include + +#include +#include +#include +#include + +#include + +extern DataMLV* MLV_data; + +struct _MLV_Xml { + xmlDocPtr doc; +// xmlNodePtr cur; +}; + +MLV_Xml* MLV_load_xml( const char* xml_file_path ){ + MLV_Xml* result = MLV_MALLOC( 1, MLV_Xml ); + + result->doc = xmlParseFile( xml_file_path ); + + if (result->doc == NULL ) { + fprintf(stderr,"Document not parsed successfully. \n"); + MLV_FREE( result, MLV_Xml ); + return NULL; + } + +// result->cur = xmlDocGetRootElement( result->doc ); +// +// if ( result->cur == NULL) { +// fprintf(stderr,"empty document\n"); +// xmlFreeDoc(result->doc); +// MLV_FREE( result, MLV_Xml ); +// return NULL; +// } + + return result; +} + +void MLV_free_xml( MLV_Xml* xml_data ){ + if( xml_data ){ + if( xml_data->doc ){ + xmlFreeDoc( xml_data->doc ); + } + MLV_FREE( xml_data, MLV_Xml ); + } +} + + +void test_if_text_is_valid( const char* text, const char* xpath ){ + if( ! text ){ + char* message; + if( + asprintf( + &message, + "The xml file is probably corupted. The following element is not present: \"%s\" in the xml file.", + xpath + ) < 0 + ){ + ERROR_FULL("The error message can be constructed."); + } + ERROR( message ); + } +} + +void internal_scan_xml( + const MLV_Xml* xml_data, const char* xpath, va_list pile, + xmlXPathObjectPtr *result_search +){ + xmlXPathContextPtr context; + + char* complete_xpath; + if( vasprintf( &complete_xpath, xpath, pile ) < 0 ){ + ERROR_FULL("Unexpected error"); + } + + context = xmlXPathNewContext( xml_data->doc ); + *result_search = xmlXPathEvalExpression( (xmlChar*) complete_xpath, context); + MLV_FREE( complete_xpath, char ); + xmlXPathFreeContext( context ); + if( xmlXPathNodeSetIsEmpty((*result_search)->nodesetval) ){ + xmlXPathFreeObject((*result_search)); + *result_search = NULL; + } +} + + +char* internal_get_string_value_from_xml( + const MLV_Xml* xml_data, int i, const char* xpath, va_list pile +){ + char* result = NULL; + + xmlXPathObjectPtr result_search; + internal_scan_xml( xml_data, xpath, pile, &result_search ); + if( !result_search ) return NULL; + + xmlNodeSetPtr nodeset; + nodeset = result_search->nodesetval; + if( i < nodeset->nodeNr ){ + result = (char*) xmlNodeListGetString( + xml_data->doc, nodeset->nodeTab[i]->xmlChildrenNode, 1 + ); + } + xmlXPathFreeObject(result_search); + return result; +} + +MLV_Xml_error MLV_get_string_value_from_xml_va( + const MLV_Xml* xml_data, char** result, const char* xpath, va_list pile +){ + *result = internal_get_string_value_from_xml( xml_data, 0, xpath, pile ); + if( *result == NULL ){ + return MLV_XML_THE_FIELD_DOESNT_EXIST; + } + return MLV_XML_NONE; +} + +MLV_Xml_error MLV_get_string_value_from_xml( + const MLV_Xml* xml_data, char** result, const char* xpath, ... +){ + MLV_Xml_error error; + + va_list pile; + va_start( pile, xpath ); + + error = MLV_get_string_value_from_xml_va( xml_data, result, xpath, pile ); + + va_end( pile ); + + return error; +} + +MLV_Xml_error MLV_get_integer_value_from_xml_va( + const MLV_Xml* xml_data, int* result, const char* xpath, va_list pile +){ + long int value; + char* text; + MLV_Xml_error error; + + error = MLV_get_string_value_from_xml_va( xml_data, &text, xpath, pile ); + + if( error ){ + return error; + } + + char* final; + errno = 0; + value = strtol(text, &final, 10 ); + int err_sys = errno; + if( (final==NULL) || (*text='\0') || (*final != '\0') ){ + error = MLV_XML_THE_FIELD_IS_NOT_AN_INTEGER; + }else if( err_sys==ERANGE ){ + error = MLV_XML_THE_FIELD_IS_TOO_BIG; + }else if( err_sys != 0 && value == 0 ){ + ERROR_FULL("A anormal error occurs during string to int conversion in XML Parsing." ); + }else{ + error = MLV_XML_NONE; + } + MLV_FREE( text, char ); + + *result = value; + + return error; +} + + +MLV_Xml_error MLV_get_integer_value_from_xml( + const MLV_Xml* xml_data, int* result, const char* xpath, ... +){ + MLV_Xml_error error; + + va_list pile; + va_start( pile, xpath ); + + error = MLV_get_integer_value_from_xml_va( xml_data, result, xpath, pile ); + + va_end( pile ); + return error; +} + +MLV_Xml_error MLV_get_double_value_from_xml_va( + const MLV_Xml* xml_data, double* result, const char* xpath, va_list pile +){ + double value; + char* text; + MLV_Xml_error error; + + error = MLV_get_string_value_from_xml_va( xml_data, &text, xpath, pile ); + + if( error ){ + return error; + } + + char* final; + errno = 0; + value = strtod(text, &final ); + int err_sys = errno; + if( (final==NULL) || (*text='\0') || (*final != '\0') ){ + error = MLV_XML_THE_FIELD_IS_NOT_A_REAL; + }else if( err_sys==ERANGE ){ + error = MLV_XML_THE_FIELD_IS_TOO_BIG; + }else if( err_sys != 0 && value == 0 ){ + ERROR_FULL("A anormal error occurs during string to double conversion in XML Parsing." ); + }else{ + error = MLV_XML_NONE; + } + MLV_FREE( text, char ); + + *result = value; + + return error; +} + +MLV_Xml_error MLV_get_double_value_from_xml( + const MLV_Xml* xml_data, double* result, const char* xpath, ... +){ + MLV_Xml_error error; + + va_list pile; + va_start( pile, xpath ); + + error = MLV_get_double_value_from_xml_va( xml_data, result, xpath, pile ); + + va_end( pile ); + + return error; +} + +MLV_Xml_error MLV_get_float_value_from_xml_va( + const MLV_Xml* xml_data, float* result, const char* xpath, va_list pile +){ + float value; + char* text; + MLV_Xml_error error; + + error = MLV_get_string_value_from_xml_va( xml_data, &text, xpath, pile ); + + if( error ){ + return error; + } + + char* final; + errno = 0; + value = strtof(text, &final); + int err_sys = errno; + if( (final==NULL) || (*text='\0') || (*final != '\0') ){ + error = MLV_XML_THE_FIELD_IS_NOT_A_REAL; + }else if( err_sys==ERANGE ){ + error = MLV_XML_THE_FIELD_IS_TOO_BIG; + }else if( err_sys != 0 && value == 0 ){ + ERROR_FULL("A anormal error occurs during string to double conversion in XML Parsing." ); + }else{ + error = MLV_XML_NONE; + } + MLV_FREE( text, char ); + + *result = value; + + return error; +} + +MLV_Xml_error MLV_get_float_value_from_xml( + const MLV_Xml* xml_data, float* result, const char* xpath, ... +){ + MLV_Xml_error error; + + va_list pile; + va_start( pile, xpath ); + + error = MLV_get_float_value_from_xml_va( xml_data, result, xpath, pile ); + + va_end( pile ); + + return error; +} + +int MLV_get_number_of_objects_from_xml_va( + const MLV_Xml* xml_data, const char* xpath, va_list pile +){ + int result; + + xmlXPathObjectPtr result_search; + internal_scan_xml( xml_data, xpath, pile, &result_search ); + + if( !result_search ) return 0; + result = result_search->nodesetval->nodeNr; + + xmlXPathFreeObject(result_search); + return result; +} + +int MLV_get_number_of_objects_from_xml( + const MLV_Xml* xml_data, const char* xpath, ... +){ + int result; + + va_list pile; + va_start( pile, xpath ); + + result = MLV_get_number_of_objects_from_xml_va( xml_data, xpath, pile ); + + va_end( pile ); + + return result; +} + +MLV_Xml* MLV_get_xml_object_of_va( + const MLV_Xml* xml_data, const char* xpath, va_list pile +){ + MLV_Xml* result = NULL; + ERROR_FULL("Not implemented."); + return result; +} + +MLV_Xml* MLV_get_xml_object_of( + const MLV_Xml* xml_data, const char* xpath, ... +){ + MLV_Xml* result; + + va_list pile; + va_start( pile, xpath ); + + result = MLV_get_xml_object_of_va( xml_data, xpath, pile ); + + va_end( pile ); + + return result; +} + +void MLV_print_xml( const MLV_Xml* xml_data ){ + ERROR_FULL("Not implemented."); +} diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..232338f --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +# Compiler +CC = gcc + +# Compiler flags +CFLAGS = -Wall -pedantic -ansi + +# Linker flags +LDFLAGS = -lMLV + +# Target executable +TARGET = maison + +# Source files +SRCS = maison.c + +# Object files +OBJS = $(SRCS:.c=.o) + +# Default target +all: $(TARGET) + +# Link the target executable +$(TARGET): $(OBJS) + $(CC) $(OBJS) -o $(TARGET) $(LDFLAGS) + +# Compile source files to object files +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +# Clean up build files +clean: + rm -f $(OBJS) $(TARGET) + +# Phony targets +.PHONY: all clean \ No newline at end of file diff --git a/maison.c b/maison.c new file mode 100644 index 0000000..9593971 --- /dev/null +++ b/maison.c @@ -0,0 +1,212 @@ +/** + * + * Ce programme montre comment il est possible de dessiner les figures + * géométriques suivantes : + * + * cercle + * disque ( cercle plein ) + * ellipse + * ellipse pleine + * rectangle + * rectangle plein + * ligne + * point + * Courbe de Bézier + * polygone + * polygone plein + * + * Pour cela le programme utilise les fonctions suivantes : + * + *------------------------------------------------------------------------------ + * MLV_draw_circle: Dessine un cercle à une position et un rayon spécifiés en + * paramètres. + * + * void MLV_draw_circle( + * int x, Coordonnée en X du centre du cercle + * int y, Coordonnée en Y du centre du cercle + * int radius, Rayon du cercle + * MLV_Color color Couleur du tracé + * ); + * + * ----------------------------------------------------------------------------- + * MLV_draw_filled_circle : Dessine un disque plein dont le centre et le rayon + * sont passés en parametres. + * + * void MLV_draw_filled_circle( + * int x, Coordonnée en X du centre du cercle + * int y, Coordonnée en Y du centre du cercle + * int radius, Rayon du cercle + * MLV_Color color Couleur du tracé + * ); + * + * ----------------------------------------------------------------------------- + * MLV_draw_ellipse : Dessine une ellipse dont la position, les rayons et la + * couleur sont passés en paramètres. + * + * MLV_draw_ellipse( + * int x, Coordonnée en X du centre de l'ellipse + * int y, Coordonnée en Y du centre de l'ellipse + * int radius_x, Rayon en X de l'ellipse + * int radius_y, Rayon en Y de l'ellipse + * MLV_Color color Couleur du tracé + * ); + * + * ----------------------------------------------------------------------------- + * MLV_draw_filled_ellipse : Dessine une ellipse pleine dont la position, les + * rayons et la couleur sont passés en paramètres. + * + * void MLV_draw_filled_ellipse( + * int x, Coordonnee en X du centre de l'ellipse + * int y, Coordonnee en Y du centre de l'ellipse + * int radius_x, Rayon en X de l'ellipse + * int radius_y, Rayon en Y de l'ellipse + * MLV_Color color Couleur du tracé + * ); + * + * ----------------------------------------------------------------------------- + * MLV_draw_rectangle : Dessine un rectangle dont la taille, la couleur et la + * position du sommet Nord-Ouest sont données en + * paramètres. + * + * void MLV_draw_rectangle( + * int x, Coordonnée en X du sommet Nord-Ouest du rectangle + * int y, Coordonnée en Y du sommet Nord-Ouest du rectangle + * int width, Largeur du rectangle + * int height, Hauteur du rectangle + * MLV_Color color Couleur du tracé + * ); + * + * ----------------------------------------------------------------------------- + * MLV_draw_filled_rectangle : Dessine un rectangle dont la taille, la couleur + * et la position du sommet Nord-Ouest sont données + * en paramètres. + * void MLV_draw_filled_rectangle( + * int x, Coordonnée en X du sommet Nord-Ouest du rectangle + * int y, Coordonnée en Y du sommet Nord-Ouest du rectangle + * int width, Largeur du rectangle + * int height, Hauteur du rectangle + * MLV_Color color Couleur du tracé + * ); + * + * ----------------------------------------------------------------------------- + * MLV_draw_line : Dessine une ligne dont les coordonnées des deux extrémités + * sont passées en paramètres. + * void MLV_draw_line( + * int x1, Coordonnée en X de la première extrémité de la ligne + * int y1, Coordonnée en Y de la première extrémité de la ligne + * int x2, Coordonnée en X de la deuxième extrémité de la ligne + * int y2, Coordonnée en Y de la deuxième extrémité de la ligne + * MLV_Color color Couleur du tracé + * ); + * + * ----------------------------------------------------------------------------- + * MLV_draw_point : Dessine un point dont les coordonées sont passées + * en paramètres. + * + * void MLV_draw_point( + * int x, Coordonnée en X du point + * int y, Coordonnée en Y du point + * MLV_Color color Couleur du tracé + * ); + * + * ----------------------------------------------------------------------------- + * MLV_draw_bezier_curve: Dessine une courbe de Bézier à partir d'une liste de + * sommets. + * + * void MLV_draw_bezier_curve( + * const int* vx, La liste des coordonnées en X des différents + * sommets de la courbe. + * const int* vy, La liste des coordonnées en Y des différents + * sommets de la courbe. + * int npoints, Le nombre de sommets de la courbe de Bézier. + * MLV_Color color La couleur du tracé + * ); + * + * ----------------------------------------------------------------------------- + * MLV_draw_polygon: Dessine un polygone à partir d'une liste de sommets. + * + * void MLV_draw_polygon( + * const int* vx, La liste des coordonnées en X des différents + * sommets du polygone. + * const int* vy, La liste des coordonnées en Y des différents + * sommets du polygone. + * int npoints, Le nombre de sommets du polygone. + * MLV_Color color La couleur du tracé + * ); + * + * ----------------------------------------------------------------------------- + * MLV_draw_polygon: Dessine un polygone plein à partir d'une liste de sommets. + * + * void MLV_draw_filled_polygon( + * const int* vx, La liste des coordonnées en X des différents + * sommets du polygone. + * const int* vy, La liste des coordonnées en Y des différents + * sommets du polygone. + * int npoints, Le nombre de sommets du polygone. + * MLV_Color color La couleur du tracé + * ); + * + * ----------------------------------------------------------------------------- + * + * Il existe d'autres fonctions de dessin. Vous les trouverez en consultant + * le fichier MLV_shape.h ou en tapant dans le terminal la commande : + * + * man MLV_shape.h + */ + + #include + + int main(int argc, char *argv[]) { + /* Créé et affiche la fenêtre */ + MLV_create_window("beginner - 2 - shapes", "shapes", 640, 480); + + /* Dessine des cercles, ellipses, rectangles, lignes et points */ + MLV_draw_circle(20, 20, 10, MLV_COLOR_PURPLE); + MLV_draw_filled_circle(50, 20, 10, MLV_COLOR_BROWN); + MLV_draw_ellipse(100, 20, 30, 10, MLV_COLOR_CYAN); + MLV_draw_filled_ellipse(170, 20, 30, 10, MLV_COLOR_PINK); + MLV_draw_rectangle(10, 50, 40, 20, MLV_COLOR_BLUE); + MLV_draw_filled_rectangle(70, 50, 40, 20, MLV_COLOR_GREEN); + MLV_draw_line(120, 50, 160, 90, MLV_COLOR_WHITE); + MLV_draw_point(10, 110, MLV_COLOR_RED); + + /* Déclare les coordonnées pour la courbe de Bézier */ + int coordonnee_x[4] = {10, 50, 90, 130}; + int coordonnee_y[4] = {150, 190, 150, 190}; + + /* Dessine une courbe de Bézier avec ses sommets */ + MLV_draw_bezier_curve(coordonnee_x, coordonnee_y, 4, MLV_COLOR_RED); + MLV_draw_circle(coordonnee_x[0], coordonnee_y[0], 3, MLV_COLOR_GREEN); + MLV_draw_circle(coordonnee_x[1], coordonnee_y[1], 3, MLV_COLOR_GREEN); + MLV_draw_circle(coordonnee_x[2], coordonnee_y[2], 3, MLV_COLOR_GREEN); + MLV_draw_circle(coordonnee_x[3], coordonnee_y[3], 3, MLV_COLOR_GREEN); + + /* Déclare les coordonnées pour le polygone */ + int coordonnee1_x[4] = {200, 240, 320, 280}; + int coordonnee1_y[4] = {150, 190, 190, 150}; + + /* Dessine un polygone avec ses sommets */ + MLV_draw_filled_polygon(coordonnee1_x, coordonnee1_y, 4, MLV_COLOR_BLUE); + MLV_draw_polygon(coordonnee1_x, coordonnee1_y, 4, MLV_COLOR_RED); + MLV_draw_circle(coordonnee1_x[0], coordonnee1_y[0], 3, MLV_COLOR_GREEN); + MLV_draw_circle(coordonnee1_x[1], coordonnee1_y[1], 3, MLV_COLOR_GREEN); + MLV_draw_circle(coordonnee1_x[2], coordonnee1_y[2], 3, MLV_COLOR_GREEN); + MLV_draw_circle(coordonnee1_x[3], coordonnee1_y[3], 3, MLV_COLOR_GREEN); + + /* Affiche du texte */ + MLV_draw_text( + 10, 120, + "Juste au dessus de cette ligne, il y a un pixel rouge.", + MLV_COLOR_MAGENTA + ); + + /* Met à jour l'affichage */ + MLV_actualise_window(); + + /* Attend 10 secondes avant la fin du programme */ + MLV_wait_seconds(10); + + /* Fermer la fenêtre */ + MLV_free_window(); + return 0; + } \ No newline at end of file