A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
graphlib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
.
[graphlib.git]
/
chateaux
/
chateaux.cpp
diff --git
a/chateaux/chateaux.cpp
b/chateaux/chateaux.cpp
index
64d1c01
..
9238389
100644
(file)
--- a/
chateaux/chateaux.cpp
+++ b/
chateaux/chateaux.cpp
@@
-61,23
+61,23
@@
float deg2rad(float deg)
// conversion coordonnées réelles -> coordonnées fenêtre
int rtowX(const DrawingWindow& w, float rx)
{
// conversion coordonnées réelles -> coordonnées fenêtre
int rtowX(const DrawingWindow& w, float rx)
{
- return (int )roundf(
w.width * (rx - rXMin) / (rXMax - rXMin + 1.0
));
+ return (int )roundf(
(w.width - 1) * (rx - rXMin) / (rXMax - rXMin
));
}
int rtowY(const DrawingWindow& w, float ry)
{
}
int rtowY(const DrawingWindow& w, float ry)
{
- return (int )roundf(
w.height * (rYMax - ry) / (rYMax - rYMin + 1.0
));
+ return (int )roundf(
(w.height - 1) * (rYMax - ry) / (rYMax - rYMin
));
}
}
-// conversion coordonnées
réelles -> coordonnées fenêtre
+// conversion coordonnées
fenêtre -> coordonnées réelles
float wtorX(const DrawingWindow& w, int wx)
{
float wtorX(const DrawingWindow& w, int wx)
{
- return (rXMax - rXMin
+ 1.0) * wx / w.width
+ rXMin;
+ return (rXMax - rXMin
) * wx / (w.width - 1)
+ rXMin;
}
float wtorY(const DrawingWindow& w, int wy)
{
}
float wtorY(const DrawingWindow& w, int wy)
{
- return -(rYMax - rYMin
+ 1.0) * wy / w.height
- rYMax;
+ return -(rYMax - rYMin
) * wy / (w.height - 1)
- rYMax;
}
float hauteurMontagne(float largeur, float hauteur, float x)
}
float hauteurMontagne(float largeur, float hauteur, float x)
@@
-247,7
+247,7
@@
int tir(DrawingWindow& w,
vy += ay * dt;
w.msleep(10);
vy += ay * dt;
w.msleep(10);
- w.sync();
+
//
w.sync();
w.setColor("skyblue");
w.fillCircle(wx, wy, 2);
// w.setColor("black");
w.setColor("skyblue");
w.fillCircle(wx, wy, 2);
// w.setColor("black");
@@
-281,6
+281,7
@@
int jeu1(DrawingWindow& w)
do {
joueur = 3 - joueur;
do {
joueur = 3 - joueur;
+ w.sync();
std::cout << "-=| Joueur " << joueur << " |=-";
float alpha;
std::cout << "-=| Joueur " << joueur << " |=-";
float alpha;
@@
-312,11
+313,11
@@
int jeu1(DrawingWindow& w)
} while (!perdant);
dessineFlammes(w, x, y);
std::stringstream msg;
} while (!perdant);
dessineFlammes(w, x, y);
std::stringstream msg;
- msg << "Joueur " << perdant;
+ msg << "
Joueur " << perdant;
if (perdant == joueur)
if (perdant == joueur)
- msg << " s'est suicidé !";
+ msg << " s'est suicidé !
";
else
else
- msg << " a perdu !";
+ msg << " a perdu !
";
w.setColor("darkred");
w.setBgColor("white");
w.drawTextBg(w.width / 2, w.height / 3, msg.str().c_str(),
w.setColor("darkred");
w.setBgColor("white");
w.drawTextBg(w.width / 2, w.height / 3, msg.str().c_str(),