Work on inventory management
This commit is contained in:
@@ -5,6 +5,7 @@ module Dodge.Update.Camera (
|
||||
updateCamera,
|
||||
) where
|
||||
|
||||
import Dodge.InputFocus
|
||||
import Bound
|
||||
import Dodge.Viewpoints
|
||||
import Control.Monad
|
||||
@@ -44,7 +45,7 @@ moveZoomCamera cfig theinput cr campos =
|
||||
where
|
||||
cpos = _crPos cr
|
||||
mitm = do
|
||||
i <- cr ^? crInvSel . isel . ispItem
|
||||
i <- cr ^? crManipulation . isel . ispItem
|
||||
cr ^? crInv . ix i
|
||||
newvf = cpos +.+ fromMaybe (V2 0 0) vfoffset
|
||||
vfoffset = do
|
||||
@@ -86,7 +87,7 @@ moveZoomCamera cfig theinput cr campos =
|
||||
|
||||
updateScopeZoom :: World -> World
|
||||
updateScopeZoom w = fromMaybe w $ do
|
||||
i <- w ^? cWorld . lWorld . creatures . ix 0 . crInvSel . isel . ispItem
|
||||
i <- w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . isel . ispItem
|
||||
return $ updateScopeZoom' i w
|
||||
|
||||
updateScopeZoom' :: Int -> World -> World
|
||||
@@ -178,7 +179,7 @@ rotateCameraBy x w =
|
||||
w
|
||||
& camPos . camRot +~ x
|
||||
& fromMaybe id (do
|
||||
i <- w ^? lWorld . creatures . ix 0 . crInvSel . isel . ispItem
|
||||
i <- w ^? lWorld . creatures . ix 0 . crManipulation . isel . ispItem
|
||||
return $ lWorld . creatures . ix 0 . crInv . ix i
|
||||
. itScope
|
||||
. scopePos
|
||||
@@ -187,17 +188,12 @@ rotateCameraBy x w =
|
||||
|
||||
rotateCamera :: Configuration -> World -> World
|
||||
rotateCamera cfig w
|
||||
| keyl && keyr = w
|
||||
| keyl = over cWorld (rotateCameraBy 0.025) w
|
||||
| keyr = over cWorld (rotateCameraBy (-0.025)) w
|
||||
| keydown SDL.ScancodeQ && keydown SDL.ScancodeE = w
|
||||
| keydown SDL.ScancodeQ = over cWorld (rotateCameraBy 0.025) w
|
||||
| keydown SDL.ScancodeE = over cWorld (rotateCameraBy (-0.025)) w
|
||||
| otherwise = ifConfigWallRotate cfig w
|
||||
where
|
||||
keyl = SDL.ScancodeQ `M.member` _pressedKeys (_input w) && notAtTerminal w
|
||||
keyr = SDL.ScancodeE `M.member` _pressedKeys (_input w) && notAtTerminal w
|
||||
|
||||
-- TODO check where/how this is used
|
||||
notAtTerminal :: World -> Bool
|
||||
notAtTerminal w = isNothing $ w ^? hud . hudElement . subInventory . termID
|
||||
keydown scode = scode `M.member` _pressedKeys (_input w) && not (inputFocus w)
|
||||
|
||||
--zoomCamBy :: Float -> World -> World
|
||||
--zoomCamBy x w = w {_cameraZoom = max (_cameraZoom w + x) 0.01}
|
||||
|
||||
Reference in New Issue
Block a user