-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFenetre.pde
74 lines (67 loc) · 2.14 KB
/
Fenetre.pde
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*********************************************************************************************************
Titre du Programme : Gestion d'Attaque Spatiale (GAS)
**********************************************************************************************************
Date de création du programme : 23/01/2018
**********************************************************************************************************
Auteurs : Berenger Florian, Said Djambae
Lycée : Pierre Termier
**********************************************************************************************************
Nom du fichier : Fenetre
*********************************************************************************************************/
class Fenetre {
Bouton[] B;
Champ[] Chaine;
PVector Pos;
String Titre ="-";
Boolean Aff = false;
int Long =width/4 ,Larg =height/2;
Fenetre(float x, float y, int Nbouton, int Nchamp) {
B = new Bouton[Nbouton];
Chaine = new Champ[Nchamp];
Pos = new PVector(x, y);
}
void draw() {
textAlign(CENTER, TOP);
stroke(0);
fill(0, 0, 0, 200);
rect(Pos.x, Pos.y, width - Pos.x , height - Pos.y ); //dessiner la fenêtre
fill(255);
text(Titre,Pos.x+Long/2,Pos.y);
for (Bouton B : B) {
try {
B.draw(); //dessiner tous les boutons
}
catch(NullPointerException e) {
}
}
for (Champ C : Chaine) {
try {
C.draw();
}
catch(NullPointerException e) {
}
}
}
void InitBouton(int Index, float x, float y, int Long, int Larg) {
B[Index] = new Bouton(Pos.x+x, Pos.y+y, Long, Larg, Index);
}
void InitChamp(int Index, float x, float y, String Ch) {
Chaine[Index] = new Champ(Pos.x+x, Pos.y+y, Ch);
}
void mousePressed(){
try {
for (Bouton B : B) {
B.mousePressed();
}
}catch(NullPointerException e) {
}
}
void mouseReleased(){
try {
for (Bouton B : B) {
B.mouseReleased();
}
}catch(NullPointerException e) {
}
}
}