Updated house
This commit is contained in:
30
maison.c
30
maison.c
@@ -156,11 +156,23 @@
|
||||
|
||||
#include <MLV/MLV_all.h>
|
||||
|
||||
int quit(void)
|
||||
{
|
||||
MLV_free_window();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
/* Créé et affiche la fenêtre */
|
||||
MLV_create_window("House Drawing", "House", 640, 480);
|
||||
|
||||
/* Dessine le ciel (rectangle bleu) */
|
||||
MLV_draw_filled_rectangle(0, 0, 640, 480, MLV_COLOR_SKY_BLUE);
|
||||
|
||||
/* Dessine l'herbe (rectangle vert) */
|
||||
MLV_draw_filled_rectangle(0, 400, 640, 80, MLV_COLOR_GREEN);
|
||||
|
||||
/* Dessine le mur principal (carré rouge) */
|
||||
MLV_draw_filled_rectangle(200, 200, 200, 200, MLV_COLOR_RED);
|
||||
|
||||
@@ -178,17 +190,21 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Dessine le soleil (cercle jaune) */
|
||||
MLV_draw_filled_circle(500, 100, 50, MLV_COLOR_YELLOW);
|
||||
|
||||
/* Dessine l'herbe (rectangle vert) */
|
||||
MLV_draw_filled_rectangle(0, 400, 640, 80, MLV_COLOR_GREEN);
|
||||
|
||||
/* Text: press ESC to quit */
|
||||
MLV_draw_text(10, 10, "Press ESC to quit", MLV_COLOR_BLACK);
|
||||
|
||||
/* Met à jour l'affichage */
|
||||
MLV_actualise_window();
|
||||
|
||||
/* Attend que l'utilisateur appuie sur la touche Échap pour quitter */
|
||||
MLV_Keyboard_button key;
|
||||
do {
|
||||
MLV_wait_keyboard(&key, NULL, NULL);
|
||||
} while (key != MLV_KEYBOARD_ESCAPE);
|
||||
|
||||
/* Attend 10 secondes avant la fin du programme */
|
||||
MLV_wait_seconds(20);
|
||||
/* Appelle la fonction quit pour fermer la fenêtre */
|
||||
quit();
|
||||
|
||||
/* Fermer la fenêtre */
|
||||
MLV_free_window();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user