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.gzUpdate: init position in main
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++; }