Private Sub SetupFonts(ByVal vs() As CustomVertex.TransformedColoredTextured, ByVal vxbf As VertexBuffer, ByVal D9 As Device)
DisplayFont = New Direct3D.Font(D9, Me.Font)
Dim LV, Ctr As Integer
Dim dL As Single = 16.0F
Dim dR As Single = 1 / 8.0F, dC As Single = 1 / 16.0F
Dim ChrNum, ChrRow, ChrCol As Integer
Dim A As Array = vxbf.Lock(0, LockFlags.None)
vs = DirectCast(A, CustomVertex.TransformedColoredTextured())
For LV = 0 To Math.Min(31, Custext.Length - 1)
ChrNum = Convert.ToInt32(Custext.Chars(LV))
ChrRow = ChrNum \ 16
ChrCol = ChrNum Mod 16
vs(6 * LV) = New CustomVertex.TransformedColoredTextured(dL * LV, 0.0F, 0.0F, 1.0F, &HFFFF0000, ChrCol / 16.0F, ChrRow / 8.0F)
vs(6 * LV + 1) = New CustomVertex.TransformedColoredTextured(dL * (LV + 1), 0.0F, 0.0F, 1.0F, &HFFFFFF00, ChrCol / 16.0F + dC, ChrRow / 8.0F)
vs(6 * LV + 2) = New CustomVertex.TransformedColoredTextured(dL * LV, dL, 0.0F, 1.0F, &HFFFF00FF, ChrCol / 16.0F, ChrRow / 8.0F + dR)
vs(6 * LV + 3) = New CustomVertex.TransformedColoredTextured(dL * (LV + 1), dL, 0.0F, 1.0F, &HFFFFFFFF, ChrCol / 16.0F + dC, ChrRow / 8.0F + dR)
vs(6 * LV + 4) = vs(6 * LV + 2)
vs(6 * LV + 5) = vs(6 * LV + 1)
Next
vxbf.Unlock()
End Sub |