Nimbin[12]?Web & Tools / typing_10_fingers / commits / 5100223

typing_10_fingers git · main

10 finger typing trainer (CMake)

typing terminal c cmake · first commit 2024-02-26 · last commit 2024-03-16 (2 years ago) · synced 3 days ago · upstream: git.ide3.de/chfis005/typing_10_fingers

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.gz

Anpassung der main für windows

Vitali Krieger · 2024-02-27 09:03 · 510022393cc441fc051e8cbe216a296a937a6f8d

 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;