private void CreateMapTexture(Renderer renderer)
        {
            var offset = new Vector2(20, 20);

            _renderTarget = new RenderTarget2D(
                renderer.Device,
                renderer.Device.PresentationParameters.BackBufferWidth,
                renderer.Device.PresentationParameters.BackBufferHeight,
                false,
                renderer.Device.PresentationParameters.BackBufferFormat,
                DepthFormat.Depth24);
            // Set the render target
            renderer.Device.SetRenderTarget(_renderTarget);

            var oldZoom = renderer.RenderState.Camera.Zoom;
            renderer.RenderState.Camera.Move(offset);
            renderer.RenderState.Camera.SetZoom(1.15f);

            renderer.Device.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true };

            // Draw the scene
            renderer.Device.Clear(Color.CornflowerBlue);
            renderer.DrawToScreen(_mapView.RenderInstructons.SelectMany(x => x));

            // Restore
            renderer.Device.SetRenderTarget(null);
            renderer.RenderState.Camera.SetZoom(oldZoom);
            renderer.RenderState.Camera.Move(-offset);
            _initialized = true;
        }
        public void Draw(SpriteBatch spriteBatch, Renderer renderer)
        {
            // Renders provinces
            renderer.DrawToScreen(_standardInstrs.SelectMany(x => x));

//            if (renderer.RenderState.Camera.Zoom < 1.4f)
//            {
                DrawUnits(spriteBatch, renderer);
//            }

            // Selection box
            AABB selectionRect = new AABB(_selectionBoxP1, _selectionBoxP2);
            AABB[] borders = selectionRect.Borders(1);
            spriteBatch.Draw(selectionRect, new Color(Color.Black, 0.4f));
            spriteBatch.Draw(borders, Color.CadetBlue);       
        }