public void Draw(Texture2D texture, Rectangle size, Color color) { renderEffect.Begin(); renderEffect.BeginPass(0); texture.Bind(0); renderEffect.SetColor("c", color); DrawPrimitive(size); renderEffect.EndPass(); renderEffect.End(); }
public void DrawPrimitive(Rectangle r) { Device.SetTransform(TransformState.World, SharpDX.Matrix.Scaling(r.Width, r.Height, 1) * SharpDX.Matrix.Translation(-Device.Viewport.Width * 0.5f + r.X, Device.Viewport.Height * 0.5f - r.Height + r.Y, 0)); Device.SetStreamSource(0, cubeVert, 0, 28); Device.VertexDeclaration = cubeDecl; Device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); }