1
0

Ajout du centrage automatique du tableau en fonction de la taille de la fenêtre et des cartes

This commit is contained in:
Lyanis SOUIDI 2022-12-01 23:15:00 +01:00
parent 770efb9b83
commit 82a5c54e0c

View File

@ -77,8 +77,8 @@ int game(int colonnes, int lignes) {
for (c = 0; c < colonnes; c++) { for (c = 0; c < colonnes; c++) {
sprintf(file, "../img/cards/%dx%d/%d.png", colonnes, lignes, tab[i]); sprintf(file, "../img/cards/%dx%d/%d.png", colonnes, lignes, tab[i]);
cards[l][c] = create_card( cards[l][c] = create_card(
GAME_MARGIN_RIGHT + (c * case_max_dimensions), GAME_MARGIN_RIGHT + (((WINDOW_WIDTH - (GAME_MARGIN_RIGHT + GAME_MARGIN_LEFT)) - (case_max_dimensions * colonnes)) / 2) + (c * case_max_dimensions),
GAME_MARGIN_TOP + (l * case_max_dimensions), GAME_MARGIN_TOP + (((WINDOW_HEIGHT - (GAME_MARGIN_TOP + GAME_MARGIN_BOTTOM)) - (case_max_dimensions * lignes)) / 2) + (l * case_max_dimensions),
case_max_dimensions - (2 * case_margin), case_max_dimensions - (2 * case_margin), case_max_dimensions - (2 * case_margin), case_max_dimensions - (2 * case_margin),
file file
); );