public void ForceUpdateImageData() { #region Update the texture if (mImageData != null) { for (int x = 0; x < mNumberOfXTiles; x++) { for (int y = 0; y < mNumberOfYTiles; y++) { Color colorToSet; if (mBlockedTiles[x][y] == 0) { if (mRevealedTiles[x][y] == 0) { colorToSet = HiddenClearedColor; } else { colorToSet = RevealedClearedColor; } } else { if (mRevealedTiles[x][y] == 0) { colorToSet = HiddenBlockedColor; } else { colorToSet = RevealedBlockedColor; } } //byte blue = (byte)(255 * (mBlockedTiles[x][y] & 1)); //byte green = (byte)(255 * (mRevealedTiles[x][y] & 1)); //byte red = 255; mImageData.SetPixel(x, y, colorToSet); } } ContentManager contentManager = FlatRedBallServices.GetContentManagerByName(this.ContentManagerName); //FlatRedBallServices.GlobalContentManager); if (mSprite != null) { if (mSprite.Texture != null) { contentManager.UnloadAsset(mSprite.Texture); mSprite.Texture.Dispose(); } bool generateMipmaps = false; mSprite.Texture = mImageData.ToTexture2D(generateMipmaps, FlatRedBallServices.GraphicsDevice); contentManager.AddDisposable("VisibilityGridTexture #" + NumberCreated, mSprite.Texture); NumberCreated++; } } #endregion }