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