@Override
	public void run() {
		timer.start();
		lastFrameTime = currentTime = timer.getTime();
		this.requestFocus();
		final Image image = new BufferedImage(GAME_WIDTH, GAME_HEIGHT,
				BufferedImage.TYPE_INT_RGB);

		Sound.touch();

		while (this.running) {
			Graphics g = image.getGraphics();
			timer.tick();
			delta = timer.getTime() - currentTime;
			currentTime = timer.getTime();
			factor = 1;
			try {
				factor = Math.min(1.0, curFps / 35D);
			} catch (Exception e) {
			}
			if (input.buttons[Input.PLUS] && !input.oldButtons[Input.PLUS]) {

				Game.setScreenScale(Game.getScreenScale() + 1);

			}
			if (input.buttons[Input.MINUS] && !input.oldButtons[Input.MINUS]) {

				Game.setScreenScale(Game.getScreenScale() - 1);

			}
			this.screen.tick(this.input, delta * factor);
			this.input.tick();

			this.screen.render(g);
			Art.drawString(version, g, 0, 0);
			curFps = (int) (1 / delta);
			Art.drawString("FPS: " + (int) (curFps / factor), g, 0, 10);
			g.dispose();
			try {
				this.started = true;
				g = this.getGraphics();
				g.drawImage(image, 0, 0, GAME_WIDTH * getScreenScale(),
						GAME_HEIGHT * getScreenScale(), 0, 0, GAME_WIDTH,
						GAME_HEIGHT, null);
				g.dispose();
			} catch (final Throwable e) {
			}
			try {
				Thread.sleep(1);
			} catch (final InterruptedException e) {
				e.printStackTrace();
			}
		}
	}