private void run()
    {
		long time = 0, lastTime = 0, currentFPSSample = 0, lastFPSTime = 0;
		
		
		isRunning = true;
		
		while(isRunning)
		{			
			if(Window.isCloseRequested())
				isRunning = false;
			
			// Input Stuff
			game.input();
			

			if(Input.isKeyPressed(Input.KEY_F1))
				screenshot();
			
			Input.update();
				
			// Timing Stuff
			time = Time.getTime();
			Time.setDelta((time - lastTime)/1000000f);
			deltaSamples[(int) (currentFPSSample % deltaSamples.length)] = (float) Time.getDelta();
			FPS = (int) (1f/avg(deltaSamples) * 1000);
			lastTime = time;
			
			if(time - lastFPSTime > Time.SECOND)
			{
				secondsFPS = FPS;
				lastFPSTime = time;
			}
			
			fpsSamples[(int) (currentFPSSample++ % fpsSamples.length)] = FPS;
			
			//game.update();
			game.playerUpdate();
			
			// Rendering Stuff
			render();
			
			
			
			// This stops the aux thread from completely freezing
			try
			{
				Thread.sleep(1);
			} catch (InterruptedException e)
			{
				e.printStackTrace();
			}
			Display.sync(TARGET_FPS);
		}
		
		System.out.println();
		shutDown();
    }