public static boolean UpdateWindow()
	{
		try
		{
			DisplayMode dm = null;
			DisplayMode[] dms = Display.getAvailableDisplayModes();
			
			int width = (Integer)GetVariable("screen_width").GetData();
			int height = (Integer)GetVariable("screen_height").GetData();
			boolean fullscreen = (Boolean)GetVariable("fullscreen").GetData();
			
			//if (mFrame != null)
			//{
			//	mFrame.dispose();
			//}
			
			//mFrame = new WindowedFullscreenFrame(width, height);
			
			//Display.setParent(mFrame.GetCanvas());
			
			for (int i = 0; i < dms.length; i++)
			{				
				if (dms[i].getWidth() == width
					&& dms[i].getHeight() == height)
				{
					dm = dms[i];
					break;
				}
			}
			
			if (dm == null)
			{
				dm = new DisplayMode(width, height);
				Display.setDisplayMode(dm);
			}
			else
			{
				Display.setDisplayMode(dm);
				Display.setFullscreen(fullscreen);
				Display.setVSyncEnabled(fullscreen);
			}
			
			if (!Display.isCreated())
			{
				Display.create();
			}
			
			glMatrixMode(GL_PROJECTION);
			glLoadIdentity();
			glOrtho(0, width, height, 0, -1, 1);
			
			glMatrixMode(GL_MODELVIEW);
			glLoadIdentity();
			glViewport(0, 0, width, height);
			
			mScale = 0.5f * (WindowWidth() / 1600.0f + WindowHeight() / 900.0f) / 2;
		}
		catch(Exception e)
		{
			e.printStackTrace();
			return false;
		}
		return true;
	}