xTetris-Game
Loading...
Searching...
No Matches
common.h
Go to the documentation of this file.
1#ifndef COMMON_H
2#define COMMON_H
3
4#include <stddef.h>
5#include <time.h>
6#include <sys/ioctl.h>
7
11extern const wchar_t chSq;
12
16extern const wchar_t crSq;
17
21extern const wchar_t eSq;
22
26extern const wchar_t fSq;
27
31extern const int timeLimit;
32
36void sound(void);
37
41void clearCLI(void);
42
46void exitFailure(void);
47
52void delayTimer(int timeDelay);
53
57extern struct winsize w;
58
64int intLen(int value);
65
66
67
72void widthSpacing(int filledWidth);
73
78void printCentered(wchar_t *text);
79
84void heightSpacing(int filledHeight);
85
86void u_cleanup(void);
87
88int u_kbhit(void);
89
90int u_getchar(void);
91
96int waitUserInput(void);
97
101void waitUser(void);
102
103
104#endif
void printCentered(wchar_t *text)
Print text centered horizontally based on string length.
Definition common.c:71
struct winsize w
Global variable type struct winsize used for terminal width and height.
Definition common.c:45
const wchar_t crSq
Assign unicode character (green crossed square) to this global variable.
Definition common.c:15
int intLen(int value)
Calculate the length of a given number.
Definition common.c:47
int waitUserInput(void)
Loop until user press a valid key.
Definition common.c:130
void delayTimer(int timeDelay)
Call the system sleep.
Definition common.c:41
void heightSpacing(int filledHeight)
Apply a vertical spacing based on window heigth and what need to be printed.
Definition common.c:76
const wchar_t fSq
Assign unicode character (black square) to this global variable.
Definition common.c:17
void widthSpacing(int filledWidth)
Apply an horizontal spacing based on window width and what need to be printed.
Definition common.c:62
void u_cleanup(void)
Definition common.c:87
const int timeLimit
Time waiting before letting the tetromino fall one row below.
Definition common.c:19
const wchar_t eSq
Assign unicode character (white square) to this global variable.
Definition common.c:16
void waitUser(void)
Wait until Enter key is pressed.
Definition common.c:146
void sound(void)
Makes a beep sound.
Definition common.c:21
void exitFailure(void)
Exit the program after cleaning everything on screen.
Definition common.c:36
void clearCLI(void)
Call the system function to clear the cli.
Definition common.c:25
int u_getchar(void)
Definition common.c:118
int u_kbhit(void)
Definition common.c:91
const wchar_t chSq
Assign unicode character (green check square) to this global variable.
Definition common.c:14