public ComplexDynamicMesh(DXCanvas canvas, int chunkCount) { double scaleX = 1.0 / chunkCount; for (int i = 0; i < chunkCount; ++i) { DynamicMesh mesh = canvas.CreateMesh(); mesh.LocalTransform = new Matrix(scaleX, 0.0, 0.0, 1.0, -i / chunkCount, 0.0); DIPs.Add(mesh); } }
public TextManager(DXCanvas canvas) { double baseFontSize = 16.0; int desiredFontSize = (int)(RenderSettings.DpiScale.Y * baseFontSize); int fontSize = 16; int[] sizes = { 16, 20, 24, 28, 32 }; for (int i = 0; i < sizes.Length; ++i) { if (desiredFontSize < sizes[i]) { break; } fontSize = sizes[i]; } SegoeUI = Font.Create(canvas.RenderDevice, String.Format("SegoeUI_{0}_Normal", fontSize)); VertexBuffer = new DynamicBuffer <Vertex>(canvas.RenderDevice, BindFlags.VertexBuffer); IndexBuffer = new DynamicBuffer <int>(canvas.RenderDevice, BindFlags.IndexBuffer); TextMesh = canvas.CreateMesh(DXCanvas.MeshType.Text); TextMesh.UseAlpha = true; }