fix resize
This commit is contained in:
parent
e8e52411ff
commit
76cd5c4e63
1 changed files with 9 additions and 5 deletions
|
@ -41,15 +41,19 @@ void Plateau::initialiserPlateau(Joueur &j1, Joueur &j2) {
|
|||
}
|
||||
|
||||
void Plateau::afficherPlateau(const bool d) {
|
||||
float taille_cellule = static_cast<float>(Ecran::window.getSize().x) / taille;
|
||||
float tailleCellule = static_cast<float>(Ecran::window.getSize().x) / taille;
|
||||
|
||||
// Adapte la vue pour le redimensionnement
|
||||
const float tailleFenetre = taille * tailleCellule;
|
||||
Ecran::window.setView(
|
||||
sf::View(sf::FloatRect(0, 0, tailleFenetre, tailleFenetre)));
|
||||
|
||||
// Cellule
|
||||
sf::RectangleShape cell(sf::Vector2f(taille_cellule, taille_cellule));
|
||||
|
||||
sf::RectangleShape cell(sf::Vector2f(tailleCellule, tailleCellule));
|
||||
for (int i = 0; i < taille; i++) {
|
||||
for (int j = 0; j < taille; j++) {
|
||||
float x = i * taille_cellule;
|
||||
float y = j * taille_cellule;
|
||||
float x = i * tailleCellule;
|
||||
float y = j * tailleCellule;
|
||||
|
||||
// Position de la cellule
|
||||
cell.setPosition(x, y);
|
||||
|
|
Reference in a new issue