Slim Dx Version 4.0 13.43 __full__ Access

// Draw a sprite var sprite = new Vertex[4] { new Vertex(new Vector3(-0.5f, -0.5f, 0), new Vector2(0, 1)), new Vertex(new Vector3(0.5f, -0.5f, 0), new Vector2(1, 1)), new Vertex(new Vector3(0.5f, 0.5f, 0), new Vector2(1, 0)), new Vertex(new Vector3(-0.5f, 0.5f, 0), new Vector2(0, 0)), };

// Main loop while (true) { // Clear the screen var renderTarget = _swapChain.GetBuffer<Texture2D>(0); var context = _device.ImmediateContext; context.ClearRenderTargetView(renderTarget, Color.CornflowerBlue);

struct Vertex { public Vector3 Position; public Vector2 TexCoord; slim dx version 4.0 13.43

public Vertex(Vector3 position, Vector2 texCoord) { Position = position; TexCoord = texCoord; } } } This example creates a window, loads a texture, and renders a sprite using the texture. Make sure to replace "texture.png" with the path to your own texture file.

Slim DX version 4.0!

context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleStrip; context.InputAssembler.SetVertexBuffers(0, new[] { new VertexBufferBinding(_device, sprite, 0) });

class Program { private static Device _device; private static SwapChain _swapChain; private static Texture2D _texture; private static ShaderResourceView _textureView; // Draw a sprite var sprite = new

Keep in mind that you need to have the Slim DX 4.0 libraries and the DirectX SDK installed to run this code. Also, error checking has been omitted for brevity.