public SpriteBatch(GraphicsDevice graphicsDevice) { GraphicsDevice = graphicsDevice ?? throw new ArgumentNullException(nameof(graphicsDevice)); vertexInfo = new VertexPositionColorTexture4[MaxSprites]; textureInfo = new Texture2D[MaxSprites]; spriteInfos = new SpriteInfo[MaxSprites]; sortedSpriteInfos = new IntPtr[MaxSprites]; _vertexBuffer = GraphicsDevice.CreateVertexBuffer(typeof(VertexPositionColorTexture), MaxVertices, BufferUsage.WriteOnly, true); _indexBuffer = GraphicsDevice.CreateIndexBuffer(IndexElementSize.SixteenBits, MaxIndices, BufferUsage.WriteOnly, false); _indexBuffer.SetData(indexData); //_spriteEffect = new SpriteEffect(graphicsDevice); //_spriteMatrixTransform = _spriteEffect.Parameters["MatrixTransform"].values; //_spriteEffectPass = _spriteEffect.CurrentTechnique.Passes[0]; _beginCalled = false; _numSprites = 0; }
public void PushSprite(VertexPositionColorTexture4 vertexPositionColorTexture, Texture2D texture) { _vertexPreBuffer[_numSprites] = vertexPositionColorTexture; _textureBuffer[_numSprites] = texture; _numSprites++; }