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.gzAnpassung der main für windows
main.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index d065f62..a719e32 100644 --- a/main.c +++ b/main.c @@ -44,12 +44,20 @@ wchar_t right_b[] = { L'm', L',', L'.', L'-', L'n', L'\0' }; int main() { setlocale(LC_ALL, ""); + #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; + #else struct winsize w; - struct position_s position = {1, 1}; ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); - // window.cols = w.ws_col; - // window.rows = w.ws_row; - + window.cols = w.ws_col; + window.rows = w.ws_row; + #endif int chars_max = 15;