package testutils;

import java.util.concurrent.TimeUnit;

import electrosphere.engine.Globals;
import electrosphere.engine.loadingthreads.LoadingThread;
import electrosphere.engine.loadingthreads.LoadingThread.LoadingThreadType;

public class EngineInit {
    
    /**
     * Setups up a locally-connected client and server that have loaded a test scene
     */
    public static void setupConnectedTestScene(){
        //
        //load the scene
        LoadingThread loadingThread = new LoadingThread(LoadingThreadType.LEVEL,"testscene1");
        Globals.threadManager.start(loadingThread);

        //
        //wait for client to be fully init'd
        while(Globals.threadManager.isLoading()){
            TestEngineUtils.simulateFrames(1);
            try {
                TimeUnit.MILLISECONDS.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

}
