Ce programme montre comment il est possible de faire arrêter proprement un programme lorsque l'utilisateur demande son arrêt en appuyant sur la croix de la fenêtre, ou en envoyant un signal sytème d'arret du programme.
void exit_function( void* data ){
int* arret = (int*) data;
*arret = 1;
}
void affichage( int width, int height ){
int elapsed_time;
10, 100,
"Ce programme ne s'arête pas.\nToutefois, vous pouvez fermer le programme en fermant simplement la fenêtre.\n A ce moment là il est possible,\n à l'aide d'une fonction de rappel,\n d'exécuter un dernier code.",
9,
);
10, 400,
"Ca fait %d secondes que j'attends que vous quittiez ce programme.",
);
}
int main(int argc, char *argv[]){
int arret = 0;
int width = 640, height = 480;
while( ! arret ){
affichage( width, height );
}
200, 300,
"Au revoir et à bientôt!",
9,
);
return 0;
}
Fichier d'entête principal incluant tous les autres fichiers entêtes de la bibliothèque MLV.
#define MLV_COLOR_GREEN
Definition: MLV_color.h:931
#define MLV_COLOR_BLACK
Definition: MLV_color.h:379
#define MLV_COLOR_RED
Definition: MLV_color.h:1297
void MLV_draw_text(int x, int y, const cine">
MLV_MOUSE_BUTTON
MLVRZ"el" href="MLV__window_8h_a1e59e14fb2c6057e63a2b916baf347ee.html#a1e59e14fb2c6057e63a2b916baf347ee">MLV_window.h
MLV_execute_at_exit() :
free( texte2 );