Work on mouse wheel scrolling

This commit is contained in:
2022-10-25 22:59:01 +01:00
parent 86a9ab7582
commit 4ffd361f11
15 changed files with 143 additions and 57 deletions
+18 -13
View File
@@ -9,6 +9,7 @@ doInvEffect :: ItInvEffect -> Item -> Creature -> World -> World
doInvEffect iie = case iie of
NoInvEffect -> const $ const id
RewindEffect -> rewindEffect
TimeScrollEffect -> timeScrollEffect
EffectIfHeld f g -> onOffEff f g
CreateHeldLight -> createHeldLight
CreateShieldWall -> createShieldWall
@@ -23,20 +24,24 @@ onOffEff f g it
| _itIsHeld it = doInvEffect f it
| otherwise = doInvEffect g it
timeScrollEffect :: Item -> Creature -> World -> World
timeScrollEffect _ _ w = w & timeFlow .~ ScrollTimeFlow 0
rewindEffect :: Item -> Creature -> World -> World
rewindEffect itm cr w
| Just invid == _crLeftInvSel cr =
w & cwTime . rewindWorlds %~ (take maxcharge . (cw :))
& ptrWpCharge .~ length (w ^. cwTime . rewindWorlds)
| otherwise =
w & cwTime . rewindWorlds .~ []
& ptrWpCharge .~ 0
where
invid = _ipInvID $ _itLocation itm
ptrWpCharge = cWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
cw =
_cWorld w
rewindEffect _ _ w = w
--rewindEffect itm cr w =
-- | Just invid == _crLeftInvSel cr =
-- w & cwTime . rewindWorlds %~ (take maxcharge . (cw :))
-- & ptrWpCharge .~ length (w ^. cwTime . rewindWorlds)
-- | otherwise =
-- w & cwTime . rewindWorlds .~ []
-- & ptrWpCharge .~ 0
-- where
-- invid = _ipInvID $ _itLocation itm
-- ptrWpCharge = cWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
-- maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
-- cw =
-- _cWorld w
--resetAttachmentEffect :: Item -> Creature -> World -> World
--resetAttachmentEffect itm cr w