Example #1
0
void Client::init() {
    Debug::log("INIT");
    
    // INIT WINDOW
    WSFML *window = WSFML::instance();
    
    // CREATE CONTROL
    c = Control::instance();
    
    // CAMERA
    cam = Camera::instance();
    
    // TIME
    t = new Timer();
    
    hasStartEvent = false;

    window->getWindow()->setActive(false);
    
    sf::Thread thread_game(&Client::startGameLoop, this);
    thread_game.launch();
    
    Net *net = new Net();
    sf::Thread thread_net(&Net::startNet, net);
    thread_net.launch();
    
    while(hasStartEvent == false)
        sf::sleep(sf::milliseconds(1));
    
    printf("START\n");
    
    Events e;
    e.startListening(w->getPlayer());
}