#include <SDL_net.h>
#include <iostream>

#include "Client.h"

int main(int argc, char *argv[])
{
    std::cout << "Starting DarkRP2D Client..." << std::endl;

    if (SDLNet_Init() < 0)
    {
        fprintf(stderr, "SDLNet_Init: %s\n", SDLNet_GetError());
        exit(EXIT_FAILURE);
    }

    bool clientQuit = false;
    {
        Client client("127.0.0.1",12000);
        unsigned int lastTime = SDL_GetTicks(), currentTime, elapsedTime;
        while (!clientQuit)
        {
            currentTime = SDL_GetTicks();
            elapsedTime = currentTime - lastTime;
            lastTime = currentTime;
            client.update(elapsedTime);
        }
    }

    SDLNet_Quit();
    std::cout << "Client closed!" << std::endl;

    return EXIT_SUCCESS;
}