Ejemplo n.º 1
0
        public GLEx(GraphicsDevice device, LFont f)
        {
            GLEx.device = device;
            GLEx.cemera = new GLExCamera(device);
            clipRasterizerState = new RasterizerState() { ScissorTestEnable = true };
            device.RasterizerState = RasterizerState.CullNone;
            device.DepthStencilState = DepthStencilState.None;
            cemera.viewMatrix = cemera.Result;
            if (f == null)
            {
                SetFont(LFont.GetDefaultFont());
            }
            else
            {
                SetFont(f);
            }
            this.xnaClip = new RectBox(LSystem.screenRect);
            this.font = LFont.GetDefaultFont();
            this.innterBatch = new SpriteBatch(device);
            this.rectangle = new Rectangle(0, 0, 0, 0);
            this.postion = new Vector2(0, 0);
            this.color = Color.White;

            WhitePixel = new Texture2D(device, 1, 1, true, SurfaceFormat.Color);
            Color[] pixels = { Color.White };
            WhitePixel.SetData(pixels);
            GLEx.self = this;

            GLEx.gl = new GL();
            GLEx.gl10 = new GL10();

            shape = XNA_GL.LoadGLShape;
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public void Dispose()
 {
     this.initBatch = false;
     this.isClose = true;
     this.isDirty = false;
     this.useFont = false;
     this.useGLBegin = false;
     if (innterBatch != null)
     {
         innterBatch.Dispose();
         innterBatch = null;
     }
     if (batchSprite != null)
     {
         batchSprite.Dispose();
         batchSprite = null;
     }
     if (shape != null)
     {
         shape.Dispose();
         shape = null;
     }
     if (font != null)
     {
         font.Dispose();
         font = null;
     }
     GLEx.device = null;
     GLEx.cemera = null;
     if (WhitePixel != null)
     {
         WhitePixel.Dispose();
         WhitePixel = null;
     }
 }