aboutsummaryrefslogtreecommitdiff
path: root/semestre 2/informatique/tme/semaine2/10_carre.c
blob: 45029bba49f7142e80f256936f0643990f61023e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <cini.h>

void carre(int c, int x, int y){
	for (int i = 0; i<c;i++){
		CINI_draw_pixel(x+i, y, "blue");
		CINI_draw_pixel(x+i, y+c, "green");
		CINI_draw_pixel(x, y+i, "red");
		CINI_draw_pixel(x+c, y+i, "black");
	}
}

void carres_remontant(int c, int x, int y){
	int nx = x, ny = y;
	while (nx >= 0 && ny >= 0){
		carre(c, nx, ny);
		nx -= 20;
		ny -= 20;
	}
}

int main() {
	CINI_open_window(400, 400, "Carre");
	CINI_fill_window("white");
	carres_remontant(100, 50, 100);
	CINI_loop();

	return 0;
}