it works without leaks and global variables except gamestate

This commit is contained in:
Rorikstr | Rust Dev 2025-09-28 13:27:41 +03:00
parent 9de308925c
commit eaafb06836
3 changed files with 33 additions and 8 deletions

View file

@ -10,8 +10,10 @@ void display_game() {
// Отображение игрового поля
for (int i = 0; i < FIELD_HEIGHT; i++) {
for (int j = 0; j < FIELD_WIDTH; j++) {
if (game_state.field[i][j] != 0) {
mvaddch(i + 1, j * 2 + 1, '#'); // Заполненные блоки
if (game_state.field[i][j] == 2) {
mvaddch(i + 1, j * 2 + 1, '#'); // Закрепленные блоки
} else if (game_state.field[i][j] == 1) {
mvaddch(i + 1, j * 2 + 1, '$'); // Активная фигура
} else {
mvaddch(i + 1, j * 2 + 1, '.'); // Пустые ячейки
}

View file

@ -68,6 +68,8 @@ int main() {
display_game();
}
// Вызов userInput с Terminate для освобождения памяти
userInput(Terminate, false);
endwin();
return 0;
}