Files
sml-projects/temp.txt

42 lines
1.0 KiB
Plaintext

structure TextBuilder :> TEXT_BUILDER =
struct
val xSpace = 13
val xSpace3 = xSpace * 3
val ySpace = 25
val fontSize = 30.0
fun accToDrawMsg (textAcc, cursorAcc) =
let
open MailboxType
open DrawMsg
val textAcc = Vector.concat textAcc
val cursorAcc = Vector.concat cursorAcc
val textMsg = REDRAW_TEXT textAcc
val cursorMsg = REDRAW_CURSOR cursorAcc
in
[DRAW textMsg, DRAW cursorMsg]
end
fun buildCursor (posX, posY, fWindowWidth, fWindowHeight, r, g, b) =
let
val left = posX + 9
val left = Real32.fromInt left
val right = left + 12.0
val top = Real32.fromInt posY
val bottom = top + fontSize + 2.0
val halfHeight = fWindowHeight / 2.0
val top = (~(top - halfHeight)) / halfHeight
val bottom = (~(bottom - halfHeight)) / halfHeight
val halfWidth = fWindowWidth / 2.0
val left = (left - halfWidth) / halfWidth
val right = (right - halfWidth) / halfWidth
val vec =
#[ left, top, r, g, b
, right, top, r, g, b