Add general smooth scrolling, move camera into world

This commit is contained in:
2023-03-26 20:09:00 +01:00
parent 73e742e1a2
commit 07a1d71039
32 changed files with 154 additions and 131 deletions
+5 -5
View File
@@ -75,15 +75,15 @@ wasdWithAiming w speed cr
| otherwise = crMvForward speed
theTurn cr' = creatureTurnTowardDir (_crMvAim cr') 0.2 cr'
movDir = wasdDir w
dir = fmap ((w ^. cWorld . cwCam . camRot) +) (safeArgV movDir)
movAbs = rotateV (w ^. cWorld . cwCam . camRot) $ normalizeV movDir
dir = fmap ((w ^. wCam . camRot) +) (safeArgV movDir)
movAbs = rotateV (w ^. wCam . camRot) $ normalizeV movDir
isAiming = _posture (_crStance cr) == Aiming
mouseDir = fromMaybe
(argV (_mousePos (_input w)) + (w ^. cWorld . cwCam . camRot) )
(argV (_mousePos (_input w)) + (w ^. wCam . camRot) )
$ do
itRef <- cr ^? crManipulation . manObject . inInventory . ispItem
_ <- cr ^? crInv . ix itRef . itScope . scopePos
return . argV $ mouseWorldPos (w ^. input) (w ^. cWorld . cwCam) -.- _crPos cr
return . argV $ mouseWorldPos (w ^. input) (w ^. wCam) -.- _crPos cr
aimTurn :: Float -> Creature -> Creature
aimTurn a cr = creatureTurnTowardDir a (x * 0.2) cr
@@ -120,7 +120,7 @@ pressedMBEffectsTopInventory pkeys w
| isDown SDL.ButtonLeft && isDown SDL.ButtonRight && inTopInv = useItem (you w) w
| isDown SDL.ButtonLeft && inTopInv = doTopInvLeftClick (you w) w
| isDown SDL.ButtonMiddle =
w & cWorld . cwCam . camRot -~ rotation
w & wCam . camRot -~ rotation
& input . clickMousePos .~ _mousePos (_input w)
| otherwise = w
where