Improve mouse click rotation
This commit is contained in:
@@ -46,8 +46,13 @@ data Input = Input
|
|||||||
, _textInput :: [Either TermSignal Char]
|
, _textInput :: [Either TermSignal Char]
|
||||||
, _scrollTestFloat :: Float
|
, _scrollTestFloat :: Float
|
||||||
, _scrollTestInt :: Int
|
, _scrollTestInt :: Int
|
||||||
|
, _inputMemory :: InputMemory
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data InputMemory
|
||||||
|
= WasMouseGameRotating
|
||||||
|
| WasNotMouseGameRotating
|
||||||
|
|
||||||
data TermSignal
|
data TermSignal
|
||||||
= TSescape
|
= TSescape
|
||||||
| TSreturn
|
| TSreturn
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ defaultInput =
|
|||||||
, _smoothScrollAmount = 0
|
, _smoothScrollAmount = 0
|
||||||
, _scrollTestFloat = 1
|
, _scrollTestFloat = 1
|
||||||
, _scrollTestInt = 0
|
, _scrollTestInt = 0
|
||||||
|
, _inputMemory = WasNotMouseGameRotating
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultWorld :: World
|
defaultWorld :: World
|
||||||
|
|||||||
@@ -208,7 +208,9 @@ rotateCamera cfig w
|
|||||||
angleBetween (w ^. input . mousePos)
|
angleBetween (w ^. input . mousePos)
|
||||||
<$> (w ^. input . heldPos . at SDL.ButtonRight) =
|
<$> (w ^. input . heldPos . at SDL.ButtonRight) =
|
||||||
w & wCam . camRot -~ rotation
|
w & wCam . camRot -~ rotation
|
||||||
|
& input . inputMemory .~ WasMouseGameRotating
|
||||||
| _gameplay_rotate_to_wall cfig
|
| _gameplay_rotate_to_wall cfig
|
||||||
|
, WasNotMouseGameRotating <- w ^. input . inputMemory
|
||||||
, isNothing $ w ^? input . mouseButtons . ix SDL.ButtonRight =
|
, isNothing $ w ^? input . mouseButtons . ix SDL.ButtonRight =
|
||||||
rotateToOverlappingWall w
|
rotateToOverlappingWall w
|
||||||
| otherwise = w
|
| otherwise = w
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ updateKeysTextInputTerminal tmid u =
|
|||||||
|
|
||||||
updateKeyInGame :: Universe -> Scancode -> Int -> Universe
|
updateKeyInGame :: Universe -> Scancode -> Int -> Universe
|
||||||
updateKeyInGame uv sc = \case
|
updateKeyInGame uv sc = \case
|
||||||
0 -> updateInitialPressInGame uv sc
|
0 -> updateInitialPressInGame uv sc & uvWorld . input . inputMemory .~ WasNotMouseGameRotating
|
||||||
x | x >= 30 -> updateLongPressInGame uv sc
|
x | x >= 30 -> updateLongPressInGame uv sc
|
||||||
_ -> uv
|
_ -> uv
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user