Commit 7da8c746 authored by Chris's avatar Chris
Browse files

replaced clear_screen system() calls with a (hopefully) cross-platform equivalent

parent 110652c9
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -19,9 +19,16 @@ void sleep_ms(const unsigned int ms) {
}

void clear_screen(void) {
    #ifdef _WIN32
        system("cls");
    #else
        system("clear");
    #endif
    // #ifdef _WIN32
    //     system("cls");
    // #else
    //     system("clear");
    // #endif

    // the below approach is cross-platform!
    // breakdown:
    //      - \e is the escape character, beginning the escape sequence
    //      - [1:1H moves cursor to row 1, column 1
    //      - [2J is an escape character that clears the entire screen
    printf("\e[1;1H\e[2J");
}