Subversion Repository Public Repository

Fangh

Diff Revisions 41 vs 42 for /trunk/FenetreMap.cpp

Diff revisions: vs.
  @@ -1,5 +1,6 @@
1 1 #include "FenetreMap.h"
2 2 #include "borderlayout.h"
3 + #include "jeu.h"
3 4 #include <QtGui>
4 5
5 6 FenetreMap::FenetreMap(){
  @@ -9,7 +10,15 @@
9 10 FenetreMap::FenetreMap(MainWindow *_parent, QString &_imageName)
10 11 : IWidget(_parent,_imageName){
11 12
13 + QString fm("../Ressources/Fond_Map_Enigme.png");
14 + zonesEnigmes = new IWidget(parentWindow,fm);
15 + zonesEnigmes->setParent(this);
16 + zonesEnigmes->move(682,485);
17 + zonesEnigmes->resize(283,234);
18 + zonesEnigmes->hide();
12 19 creerBoutons();
20 + //enigme1->setParent(zonesEnigmes);
21 + //enigme2->setParent(zonesEnigmes);
13 22
14 23 QImage fond("../Ressources/gobelin2.png");
15 24 QPixmap pixfond(fond.width(),fond.height());
  @@ -19,34 +28,47 @@
19 28
20 29 imgGob = new QLabel(this);
21 30 imgGob->setPixmap(QPixmap::fromImage(fond));
22 - imgGob->move(554,456);
31 + imgGob->move(553,450);
23 32
33 + maison->resize(59,103);
34 + maison->move(554,439);
35 + maison->setFlat(true);
36 + // maison->setUpdatesEnabled(true);
37 + maison->show();
24 38 tourBD->resize(56,89);
25 - tourBD->move(632,330);
39 + tourBD->move(619,327);
26 40 tourBD->setFlat(true);
27 41 tourBD->setUpdatesEnabled(true);
28 42 tourBD->show();
29 43 tourBG->resize(56,89);
30 - tourBG->move(357,460);
44 + tourBG->move(369,443);
31 45 tourBG->setFlat(true);
32 46 tourBG->setUpdatesEnabled(true);
33 47 tourBG->show();
34 48 tourHD->resize(56,89);
35 - tourHD->move(614,203);
49 + tourHD->move(603,213);
36 50 tourHD->setFlat(true);
37 51 tourHD->setUpdatesEnabled(true);
38 52 tourHD->show();
39 53 tourHG->resize(56,89);
40 - tourHG->move(358,247);
54 + tourHG->move(369,253);
41 55 tourHG->setFlat(true);
42 56 tourHG->setUpdatesEnabled(true);
43 57 tourHG->show();
44 - chateau->resize(201,177);
45 - chateau->move(351,52);
58 + chateau->resize(201,170);
59 + chateau->move(364,83);
46 60 chateau->setFlat(true);
47 61 chateau->setUpdatesEnabled(true);
48 62 chateau->show();
49 63
64 + // a changer quand on a les enigmes
65 + enigme1->resize(168,37);
66 + enigme1->move(745,572);
67 + enigme1->hide();
68 + enigme2->resize(168,37);
69 + enigme2->move(745,638);
70 + enigme2->hide();
71 +
50 72 }
51 73
52 74 FenetreMap::~FenetreMap() {
  @@ -55,45 +77,137 @@
55 77 delete tourHD;
56 78 delete tourHG;
57 79 delete chateau;
80 + delete enigme1;
81 + delete enigme2;
82 + delete maison;
83 +
84 + delete imgMap;
85 + delete imgGob;
58 86 }
59 87
88 +
60 89 void FenetreMap::creerBoutons() {
61 90
91 + maison = new QPushButton(this);
62 92 tourBD = new QPushButton(this);
63 93 tourBG = new QPushButton(this);
64 94 tourHD = new QPushButton(this);
65 95 tourHG = new QPushButton(this);
66 96 chateau = new QPushButton(this);
97 + enigme1 = new QPushButton(this);
98 + enigme2 = new QPushButton(this);
67 99
68 - connect(tourBD, SIGNAL(clicked()), this, SLOT(connectEnigmetbd()));
69 - connect(tourBG, SIGNAL(clicked()), this, SLOT(connectEnigmetbg()));
70 - connect(tourHD, SIGNAL(clicked()), this, SLOT(connectEnigmethd()));
71 - connect(tourHG, SIGNAL(clicked()), this, SLOT(connectEnigmethg()));
72 - connect(chateau, SIGNAL(clicked()), this, SLOT(connectEnigmetch()));
100 + connect(maison, SIGNAL(clicked()), this, SLOT(connectMaison()));
101 + connect(tourBD, SIGNAL(clicked()), this, SLOT(connectOffrebd()));
102 + connect(tourBG, SIGNAL(clicked()), this, SLOT(connectOffrebg()));
103 + connect(tourHD, SIGNAL(clicked()), this, SLOT(connectOffrehd()));
104 + connect(tourHG, SIGNAL(clicked()), this, SLOT(connectOffrehg()));
105 + connect(chateau, SIGNAL(clicked()), this, SLOT(connectOffrech()));
73 106
74 - }
107 + connect(enigme1, SIGNAL(clicked()), this, SLOT(connectEnigme1()));
108 + connect(enigme2, SIGNAL(clicked()), this, SLOT(connectEnigme2()));
75 109
76 - void FenetreMap::connectEnigmetbd() {
77 - imgGob->move(632,330);
78 - parentWindow->Enigmes();
79 110 }
80 111
81 - void FenetreMap::connectEnigmetbg() {
82 - imgGob->move(357,460);
83 - parentWindow->Enigmes();
112 + void FenetreMap::connectMaison(){
113 + Jeu *j = parentWindow->getJeu();
114 + const Tour * posi = j->getPersonnage()->getPosition();
115 + zonesEnigmes->show();
116 + enigme1->show();
117 + enigme2->show();
84 118 }
85 119
86 - void FenetreMap::connectEnigmethd() {
87 - imgGob->move(614,203);
120 + void FenetreMap::connectEnigme1() {
121 +
122 +
123 +
124 + if((imgGob->pos().x() == 553 && imgGob->pos().y()==450)
125 + || (imgGob->pos().x() == 553 && imgGob->pos().y()==450) ){
126 + //imgGob->move(632,330);
127 + zonesEnigmes->hide();
128 + enigme1->hide();
129 + enigme2->hide();
130 + }
131 +
88 132 parentWindow->Enigmes();
89 133 }
90 134
91 - void FenetreMap::connectEnigmethg() {
92 - imgGob->move(358,247);
135 + void FenetreMap::connectEnigme2() {
136 + zonesEnigmes->hide();
137 + enigme1->hide();
138 + enigme2->hide();
93 139 parentWindow->Enigmes();
94 140 }
95 141
96 - void FenetreMap::connectEnigmetch() {
97 - imgGob->move(360,55);
98 - parentWindow->Enigmes();
142 + void FenetreMap::connectOffrebd(){
143 + Jeu *j = parentWindow->getJeu();
144 + const Tour * posi = j->getPersonnage()->getPosition();
145 +
146 + std::vector<Enigme> enigmes = *(j->getVecteurEnigmesActuelles());
147 + if((imgGob->pos().x() == 553 && imgGob->pos().y()==450) ){
148 + imgGob->move(545,375);
149 + zonesEnigmes->show();
150 + //enigme1->setText(enigmes[0].getCompetence());
151 + enigme1->show();
152 + // enigme2->setText(enigmes[1].getCompetence());
153 + enigme2->show();
154 + }
155 + //imgGob->move(619,327);
156 + //parentWindow->Enigmes();
157 + }
158 +
159 + void FenetreMap::connectOffrebg(){
160 + if((imgGob->pos().x() == 553 && imgGob->pos().y()==450) ){
161 + imgGob->move(474,456);
162 + zonesEnigmes->show();
163 + enigme1->show();
164 + enigme2->show();
165 + }
166 + //imgGob->move(369,443);
167 + //parentWindow->Enigmes();
168 + }
169 +
170 + void FenetreMap::connectOffrehd(){
171 + if(imgGob->pos().x() == 369 && imgGob->pos().y()==443){
172 + // en BG
173 + imgGob->move(503,323);
174 + zonesEnigmes->show();
175 + enigme1->show();
176 + enigme2->show();
177 + }
178 +
179 + if(imgGob->pos().x() == 619 && imgGob->pos().y()==327) { // en BD
180 + imgGob->move(601,299);
181 + zonesEnigmes->show();
182 + enigme1->show();
183 + enigme2->show();
184 + }
185 + //imgGob->move(603,213);
186 + //parentWindow->Enigmes();
187 + }
188 +
189 + void FenetreMap::connectOffrehg(){
190 + if(imgGob->pos().x() == 369 && imgGob->pos().y()==443) {
191 + // en BG
192 + imgGob->move(371,364);
193 + zonesEnigmes->show();
194 + enigme1->show();
195 + enigme2->show();
196 + }
197 + if(imgGob->pos().x() == 619 && imgGob->pos().y()==327){ // en BD
198 + imgGob->move(503,323);
199 + zonesEnigmes->show();
200 + enigme1->show();
201 + enigme2->show();
202 + }
203 + //imgGob->move(369,253);
204 + //parentWindow->Enigmes();
205 + }
206 +
207 + void FenetreMap::connectOffrech(){
208 + imgGob->move(494,143);
209 + zonesEnigmes->show();
210 + enigme1->show();
211 + enigme2->show();
212 + //parentWindow->Enigmes();
99 213 }