Continue hud/mouse refactor

This commit is contained in:
2024-11-16 15:06:05 +00:00
parent 0621709f7b
commit 5efc9220e0
6 changed files with 184 additions and 226 deletions
+27 -24
View File
@@ -2,7 +2,6 @@ module Dodge.Render.Picture (
fixedCoordPictures,
) where
import Dodge.CharacterEnums
import Control.Lens
import Control.Monad
import Data.Maybe
@@ -79,14 +78,16 @@ drawMouseCursor u =
mouseCursorType :: Universe -> Picture
mouseCursorType u = case u ^. uvWorld . input . mouseContext of
NoMouseContext -> drawPlus 5
NoMouseContext -> drawEmptySet 5
MouseAiming -> rotate a (drawPlus 5)
MouseClick -> drawPlus 5
OverInvSelect {} -> drawSelect 5
OverInvFilt {} -> drawCombFilter 5
OverCombSelect {} -> drawSelect 5
OverCombFilter {} -> drawCombFilterJump 5
OverCombCombine {} -> drawGapPlus 5
OverTerminalReturn -> drawReturn
OverCombEscape -> rotate (pi/4) $ drawPlus 5
OverTerminalReturn -> drawReturn 5
OverTerminalEscape -> rotate (pi/4) $ drawPlus 5
where
w = u ^. uvWorld
@@ -96,22 +97,22 @@ mouseCursorType u = case u ^. uvWorld . input . mouseContext of
argV (mouseWorldPos (w ^. input) (w ^. wCam) -.- cpos)
- w ^. wCam . camRot
determineTermCursor :: Int -> Universe -> Picture
determineTermCursor tmid u = fromMaybe (drawPlus 5) $ do
return drawReturn
drawReturn :: Picture
drawReturn = fold
[line [V2 0 0, V2 3 3]
,line [V2 0 0, V2 3 (-3)]
,line [V2 0 0, V2 6 0]
,line [V2 6 0, V2 6 10]
drawEmptySet :: Float -> Picture
drawEmptySet x = fold
[line [V2 x x,V2 (-x) (-x)]
,circle x
]
--drawReturn = scale 0.1 0.1 . translate (-50) (-100) $ text [toEnum 153]
drawWireRectCursor :: Picture
drawWireRectCursor = scale 0.1 0.1 $ text [cWireRect]
--drawReturn = text "ASDF"
drawReturn :: Float -> Picture
drawReturn x = fold
[line [V2 0 0, V2 y y]
,line [V2 0 0, V2 y (-y)]
,line [V2 0 0, V2 (2*y) 0]
,line [V2 (2*y) 0, V2 (2*y) (2*x)]
]
where
y = 0.7 * x
--drawReturn = scale 0.1 0.1 . translate (-50) (-100) $ text [toEnum 153]
drawPlus :: Float -> Picture
drawPlus x = fold [line [V2 (- x) 0, V2 x 0], line [V2 0 (- x), V2 0 x]]
@@ -121,13 +122,15 @@ drawCombFilterJump x = rotate (0.25*pi)
$ fold [line [V2 0 0, V2 x 0], line [V2 0 0, V2 0 x]]
drawSelect :: Float -> Picture
drawSelect x = line
[ V2 x x
, V2 0 x
, V2 0 (-x)
, V2 x (-x)
] <>
line [V2 (-x) 0, V2 0 0]
drawSelect x = polygonWire $ rectWH x (0.5 * x)
-- line [V2 (-x) 0, V2 0 0]
--drawSelect x = line
-- [ V2 x x
-- , V2 0 x
-- , V2 0 (-x)
-- , V2 x (-x)
-- ] <>
-- line [V2 (-x) 0, V2 0 0]
drawCombFilter :: Float -> Picture
drawCombFilter x = rotate (0.25*pi)