Rehome launcher
This commit is contained in:
+11
-1
@@ -23,6 +23,7 @@ import Dodge.Inventory
|
||||
import Dodge.Config.Data
|
||||
--import Geometry
|
||||
import Preload.Update
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
@@ -30,7 +31,6 @@ import Data.Maybe
|
||||
--import Data.List
|
||||
--import Data.Function (on)
|
||||
import qualified Data.Set as S
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import SDL
|
||||
|
||||
handleEvent :: World -> Event -> Maybe World
|
||||
@@ -100,10 +100,12 @@ wheelUpEvent w = case _carteDisplay w of
|
||||
<*> pure (_crInvSel (you w))
|
||||
<*> pure w
|
||||
| lbDown -> w & cameraZoom +~ 0.1
|
||||
| invKeyDown -> swapInvUp $ upInvPos w
|
||||
| otherwise -> upInvPos w
|
||||
where
|
||||
rbDown = ButtonRight `S.member` _mouseButtons w
|
||||
lbDown = ButtonLeft `S.member` _mouseButtons w
|
||||
invKeyDown = ScancodeCapsLock `S.member` _keys w
|
||||
z = _carteZoom w
|
||||
numLocs = (fst . IM.findMax $ _seenLocations w) + 1
|
||||
|
||||
@@ -116,13 +118,21 @@ wheelDownEvent w = case _carteDisplay w of
|
||||
| rbDown -> fromMaybe (closeObjScrollDown w)
|
||||
$ (yourItem w ^? itScrollDown) <*> pure (_crInvSel (you w)) <*> pure w
|
||||
| lbDown -> w {_cameraZoom = max (_cameraZoom w - 0.1) 0.01}
|
||||
| invKeyDown -> downInvPos $ swapInvUp w
|
||||
| otherwise -> downInvPos w
|
||||
where
|
||||
rbDown = ButtonRight `S.member` _mouseButtons w
|
||||
lbDown = ButtonLeft `S.member` _mouseButtons w
|
||||
z = _carteZoom w
|
||||
invKeyDown = ScancodeCapsLock `S.member` _keys w
|
||||
numLocs = (fst . IM.findMax $ _seenLocations w) + 1
|
||||
|
||||
swapInvUp :: World -> World
|
||||
swapInvUp w = w & creatures . ix (_yourID w) . crInv %~ IM.swapKeys (i `mod` n) ((i + 1) `mod` n)
|
||||
where
|
||||
i = _crInvSel $ you w
|
||||
n = length $ IM.keys $ _crInv $ _creatures w IM.! _yourID w
|
||||
|
||||
upInvPos :: World -> World
|
||||
upInvPos w = stopSoundFrom (CrReloadSound 0) $ w
|
||||
& creatures . ix (_yourID w) . crInvSel %~ (`mod` n) . subtract 1
|
||||
|
||||
Reference in New Issue
Block a user