Change keycode input to scancode

This commit is contained in:
jgk
2021-03-25 13:28:28 +01:00
parent e32c6082c5
commit 45e02d0752
5 changed files with 35 additions and 32 deletions
+4 -4
View File
@@ -98,23 +98,23 @@ zoomOutLongGun w | currentZoom > 0.5 = over (wpPointer . itAttachment . _Just .
rotCam = rotateCameraL . rotateCameraR . zoomCamIn . zoomCamOut . autoZoomCam
rotateCameraL :: World -> World
rotateCameraL w | SDL.KeycodeQ `S.member` _keys w
rotateCameraL w | SDL.ScancodeQ `S.member` _keys w
= w & cameraRot +~ 0.015
& creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
. itAttachment . _Just . scopePos %~ rotateV 0.015
| otherwise = w
rotateCameraR :: World -> World
rotateCameraR w | SDL.KeycodeE `S.member` _keys w
rotateCameraR w | SDL.ScancodeE `S.member` _keys w
= w & cameraRot -~ 0.015
& creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
. itAttachment . _Just . scopePos %~ rotateV (-0.015)
| otherwise = w
zoomCamIn :: World -> World
zoomCamIn w | SDL.KeycodeJ `S.member` _keys w
zoomCamIn w | SDL.ScancodeJ `S.member` _keys w
= w {_cameraZoom = _cameraZoom w + 0.01}
| otherwise = w
zoomCamOut :: World -> World
zoomCamOut w | SDL.KeycodeK `S.member` _keys w
zoomCamOut w | SDL.ScancodeK `S.member` _keys w
= w {_cameraZoom = max (_cameraZoom w - 0.01) 0.01}
| otherwise = w