Фигурки то рисуются!

This commit is contained in:
Rorikstr | Rust Dev 2025-09-26 13:28:53 +03:00
parent e20765d252
commit fef0d8cbe3
6 changed files with 176 additions and 22 deletions

View file

@ -0,0 +1,50 @@
// src/gui/cli/main.c
#include <ncurses.h>
#include <time.h>
#include <unistd.h>
#include "../../brick_game/tetris/tetris.h"
void display_game();
int main() {
initscr();
cbreak();
noecho();
keypad(stdscr, TRUE);
nodelay(stdscr, TRUE);
curs_set(0);
timeout(100); // Таймаут для getch()
int ch;
bool hold = false;
while (1) {
ch = getch();
UserAction_t action = Undefined;
switch (ch) {
case 'q': action = Terminate; break;
case '1': action = Figure1; break;
case '2': action = Figure2; break;
case '3': action = Figure3; break;
case '4': action = Figure4; break;
case '5': action = Figure5; break;
case KEY_LEFT: action = Left; break;
case KEY_RIGHT: action = Right; break;
case KEY_DOWN: action = Down; break;
case KEY_UP: action = Up; break;
}
if (action != Undefined) {
userInput(action, hold);
}
display_game();
if (action == Terminate) break;
}
endwin();
return 0;
}