public void runFixedTimeSteps() {
		long lastTime = System.nanoTime();
		double lag = 0;
		isPreRendering(true);
		boolean doRendering = false;
		while (isRunning && !Display.isCloseRequested()) {
			long currentTime = System.nanoTime();
			double timeDiff = (currentTime - lastTime) / 1000000d;
			lastTime = currentTime;
			lag += timeDiff;
			doRendering = lag >= framePeriod;
			if (doRendering) {
				isPreRendering(false);
				while (true) {
					lag -= framePeriod;
					if (lag < framePeriod) {
						isPreRendering(true);
						update(this);
						break;
					}
					update(this);
				}
			}
			if (Display.wasResized()) {
				onSurfaceChanged(Display.getWidth(), Display.getHeight());
				doRendering = true;
			}
			if (doRendering) {
				render();
				Display.update();
			} else {
				long sleep = Math.round(framePeriod - lag);
				if (sleep == 0)
					sleep = 1;
				try {
					Thread.sleep(sleep);
				} catch (InterruptedException e) {
				}
			}
		}
		Display.destroy();
	}