public void WidthHeightChange(int width, int height) { //this should be called on the UI thread, otherwise monogame will lose it. if (Batch != null) { Batch.Dispose(); } Batch = new UISpriteBatch(GameFacade.GraphicsDevice, 1, width, height, GlobalSettings.Default.AntiAlias?4:0); RawImage = new byte[width * height * 4]; BatchDirty = false; State.UIState.Width = width; State.UIState.Height = height; DoRedraw = true; }