typing_10_fingers git · main
10 finger typing trainer (CMake)
C 97.4% Markdown 2.6%git clone https://git.christianimmanuel.de/web-tools/typing_10_fingers.gitwget https://git.christianimmanuel.de/web-tools/typing_10_fingers/archive/typing_10_fingers.tar.gzFix: use window struct instead of int vars
main.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/main.c b/main.c index 34ce5ab..5e800a8 100644 --- a/main.c +++ b/main.c @@ -38,16 +38,13 @@ int main(){ #ifdef WINDOWS CONSOLE_SCREEN_BUFFER_INFO csbi; GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); - int window_cols = csbi.srWindow.Right - csbi.srWindow.Left + 1; - int window_rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1; typedef struct windows_winsize{int ws_col,ws_row;}winsize_t; - winsize_t w; - w.ws_col = window_cols; w.ws_row=window_rows; + winsize_t window; + window.ws_col = csbi.srWindow.Right - csbi.srWindow.Left + 1; + window.ws_row = csbi.srWindow.Bottom - csbi.srWindow.Top + 1; #else - struct winsize w; - ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); - int window_cols = w.ws_col; - int window_rows = w.ws_row; + struct winsize window; + ioctl(STDOUT_FILENO, TIOCGWINSZ, &window); // window.ws_col, window.ws_row #endif struct position_s position = {1, 1}; @@ -65,6 +62,10 @@ int main(){ case 2: wcscpy(lvl_arr, right); break; + case 3: + wcscpy(lvl_arr, left); + wcscat(lvl_arr, right); + break; default: perror("Error choosing level!\n"); } @@ -72,7 +73,7 @@ int main(){ sysClear(); position.x = 1, position.y = 1; - getLine(lines, lvl_arr, chars_max, w.ws_col); + getLine(lines, lvl_arr, chars_max, window.ws_col); wprintf(L"\033[1;1H%ls", lines);//move cursor and print new line wprintf(L"\033[1;1H");//move cursor to top left