public Renderer(Manager manager) { // Cache of gradients. gradientCache = new Dictionary<GradientBrush, Texture2D>(); stencilAreas = new List<Rectangle>(); this.manager = manager; graphics = manager.SpriteBatch.GraphicsDevice; // Create stencils for drawing masked sprites. var matrix = Matrix.CreateOrthographicOffCenter(0, graphics.PresentationParameters.BackBufferWidth, graphics.PresentationParameters.BackBufferHeight, 0, 0, 1 ); alphaTextEffect = new AlphaTestEffect(graphics) { Projection = matrix }; maskStencil = new DepthStencilState { StencilEnable = true, StencilFunction = CompareFunction.Always, StencilPass = StencilOperation.Replace, ReferenceStencil = 1, DepthBufferEnable = false, }; renderStencil = new DepthStencilState { StencilEnable = true, StencilFunction = CompareFunction.LessEqual, StencilPass = StencilOperation.Keep, ReferenceStencil = 1, DepthBufferEnable = false, }; // Create 1x1 texture for rendering rectangles. pixel = new Texture2D(manager.SpriteBatch.GraphicsDevice, 1, 1); pixel.SetData(new[] {ColorXNA.White}); }
public Skin(Manager manager) { this.manager = manager; }