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

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

Update: init position in main

Christian Immanuel · 2024-02-27 06:20 · 76739414d56778b13d3484dab14c4ef1187093ed

 main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/main.c b/main.c
index 5b8d475..e2d1c6b 100644
--- a/main.c
+++ b/main.c
@@ -7,13 +7,13 @@
 #include <time.h>
 #include "inout.h"
 
-int runLevel(char *lines, int chars_max) {
+int runLevel(char *lines, int chars_max, struct position_s position) {
     int c;
     int mistakes = 0;
     do {
         c = readChar();
         int color = (c == lines[position.x-1]) ? GREEN : RED;
-        printChar(lines, color, c);
+        printChar(lines, color, c, position);
         if (c != lines[position.x-1])
             mistakes++;
         position.x++;
@@ -34,6 +34,7 @@ char right_b[] = "m,.-n";
 
 int main() {
     struct winsize w;
+    struct position_s position = {1, 1};
     ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
     // window.cols = w.ws_col;
     // window.rows = w.ws_row;
@@ -63,7 +64,7 @@ int main() {
 
         printf("\033[1;1H%s", lines);
 
-        mistakes = runLevel(lines, chars_max);
+        mistakes = runLevel(lines, chars_max, position);
         if (mistakes == 0)
             level++;
     }