/// <summary> /// This function will draw every tile on a texture that has the size of the current window size (viewport) /// then it will sort all these big textures to draw the full map on the screen. /// </summary> void CreateTextures() { Vector2 NumberOfMapTextures = map.Size / new Vector2(Graphics.PreferredBackBufferWidth, Graphics.PreferredBackBufferHeight); Vector2 MapTextureArraySize = new Vector2((float)Math.Ceiling(NumberOfMapTextures.X), (float)Math.Ceiling(NumberOfMapTextures.Y)); for (int y = 0; y < MapTextureArraySize.Y; y++) { for (int x = 0; x < MapTextureArraySize.X; x++) { CombineTextures.Begin(Graphics); DrawTiles(); CombineTextures.End(); Texture2D MapTexture = CombineTextures.GetFinalTexture(); MapTextures.Add(new LayerTexture(MapTexture, new Vector2(x * Graphics.PreferredBackBufferWidth, y * Graphics.PreferredBackBufferHeight), new Vector2(Graphics.PreferredBackBufferWidth, Graphics.PreferredBackBufferHeight))); } } }
internal void CreateTexture(SpriteBatch spriteBatch, Vector2 Position, Vector2 Size, Vector2 CornersSize, BorderThickness BorderThickness) { this.spriteBatch = spriteBatch; this.Position = Position; this.Size = Size; this.CornersSize = CornersSize; this.BorderThickness = BorderThickness; if (RendererMode == RenderMode.Scalable || RendererMode == RenderMode.ScalableRealTime) { SetCropRectangle(); MoveAndResizeUI(); CropTextures(Graphics); } if (RendererMode == RenderMode.Scalable) { CombineTextures.Begin(Graphics, Size); DrawUIParts(); CombineTextures.End(); ScaledTexture = CombineTextures.GetFinalTexture(new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y)); } }