public void render()
	{
		renderStart = System.nanoTime();
		BufferStrategy strat = getBufferStrategy();
		if(strat == null)
		{
			createBufferStrategy(3);
			return;
		}
		try
		{
			sm.getCurrentScreen().clear();
			sm.getCurrentScreen().render();
			if(loading)
				loading = false;
		}catch(NullPointerException e)
		{
			if(sm.getCurrentScreen()== null)
			{
				System.err.println("Screen is null!!"); 
				return;
			}
			else
				e.printStackTrace();
		}

		int[] pix = sm.getCurrentScreen().pixels;
		for(int y = 0; y < sm.getCurrentScreen().height; y++)
		{
			for(int x = 0; x < sm.getCurrentScreen().width; x++)
			{
				pixels[width * y + x] = pix[width * y + x];
			}
		}

		if(displayFPS)
			frame.setTitle(frameName + ":" + this.getFPS());
		else
			frame.setTitle(frameName);
		Graphics g = strat.getDrawGraphics();
		g.drawImage(image, 0, 0, getWidth(), getHeight(), null);
		g.dispose();
		strat.show();
		lastrenderLength = System.nanoTime() - renderStart;
	}