public void run() {
		this.init();
		
		Graphics screenGraphics = this.screen.getGraphics();
		long lastTimer = System.currentTimeMillis();
		long fpsWait = (long) (1.0 / 60 * 1000);
		
		main : while (this.running) {
			this.renderStart = System.nanoTime();
			
			// Update the game
			this.tick();
			
			// Update screen
			do {
				Graphics bg = this.getBuffer();
				
				if (!this.running) break main;
				
				this.render(screenGraphics);	
				
				bg.drawImage(this.screen, 0, 0, null);
			} while(!updateScreen());
			
			// Calculating fps and delta
			if (System.currentTimeMillis() - lastTimer > 1000) {
                lastTimer += 1000;
                this.fps = frames;
                this.frames = 0;
			}
			
			// FPS limitation
			long renderTime = (System.nanoTime() - renderStart) / 1000000;
    		try {
    			Thread.sleep(Math.max(0, fpsWait - renderTime));
    		} catch (InterruptedException e) {
    			Thread.interrupted();
    			break;
    		}
    		renderTime = (System.nanoTime() - renderStart) / 1000000;
		}
		
		frame.dispose();
	}