/** Main Loop for GLFW. This call will block <br> */
  public void start() {
    mainThread = Thread.currentThread();
    windowThread.start();
    running = true;
    while (running) {
      executeMainRunnables();

      for (int i = 0; i < queueWindows.size; ) {
        final Lwjgl3Application app = queueWindows.removeIndex(i);
        i--;

        Runnable run =
            new Runnable() {
              @Override
              public void run() {
                glfwMakeContextCurrent(0);
                jumpLoop = true;
              }
            };
        postWindowRunnableAndWait(run);

        initWindow(app);
        glfwShowWindow(app.graphics.window);

        Runnable run2 =
            new Runnable() {
              @Override
              public void run() {
                initContext(app);
                windows.add(app);
                tmpfirst = true;
              }
            };
        postWindowRunnable(run2);
        jumpLoop = false;
        break;
      }

      if (tmpfirst && windows.size == 0) {
        running = false;
      }

      glfwWaitEvents();
    }
    try {
      windowThread.join();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    glfwTerminate();
    if (errorCallback != null) errorCallback.release();
  }
示例#2
0
  private void start() {

    running = true;
    thread = new Thread(this, "ContinuousWindow");
    thread.start();
  }