<commit_before>
#include "Game.h"

//initialising the vector
std::vector<Entity*> Game::EntityList;


/**
*   Constructor for the Game Class
*/
Game::Game(){
    displaySurface = NULL;
    running = true;
    paused = false;
    timeQueued = 0;

    scorestring = "";

    score = 0;
    theend = false;
    maxEntities = 10;
    currentEntities = 0;
}

/**
*   Destructor for the Game Class
*/

Game::~Game(){

}

/**
*   Gets called when the game is started, moves everything out of main
*   When this function exits the game exits
*/

int Game::Run(){
    win = new Window(1280,760);

    //The gmae timers start and end
    Stopwatch time;

    //Calls the init function to initilise everything
    if(init() == false){
        return -1;
    }

    //Gets the surface of the screen
    displaySurface = win->getGraphics();

    //initialises SDLs event handler
    SDL_Event event;

    //Gets a timestamp for calculating delta times between ticks
    double oldTime = GetTime();

    //Start the timer
    time.start();

    //The main game loop
    while(running){
        //initialises the player entity velocity to 0,
        //this resets velocity on each loop to prevent the player from carrying
        // on in one direction after the movement keys have stopped being pressed
        entity.velocityX = 0;
        entity.velocityY = 0;

        //Checks to see if an event has occured,
        while(SDL_PollEvent(&event)){
            onEvent(&event);
        }

        //Calculates the delta time for dealing with the tick since last loop
        const double newTime = GetTime();
        double dt = newTime - oldTime;
        oldTime = newTime;

        //Deals with all game state changes
        loop(dt);

        //deals with all rendering
        win->setText(" Score: " + std::to_string(score) + " Time: " + std::to_string(60-(int)(time.read()/1000)));
        render();
        if(time.read() > 60000 && !theend){
            theend = true;
            time.stop();
            std::ofstream score;
            score.open("score.txt", std::ios::ate | std::ios::out);
            score << "Last score: " << this->score << "\n" << scorestring;
            score.flush();
            score.close();
        running=false;

        while(SDL_WaitEvent(&event)){
            if(event.key.keysym.sym == SDLK_RETURN)
                break;
        }
    }
}
    //this is only called when the game is exiting, makes sure the game exits cleanly with all memory cleared correctly
    cleanUp();

    return 0;
}


<commit_msg>Update score/time text<commit_after>
#include "Game.h"

//initialising the vector
std::vector<Entity*> Game::EntityList;


/**
*   Constructor for the Game Class
*/
Game::Game(){
    displaySurface = NULL;
    running = true;
    paused = false;
    timeQueued = 0;

    scorestring = "";

    score = 0;
    theend = false;
    maxEntities = 10;
    currentEntities = 0;
}

/**
*   Destructor for the Game Class
*/

Game::~Game(){

}

/**
*   Gets called when the game is started, moves everything out of main
*   When this function exits the game exits
*/

int Game::Run(){
    win = new Window(1280,760);

    //The gmae timers start and end
    Stopwatch time;

    //Calls the init function to initilise everything
    if(init() == false){
        return -1;
    }

    //Gets the surface of the screen
    displaySurface = win->getGraphics();

    //initialises SDLs event handler
    SDL_Event event;

    //Gets a timestamp for calculating delta times between ticks
    double oldTime = GetTime();

    //Start the timer
    time.start();

    //The main game loop
    while(running){
        //initialises the player entity velocity to 0,
        //this resets velocity on each loop to prevent the player from carrying
        // on in one direction after the movement keys have stopped being pressed
        entity.velocityX = 0;
        entity.velocityY = 0;

        //Checks to see if an event has occured,
        while(SDL_PollEvent(&event)){
            onEvent(&event);
        }

        //Calculates the delta time for dealing with the tick since last loop
        const double newTime = GetTime();
        double dt = newTime - oldTime;
        oldTime = newTime;

        //Deals with all game state changes
        loop(dt);

        //deals with all rendering
        win->setText(" Score: " + std::to_string(score) + "       Time Left: " + std::to_string(60-(int)(time.read()/1000)) + "s");
        render();
        if(time.read() > 60000 && !theend){
            theend = true;
            time.stop();
            std::ofstream score;
            score.open("score.txt", std::ios::ate | std::ios::out);
            score << "Last score: " << this->score << "\n" << scorestring;
            score.flush();
            score.close();
        running=false;

        while(SDL_WaitEvent(&event)){
            if(event.key.keysym.sym == SDLK_RETURN)
                break;
        }
    }
}
    //this is only called when the game is exiting, makes sure the game exits cleanly with all memory cleared correctly
    cleanUp();

    return 0;
}



{'fraction_non_alphanumeric': 0.11428571428571428, 'fraction_numerical': 0.010958904109589041, 'mean_word_length': 2.129822412737293, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3148813', 'n_tokens_mistral': 1539, 'n_tokens_neox': 1441, 'n_words': 496}