progress drawing cursor
This commit is contained in:
@@ -26,6 +26,34 @@ struct
|
|||||||
[DRAW textMsg, DRAW cursorMsg]
|
[DRAW textMsg, DRAW cursorMsg]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fun buildCursor (posX, posY, fWindowWidth, fWindowHeight) =
|
||||||
|
let
|
||||||
|
val top = Real32.fromInt posX
|
||||||
|
val left = Real32.fromInt posY
|
||||||
|
val right = left + fontSize
|
||||||
|
val bottom = top + fontSize
|
||||||
|
|
||||||
|
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, 1.0, 1.0, 1.0
|
||||||
|
, right, top, 1.0, 1.0, 1.0
|
||||||
|
, left, bottom, 1.0, 1.0, 1.0
|
||||||
|
|
||||||
|
, left, bottom, 1.0, 1.0, 1.0
|
||||||
|
, right, bottom, 1.0, 1.0, 1.0
|
||||||
|
, right, top, 1.0, 1.0, 1.0
|
||||||
|
]
|
||||||
|
in
|
||||||
|
[vec]
|
||||||
|
end
|
||||||
|
|
||||||
(* builds text from a string with char-wrap.
|
(* builds text from a string with char-wrap.
|
||||||
* char-wrap is a similar concept to word-wrap,
|
* char-wrap is a similar concept to word-wrap,
|
||||||
* but it breaks on character in the middle of a word.
|
* but it breaks on character in the middle of a word.
|
||||||
@@ -298,6 +326,11 @@ struct
|
|||||||
| chr =>
|
| chr =>
|
||||||
let
|
let
|
||||||
val chrFun = Vector.sub (CozetteAscii.asciiTable, Char.ord chr)
|
val chrFun = Vector.sub (CozetteAscii.asciiTable, Char.ord chr)
|
||||||
|
val cursorAcc =
|
||||||
|
if absIdx <> cursorPos then
|
||||||
|
buildCursor (posX, posY, fWindowWidth, fWindowHeight)
|
||||||
|
else
|
||||||
|
cursorAcc
|
||||||
in
|
in
|
||||||
if posX + xSpace < windowWidth then
|
if posX + xSpace < windowWidth then
|
||||||
let
|
let
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ struct
|
|||||||
, cursorProgram
|
, cursorProgram
|
||||||
, ...
|
, ...
|
||||||
} = drawObject
|
} = drawObject
|
||||||
|
|
||||||
val _ = drawXyrgb (cursorVertexBuffer, cursorProgram, cursorDrawLength)
|
val _ = drawXyrgb (cursorVertexBuffer, cursorProgram, cursorDrawLength)
|
||||||
val _ = drawXyrgb (textVertexBuffer, textProgram, textDrawLength)
|
val _ = drawXyrgb (textVertexBuffer, textProgram, textDrawLength)
|
||||||
in
|
in
|
||||||
|
|||||||
6
shf.mlb
6
shf.mlb
@@ -11,7 +11,11 @@ message-types/mailbox-type.sml
|
|||||||
|
|
||||||
fcore/app-type.sml
|
fcore/app-type.sml
|
||||||
fcore/app-with.sml
|
fcore/app-with.sml
|
||||||
fcore/text-builder.sml
|
ann
|
||||||
|
"allowVectorExps true"
|
||||||
|
in
|
||||||
|
fcore/text-builder.sml
|
||||||
|
end
|
||||||
fcore/app-update.sml
|
fcore/app-update.sml
|
||||||
|
|
||||||
(* IMPERATIVE SHELL *)
|
(* IMPERATIVE SHELL *)
|
||||||
|
|||||||
Reference in New Issue
Block a user