add z-index parameter to cursors, and refactor code to use them
This commit is contained in:
@@ -39,6 +39,7 @@ struct
|
||||
PipeCursor.lerp
|
||||
( x
|
||||
, y
|
||||
, 0.01
|
||||
, TextConstants.scale
|
||||
, floatWindowWidth
|
||||
, floatWindowHeight
|
||||
@@ -109,6 +110,7 @@ struct
|
||||
PipeCursor.lerp
|
||||
( x
|
||||
, y
|
||||
, 0.01
|
||||
, TextConstants.scale
|
||||
, floatWindowWidth
|
||||
, floatWindowHeight
|
||||
|
||||
@@ -6,7 +6,7 @@ struct
|
||||
fun yToNdc (yOffset, ypos, scale, halfHeight) =
|
||||
~(((ypos * scale + yOffset) - halfHeight) / halfHeight)
|
||||
|
||||
fun lerp (xOffset: Real32.real, yOffset, scale, windowWidth, windowHeight, r, g, b) =
|
||||
fun lerp (xOffset: Real32.real, yOffset, z, scale, windowWidth, windowHeight, r, g, b) =
|
||||
let
|
||||
val halfWidth = windowWidth / 2.0
|
||||
val halfHeight = windowHeight / 2.0
|
||||
@@ -14,21 +14,27 @@ struct
|
||||
#[
|
||||
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 13.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b,
|
||||
xToNdc (xOffset, 1.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 13.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b,
|
||||
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b,
|
||||
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b,
|
||||
xToNdc (xOffset, 1.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 13.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b,
|
||||
xToNdc (xOffset, 1.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b
|
||||
]
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ struct
|
||||
fun yToNdc (yOffset, ypos, scale, halfHeight) =
|
||||
~(((ypos * scale + yOffset) - halfHeight) / halfHeight)
|
||||
|
||||
fun lerp (xOffset: Real32.real, yOffset, scale, windowWidth, windowHeight, r, g, b) =
|
||||
fun lerp (xOffset: Real32.real, yOffset, z, scale, windowWidth, windowHeight, r, g, b) =
|
||||
let
|
||||
val halfWidth = windowWidth / 2.0
|
||||
val halfHeight = windowHeight / 2.0
|
||||
@@ -14,21 +14,27 @@ struct
|
||||
#[
|
||||
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 13.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b,
|
||||
xToNdc (xOffset, 6.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 13.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b,
|
||||
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b,
|
||||
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b,
|
||||
xToNdc (xOffset, 6.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 13.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b,
|
||||
xToNdc (xOffset, 6.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b
|
||||
]
|
||||
end
|
||||
|
||||
@@ -41,7 +41,7 @@ struct
|
||||
val textAcc = Vector.concat textAcc
|
||||
val bgAcc = Vector.concat bgAcc
|
||||
val vec = Vector.concat [textAcc, bgAcc, cursorAcc]
|
||||
val drawMsg = DRAW_TEXT vec
|
||||
val drawMsg = DRAW_TEXT cursorAcc
|
||||
in
|
||||
DRAW drawMsg :: msgs
|
||||
end
|
||||
@@ -63,7 +63,16 @@ struct
|
||||
|
||||
fun makeRect (posX, posY, fw, fh, r, g, b) =
|
||||
Rect.lerp
|
||||
(Real32.fromInt (posX - 1), Real32.fromInt posY, scale, fw, fh, r, g, b)
|
||||
( Real32.fromInt (posX - 1)
|
||||
, Real32.fromInt posY
|
||||
, 0.01
|
||||
, scale
|
||||
, fw
|
||||
, fh
|
||||
, r
|
||||
, g
|
||||
, b
|
||||
)
|
||||
|
||||
fun makeChr (chr, posX, posY, windowWidth, windowHeight, r, g, b) =
|
||||
CozetteAscii.make
|
||||
|
||||
Reference in New Issue
Block a user