Start to generalise text input to "terminal signal" input

This commit is contained in:
2023-03-26 13:57:26 +01:00
parent cfb0a49059
commit 082ce9c9a1
39 changed files with 171 additions and 165 deletions
+4 -4
View File
@@ -49,7 +49,7 @@ targetRBCreatureUp cr w
. filter (canseepos . _crPos)
$ crsNearCirc mwp 40 w
canseepos p = hasLOS (_crPos cr) p w
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . cwCamPos)
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . cwCam)
updatePos t' = t' & ctPos .~ posFromMaybeID (_ctID t')
posFromMaybeID Nothing = Nothing
posFromMaybeID (Just i) = w ^? cWorld . lWorld . creatures . ix i . crPos
@@ -61,7 +61,7 @@ targetRBCreatureUp cr w
targetCursorUpdate :: World -> CreatureTargeting -> CreatureTargeting
targetCursorUpdate w ct =
ct
& ctPos . _Just .~ mouseWorldPos (w ^. input) (w ^. cWorld . cwCamPos)
& ctPos . _Just .~ mouseWorldPos (w ^. input) (w ^. cWorld . cwCam)
& ctActive .~ True
& ctType ?~ TargetCursor
@@ -69,7 +69,7 @@ targetRBPressUpdate :: World -> CreatureTargeting -> CreatureTargeting
targetRBPressUpdate w t
| SDL.ButtonRight `M.member` _mouseButtons (_input w) =
t
& ctPos %~ maybe (Just $ mouseWorldPos (w ^. input) (w ^. cWorld . cwCamPos)) Just
& ctPos %~ maybe (Just $ mouseWorldPos (w ^. input) (w ^. cWorld . cwCam)) Just
& ctActive .~ True
& ctType ?~ TargetRBPress
| otherwise =
@@ -100,7 +100,7 @@ targetLaserUpdate cr w t
where
(mp, _) = reflectLaserAlong 0.2 sp ep w
sp = _crPos cr +.+ 15 *.* unitVectorAtAngle (_crDir cr)
ep = sp +.+ 5000 *.* normalizeV (mouseWorldPos (w ^. input) (w ^. cWorld . cwCamPos) -.- sp)
ep = sp +.+ 5000 *.* normalizeV (mouseWorldPos (w ^. input) (w ^. cWorld . cwCam) -.- sp)
addLaserPic =
cWorld . lWorld . lasers
.:~ LaserStart