Implement terminals
This commit is contained in:
+13
-11
@@ -89,10 +89,12 @@ handleResizeEvent sev u = return . Just $ u
|
||||
|
||||
handlePressedMouseButton :: MouseButton -> Universe -> Maybe Universe
|
||||
handlePressedMouseButton but w
|
||||
| but == ButtonMiddle || _carteDisplay (_uvWorld w)
|
||||
| but == ButtonMiddle || _hudElement (_hud $ _uvWorld w) == DisplayCarte
|
||||
= Just $ w & uvWorld . clickMousePos .~ _mousePos (_uvWorld w)
|
||||
| but == ButtonLeft = case _inventoryMode (_uvWorld w) of
|
||||
CombineInventory mi -> Just $ fromMaybe (w & uvWorld . inventoryMode .~ TopInventory) $ do -- ugly
|
||||
| but == ButtonLeft = case _hudElement (_hud $ _uvWorld w) of
|
||||
DisplayInventory (CombineInventory mi)
|
||||
-> Just $ fromMaybe (w & uvWorld . hud . hudElement .~ DisplayInventory NoSubInventory)
|
||||
$ do -- ugly
|
||||
i <- mi
|
||||
return $ over uvWorld (doCombine i) w
|
||||
_ -> Just w
|
||||
@@ -117,11 +119,11 @@ handleMouseWheelEvent mwev w = case _menuLayers w of
|
||||
_ -> Just w
|
||||
|
||||
wheelEvent :: Float -> World -> World
|
||||
wheelEvent y w = case (_carteDisplay w, _inventoryMode w) of
|
||||
(True, _)
|
||||
| rbDown -> w & carteZoom %~ min 0.75 . max 0.05 . ((1+y*0.1) * )
|
||||
wheelEvent y w = case _hudElement $ _hud w of
|
||||
DisplayCarte
|
||||
| rbDown -> w & hud . carteZoom %~ min 0.75 . max 0.05 . ((1+y*0.1) * )
|
||||
| otherwise -> w & selLocation %~ (`mod` numLocs) . (+ yi)
|
||||
(_, TopInventory)
|
||||
DisplayInventory NoSubInventory
|
||||
-- functions that modify the inventory should be centralised so that
|
||||
-- this lock can be sensibly applied, perhaps
|
||||
| _crInvLock (_creatures w IM.! _yourID w) -> w
|
||||
@@ -131,14 +133,14 @@ wheelEvent y w = case (_carteDisplay w, _inventoryMode w) of
|
||||
| lbDown -> w & cameraZoom +~ y
|
||||
| invKeyDown -> stopSoundFrom (CrReloadSound 0) $ changeSwapInvSel yi w
|
||||
| otherwise -> stopSoundFrom (CrReloadSound 0) $ changeAugInvSel yi w
|
||||
(_, TweakInventory)
|
||||
DisplayInventory TweakInventory
|
||||
| invKeyDown && rbDown -> w & moveTweakSel yi
|
||||
| invKeyDown -> stopSoundFrom (CrReloadSound 0) $ changeInvSel yi w
|
||||
| rbDown -> w & changeTweakParam yi
|
||||
| otherwise -> w & moveTweakSel yi
|
||||
(_, CombineInventory _) -> w
|
||||
& inventoryMode . combineInvSel . _Just %~ ((`mod` numcombs) . subtract yi)
|
||||
(_, _) -> w
|
||||
DisplayInventory (CombineInventory _) -> w
|
||||
& hud . hudElement . subInventory . combineInvSel . _Just %~ ((`mod` numcombs) . subtract yi)
|
||||
_ -> w
|
||||
where
|
||||
numcombs = length $ combineItemListYou w
|
||||
yi = round $ signum y
|
||||
|
||||
Reference in New Issue
Block a user