private void gameLoop() {
		try {
			init();

			checkGLError("init");

			resized();

			checkGLError("resized");

			long lastTime, lastFPS;
			lastTime = lastFPS = System.nanoTime();
			int frames = 0;

			while (!Display.isCloseRequested() && !shouldStop()) {
				long deltaTime = System.nanoTime() - lastTime;
				lastTime += deltaTime;

				if (Display.wasResized())
					resized();

				while (Keyboard.next()) {
					if (Keyboard.getEventKeyState())
						keyPressed(Keyboard.getEventKey(),
								Keyboard.getEventCharacter(),
								Keyboard.getEventNanoseconds());
					else
						keyReleased(Keyboard.getEventKey(),
								Keyboard.getEventCharacter(),
								Keyboard.getEventNanoseconds());
				}

				update(deltaTime);

				checkGLError("update");

				render();

				checkGLError("render");

				Display.update();

				frames++;
				if (System.nanoTime() - lastFPS >= 1e9) {
					System.out.println("FPS: ".concat(String.valueOf(frames)));
					lastFPS += 1e9;
					frames = 0;
				}

				Display.sync(fps);
			}
		} catch (Throwable exc) {
			exc.printStackTrace();
		} finally {
			destroy();
		}
	}