Implement terminals
This commit is contained in:
@@ -12,9 +12,9 @@ import qualified Data.Set as S
|
||||
import Control.Lens
|
||||
|
||||
updateUsingInput :: World -> World
|
||||
updateUsingInput w = if _carteDisplay w
|
||||
then updatePressedButtonsCarte (_mouseButtons w) w
|
||||
else updatePressedButtons (_mouseButtons w) w
|
||||
updateUsingInput w = case _hudElement $ _hud w of
|
||||
DisplayInventory {} -> updatePressedButtons (_mouseButtons w) w
|
||||
DisplayCarte -> updatePressedButtonsCarte (_mouseButtons w) w
|
||||
|
||||
updatePressedButtons :: S.Set MouseButton -> World -> World
|
||||
updatePressedButtons pkeys w
|
||||
@@ -26,7 +26,7 @@ updatePressedButtons pkeys w
|
||||
& cameraRot -~ rotation
|
||||
| otherwise = w
|
||||
where
|
||||
inTopInv = _inventoryMode w == TopInventory
|
||||
inTopInv = _hudElement (_hud w) == DisplayInventory NoSubInventory
|
||||
lbPressed = ButtonLeft `S.member` pkeys
|
||||
rbPressed = ButtonRight `S.member` pkeys
|
||||
mbPressed = ButtonMiddle `S.member` pkeys
|
||||
@@ -35,10 +35,10 @@ updatePressedButtons pkeys w
|
||||
updatePressedButtonsCarte :: S.Set MouseButton -> World -> World
|
||||
updatePressedButtonsCarte pkeys w
|
||||
| rbPressed = w & clickMousePos .~ _mousePos w
|
||||
& carteCenter %~ (-.- trans)
|
||||
& hud . carteCenter %~ (-.- trans)
|
||||
| lbPressed = w & clickMousePos .~ _mousePos w
|
||||
& carteRot -~ rot
|
||||
& carteZoom *~ czoom
|
||||
& hud . carteRot -~ rot
|
||||
& hud . carteZoom *~ czoom
|
||||
| otherwise = w
|
||||
where
|
||||
lbPressed = ButtonLeft `S.member` pkeys
|
||||
@@ -46,4 +46,4 @@ updatePressedButtonsCarte pkeys w
|
||||
--mbPressed = ButtonMiddle `S.member` pkeys
|
||||
rot = angleBetween (_mousePos w) (_clickMousePos w)
|
||||
czoom = magV (_mousePos w) / magV (_clickMousePos w)
|
||||
trans = rotateV (_carteRot w) $ (1 / _carteZoom w) *.* (_mousePos w -.- _clickMousePos w)
|
||||
trans = rotateV (_carteRot (_hud w)) $ (1 / _carteZoom (_hud w)) *.* (_mousePos w -.- _clickMousePos w)
|
||||
|
||||
Reference in New Issue
Block a user