Work on terminals, add deactive data type status

This commit is contained in:
2025-08-19 13:48:54 +01:00
parent 2f4fcb42e5
commit b8581a7862
13 changed files with 331 additions and 269 deletions
+26 -3
View File
@@ -1,3 +1,4 @@
{-# LANGUAGE LambdaCase #-}
module Dodge.Render.Picture (
fixedCoordPictures,
) where
@@ -109,9 +110,8 @@ mouseCursorType u = case u ^. uvWorld . input . mouseContext of
OverCombFilter{} -> drawJumpDown 5
OverCombCombine{} -> drawGapPlus 5
OverCombEscape -> rotate (pi / 4) $ drawPlus 5
OverTerminalContinue{} -> drawReturn 5
OverTerminalReturn{} -> drawReturn 5
OverTerminalEscape -> rotate (pi / 4) $ drawPlus 5
OverTerminal _ ts -> drawCursorByTerminalStatus ts
OutsideTerminal -> rotate (pi / 4) $ drawPlus 5
MouseGameRotate -> rotate a (drawVerticalDoubleArrow 5)
where
w = u ^. uvWorld
@@ -122,6 +122,21 @@ mouseCursorType u = case u ^. uvWorld . input . mouseContext of
argV (w ^. cWorld . lWorld . lAimPos -.- cpos)
- w ^. wCam . camRot
drawCursorByTerminalStatus :: TerminalStatus -> Picture
drawCursorByTerminalStatus = \case
TerminalPressTo "QUIT" -> drawQuitTerminal 5
TerminalPressTo _ -> drawArrowDown 5
TerminalTextInput "QUIT" -> drawQuitTerminal 5
TerminalTextInput{} -> drawReturn 5
_ -> drawEmptySet 5
drawQuitTerminal :: Float -> Picture
drawQuitTerminal x = fold
[ line [V2 x x, V2 (- x) (- x)]
, line [V2 x (-x), V2 (- x) x]
, polygonWire (square x)
]
drawEmptySet :: Float -> Picture
drawEmptySet x =
fold
@@ -202,6 +217,14 @@ drawVerticalDoubleArrow x =
z = 1.5 * x
w = 0.6 * x
drawArrowDown :: Float -> Picture
drawArrowDown x =
line [V2 0 z, V2 0 (- z)]
<> line [V2 (- w) (w - z), V2 0 (- z), V2 w (w - z)]
where
z = 1 * x
w = 0.6 * x
drawDragDrop :: Float -> Picture
drawDragDrop x =
line (fmap (+ V2 z (- x)) [V2 (- x) x, V2 0 x, V2 0 (- x)])