@Override public void run(final Game game) { init(game); // canvas.addListener(SWT.Paint, new Listener() { // public void handleEvent (Event event) { // run.run(); // } // }); shell.open(); while (!shell.isDisposed()) { long now = tick(); if (now - lastFrame >= FRAME_MILLIS) { processFrame(game); lastFrame = now; } if (!display.readAndDispatch()) { try { Thread.sleep(1); } catch (InterruptedException ie) {} // no problem! } } display.dispose(); shutdown(); }
@Override public void run(final Game game) { init(game); // canvas.addListener(SWT.Paint, new Listener() { // public void handleEvent (Event event) { // run.run(); // } // }); shell.open(); while (!shell.isDisposed()) { long now = tick(); if (now - lastFrame >= FRAME_MILLIS) { processFrame(game); lastFrame = now; } if (!display.readAndDispatch()) { try { Thread.sleep(1); } catch (InterruptedException ie) {} // no problem! } } display.dispose(); shutdown(); }