public void Load() { this.LineWidth = 1; this.pDevice = GLEx.device; this.pCamera = GLEx.cemera; effect = new BasicEffect(pDevice); effect.VertexColorEnabled = true; xnaLine = new XNALine(); xnaRect = new XNARectangle(pDevice); xnaPolygon = new XNAPolygon(pDevice); maxPrimitiveCount = pDevice.GraphicsProfile == GraphicsProfile.Reach ? 65535 : 1048575; vertsPos = new VertexPositionColor[maxPrimitiveCount]; effect.Projection = Microsoft.Xna.Framework.Matrix.CreateOrthographicOffCenter(0f, LSystem.screenRect.width, LSystem.screenRect.height, 0f, -1.0f, 1.0f); }
public void FillRect(float x, float y, float width, float height) { int hashCode = 1; hashCode = LSystem.Unite(hashCode, x); hashCode = LSystem.Unite(hashCode, y); hashCode = LSystem.Unite(hashCode, width); hashCode = LSystem.Unite(hashCode, height); hashCode = LSystem.Unite(hashCode, color.PackedValue); XNARectangle rect = (XNARectangle)CollectionUtils.Get(fillRectLazy, hashCode); SubmitDraw(); if (rect == null) { rect = new XNARectangle(GLEx.device); rect.Position = new Vector2(x, y); rect.StrokeWidth = lineWidth; rect.Width = width; rect.Height = height; rect.Stroke = color; XNALinearGradient gradient = new XNALinearGradient(GLEx.device); gradient.AddStop(color, 0); rect.Fill = gradient; CollectionUtils.Put(fillRectLazy, hashCode, rect); } rect.Draw(batch); idx++; }