affichage barriere & fix selection
This commit is contained in:
parent
5dcca2bb3e
commit
2e1f7afdc3
2 changed files with 9 additions and 10 deletions
|
@ -116,22 +116,20 @@ void PlateauSafari::afficherPlateau(std::ostream &out, const bool d) const {
|
|||
Position pos1 = it->getPos();
|
||||
Position pos2 = it->getPos2();
|
||||
|
||||
float x, y;
|
||||
const int decalage = 10;
|
||||
|
||||
const float decalage = 5;
|
||||
// Verticale
|
||||
if (pos1.first == pos2.first) {
|
||||
x = pos1.first;
|
||||
y = std::max(pos1.second, pos2.second) - decalage;
|
||||
barriereV.setPosition(x * tailleCellule, y * tailleCellule);
|
||||
const int x = pos1.first;
|
||||
const int y = std::max(pos1.second, pos2.second);
|
||||
barriereV.setPosition(x * tailleCellule, y * tailleCellule - decalage);
|
||||
Ecran::window.draw(barriereV);
|
||||
}
|
||||
|
||||
// Horizontale
|
||||
else {
|
||||
x = std::max(pos1.first, pos2.first) - decalage;
|
||||
y = pos1.second;
|
||||
barriereH.setPosition(x * tailleCellule, y * tailleCellule);
|
||||
const int x = std::max(pos1.first, pos2.first);
|
||||
const int y = pos1.second;
|
||||
barriereH.setPosition(x * tailleCellule - decalage, y * tailleCellule);
|
||||
Ecran::window.draw(barriereH);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,6 +200,7 @@ void Safari::event(const int x, const int y) {
|
|||
if (placeholder.first == -1) {
|
||||
// On place le placeholder
|
||||
plateau.setPlaceholderBarriere(posCurseur.first, posCurseur.second);
|
||||
|
||||
} else {
|
||||
// On vérifie que le second point est bien positionné
|
||||
// Et on place la barrière si possible
|
||||
|
@ -216,7 +217,7 @@ void Safari::event(const int x, const int y) {
|
|||
}
|
||||
}
|
||||
|
||||
if (p != nullptr) {
|
||||
if (!deplacerAnimal && p != nullptr) {
|
||||
// Vérifie que la pièce est à nous
|
||||
if (getPiece(posCurseur.first, posCurseur.second)->getCategory() ==
|
||||
getPiece(joueurCourant->getPieces().at(0))->getCategory()) {
|
||||
|
|
Reference in a new issue