14const wchar_t chSq = 0x2705;
15const wchar_t crSq = 0x274E;
16const wchar_t eSq = 0x2B1C;
17const wchar_t fSq = 0x2B1B;
29 res = system(
"clear");
58 return (length==0)?1:length;
66 ioctl(STDOUT_FILENO, TIOCGWINSZ, &
w);
67 for(i=0; i<(
w.ws_col-filledWidth)/2; i++)
73 wprintf(L
"%ls\r\n", text);
80 ioctl(STDOUT_FILENO, TIOCGWINSZ, &
w);
81 for(i=0; i<(
w.ws_row-filledHeight)/2; i++)
85static struct termios orig_term;
88 tcsetattr(0, TCSANOW, &orig_term);
96 static int first_hit=0;
99 if(tcgetattr(0, &t)!=0)
103 if(tcsetattr(0, TCSANOW, &t)!=0)
113 if(select(1, &rfd, NULL, NULL, &to)==1)
123 if(read(0, &buf, 1)!=1)
void printCentered(wchar_t *text)
Print text centered horizontally based on string length.
struct winsize w
Global variable type struct winsize used for terminal width and height.
const wchar_t crSq
Assign unicode character (green crossed square) to this global variable.
void delayTimer(int time)
Call the system sleep.
int intLen(int value)
Calculate the length of a given number.
int waitUserInput(void)
Loop until user press a valid key.
void sound()
Makes a beep sound.
void heightSpacing(int filledHeight)
Apply a vertical spacing based on window heigth and what need to be printed.
const wchar_t fSq
Assign unicode character (black square) to this global variable.
void widthSpacing(int filledWidth)
Apply an horizontal spacing based on window width and what need to be printed.
const int timeLimit
Time waiting before letting the tetromino fall one row below.
const wchar_t eSq
Assign unicode character (white square) to this global variable.
void waitUser(void)
Wait until Enter key is pressed.
void exitFailure(void)
Exit the program after cleaning everything on screen.
void clearCLI(void)
Call the system function to clear the cli.
const wchar_t chSq
Assign unicode character (green check square) to this global variable.