Cleanup, only commented out char sequence scrolling code
This commit is contained in:
+1
-5
@@ -1,5 +1 @@
|
|||||||
/home/justin/Haskell/loop/src/Dodge/Update/Camera.hs:215:5-18: warning: [-Wunused-local-binds]
|
All good (617 modules, at 16:59:47)
|
||||||
Defined but not used: ‘rotateanyscope’
|
|
||||||
|
|
|
||||||
215 | rotateanyscope = fromMaybe id $ do
|
|
||||||
| ^^^^^^^^^^^^^^
|
|
||||||
|
|||||||
+10
-10
@@ -2,16 +2,16 @@ module Dodge.Base.You
|
|||||||
(you
|
(you
|
||||||
-- , yourScopeInvID
|
-- , yourScopeInvID
|
||||||
, yourInv
|
, yourInv
|
||||||
, yourScrollAttachment
|
-- , yourScrollAttachment
|
||||||
, yourItem
|
, yourItem
|
||||||
)where
|
)where
|
||||||
|
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
import Dodge.HeldScroll
|
--import Dodge.HeldScroll
|
||||||
import qualified IntMapHelp as IM
|
import qualified IntMapHelp as IM
|
||||||
--import qualified Data.Map.Strict as M
|
--import qualified Data.Map.Strict as M
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Control.Monad
|
--import Control.Monad
|
||||||
--import Data.Maybe
|
--import Data.Maybe
|
||||||
|
|
||||||
you :: World -> Creature
|
you :: World -> Creature
|
||||||
@@ -22,13 +22,13 @@ yourItem w = do
|
|||||||
i <- you w ^? crManipulation . manObject . inInventory . ispItem
|
i <- you w ^? crManipulation . manObject . inInventory . ispItem
|
||||||
_crInv (you w) IM.!? i
|
_crInv (you w) IM.!? i
|
||||||
|
|
||||||
yourScrollAttachment :: World -> Maybe (Int,ScrollAttachParams)
|
--yourScrollAttachment :: World -> Maybe (Int,ScrollAttachParams)
|
||||||
yourScrollAttachment w = do
|
--yourScrollAttachment w = do
|
||||||
i <- you w ^? crManipulation . manObject . inInventory . ispItem
|
-- i <- you w ^? crManipulation . manObject . inInventory . ispItem
|
||||||
itm <- _crInv (you w) IM.!? i
|
-- itm <- _crInv (you w) IM.!? i
|
||||||
atparams <- you w ^? crInv . ix (i - 1) . itUse . attachParams . scrollAttachParams
|
-- atparams <- you w ^? crInv . ix (i - 1) . itUse . attachParams . scrollAttachParams
|
||||||
guard (canHeldScrollAttach itm atparams)
|
-- guard (canHeldScrollAttach itm atparams)
|
||||||
return (i - 1, atparams)
|
-- return (i - 1, atparams)
|
||||||
|
|
||||||
--yourScopeInvID :: World -> Maybe Int
|
--yourScopeInvID :: World -> Maybe Int
|
||||||
--yourScopeInvID w = do
|
--yourScopeInvID w = do
|
||||||
|
|||||||
@@ -121,15 +121,7 @@ data AmmoParams = BulletParams {_ampBullet :: Bullet}
|
|||||||
deriving (Eq, Show, Read) --Generic, Flat)
|
deriving (Eq, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data ScrollAttachParams
|
data ScrollAttachParams
|
||||||
= -- ZoomScrollParams
|
= CharScrollParams
|
||||||
-- { -- | a camera offset
|
|
||||||
-- _opticPos :: Point2 -- this should be relative to the camera rotation
|
|
||||||
-- -- then when the camera rotates when firing etc,
|
|
||||||
-- -- this doesn't need to be changed
|
|
||||||
-- , _opticZoom :: Float
|
|
||||||
-- , _opticDefaultZoom :: Float
|
|
||||||
-- }
|
|
||||||
CharScrollParams
|
|
||||||
{ _scrollChar :: Seq.Seq Char}
|
{ _scrollChar :: Seq.Seq Char}
|
||||||
deriving (Eq, Show, Read) --Generic, Flat)
|
deriving (Eq, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module Dodge.HeldScroll (
|
module Dodge.HeldScroll (
|
||||||
doHeldScroll,
|
-- doHeldScroll,
|
||||||
canHeldScrollAttach,
|
-- canHeldScrollAttach,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
--import LensHelp hiding ((<|), (|>))
|
--import LensHelp hiding ((<|), (|>))
|
||||||
@@ -9,13 +9,13 @@ module Dodge.HeldScroll (
|
|||||||
--import Geometry
|
--import Geometry
|
||||||
--import Control.Lens hiding ((<|), (|>))
|
--import Control.Lens hiding ((<|), (|>))
|
||||||
--import Data.Sequence
|
--import Data.Sequence
|
||||||
import Dodge.Data.World
|
--import Dodge.Data.World
|
||||||
--import SDL (MouseButton (..))
|
--import SDL (MouseButton (..))
|
||||||
--import qualified Data.Map.Strict as M
|
--import qualified Data.Map.Strict as M
|
||||||
|
|
||||||
-- note that scope zooming is controlled by updateScopeZoom
|
-- note that scope zooming is controlled by updateScopeZoom
|
||||||
doHeldScroll :: Int -> ScrollAttachParams -> Float -> World -> World
|
--doHeldScroll :: Int -> ScrollAttachParams -> Float -> World -> World
|
||||||
doHeldScroll _ _ _ = id
|
--doHeldScroll _ _ _ = id
|
||||||
--doHeldScroll invid hs x w = case hs of
|
--doHeldScroll invid hs x w = case hs of
|
||||||
-- ZoomScrollParams{}
|
-- ZoomScrollParams{}
|
||||||
-- | SDL.ButtonRight `M.member` _mouseButtons (_input w) -> w &
|
-- | SDL.ButtonRight `M.member` _mouseButtons (_input w) -> w &
|
||||||
@@ -72,5 +72,5 @@ doHeldScroll _ _ _ = id
|
|||||||
--cycleR (xs :|> x) = x <| xs
|
--cycleR (xs :|> x) = x <| xs
|
||||||
--cycleR xs = xs
|
--cycleR xs = xs
|
||||||
--
|
--
|
||||||
canHeldScrollAttach :: Item -> ScrollAttachParams -> Bool
|
--canHeldScrollAttach :: Item -> ScrollAttachParams -> Bool
|
||||||
canHeldScrollAttach _ _ = True
|
--canHeldScrollAttach _ _ = True
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ moveZoomCamera cfig theinput cr campos =
|
|||||||
mscopeoffset = do
|
mscopeoffset = do
|
||||||
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
||||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||||
--(cr ^? crInv . ix (i - 1) . itUse . attachParams . scrollAttachParams . opticPos)
|
|
||||||
(fmap (rotateV camrot) (cr ^? crInv . ix i . itScope . opticPos))
|
(fmap (rotateV camrot) (cr ^? crInv . ix i . itScope . opticPos))
|
||||||
<|> (cr ^? crInv . ix i . itScope . remotePos)
|
<|> (cr ^? crInv . ix i . itScope . remotePos)
|
||||||
camrot = campos ^. camRot
|
camrot = campos ^. camRot
|
||||||
@@ -145,7 +144,6 @@ updateScopeZoom' i w
|
|||||||
wppointer = cWorld . lWorld . creatures . ix 0 . crInv . ix i . itScope
|
wppointer = cWorld . lWorld . creatures . ix 0 . crInv . ix i . itScope
|
||||||
resetscope (OpticScope _ _ defz) = OpticScope (V2 0 0) defz defz
|
resetscope (OpticScope _ _ defz) = OpticScope (V2 0 0) defz defz
|
||||||
resetscope otherAtt = otherAtt
|
resetscope otherAtt = otherAtt
|
||||||
--mp = rotateV (w ^. wCam . camRot) $ _mousePos (_input w)
|
|
||||||
mp = _mousePos (_input w)
|
mp = _mousePos (_input w)
|
||||||
|
|
||||||
doScopeZoom :: Int -> Point2 -> Scope -> Scope
|
doScopeZoom :: Int -> Point2 -> Scope -> Scope
|
||||||
@@ -207,18 +205,7 @@ doWallRotate wl w = rotateUsing $ (argV . uncurry (-.-) $ _wlLine wl) - (w ^. wC
|
|||||||
b' = fromIntegral (round b :: Int)
|
b' = fromIntegral (round b :: Int)
|
||||||
|
|
||||||
rotateCameraBy :: Float -> World -> World
|
rotateCameraBy :: Float -> World -> World
|
||||||
rotateCameraBy x w =
|
rotateCameraBy x = wCam . camRot +~ x
|
||||||
w
|
|
||||||
& wCam . camRot +~ x
|
|
||||||
-- & cWorld %~ rotateanyscope
|
|
||||||
where
|
|
||||||
rotateanyscope = fromMaybe id $ do
|
|
||||||
i <- w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . inInventory . ispItem
|
|
||||||
return $
|
|
||||||
lWorld . creatures . ix 0 . crInv . ix i
|
|
||||||
. itScope
|
|
||||||
. opticPos
|
|
||||||
%~ rotateV x
|
|
||||||
|
|
||||||
rotateCamera :: Configuration -> World -> World
|
rotateCamera :: Configuration -> World -> World
|
||||||
rotateCamera cfig w
|
rotateCamera cfig w
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import qualified Data.Map.Strict as M
|
|||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.Data.Universe
|
import Dodge.Data.Universe
|
||||||
import Dodge.HeldScroll
|
--import Dodge.HeldScroll
|
||||||
import Dodge.InputFocus
|
import Dodge.InputFocus
|
||||||
import Dodge.Inventory
|
import Dodge.Inventory
|
||||||
import Dodge.SelectionSections
|
import Dodge.SelectionSections
|
||||||
@@ -26,10 +26,13 @@ updateWheelEvent yi w = case w ^. hud . hudElement of
|
|||||||
-- functions that modify the inventory should be centralised so that
|
-- functions that modify the inventory should be centralised so that
|
||||||
-- this lock can be sensibly applied, perhaps
|
-- this lock can be sensibly applied, perhaps
|
||||||
| w ^?! cWorld . lWorld . creatures . ix 0 . crInvLock -> w
|
| w ^?! cWorld . lWorld . creatures . ix 0 . crInvLock -> w
|
||||||
| rbDown -> case (yourScrollAttachment w, _rbOptions w) of
|
-- | rbDown -> case (yourScrollAttachment w, _rbOptions w) of
|
||||||
(_,EquipOptions{}) -> w & rbOptions . opSel %~ scrollRBOption yi rbscrollmax
|
-- (_,EquipOptions{}) -> w & rbOptions . opSel %~ scrollRBOption yi rbscrollmax
|
||||||
(Nothing, _) -> w
|
-- (Nothing, _) -> w
|
||||||
(Just (invid,hs), _) -> doHeldScroll invid hs y w
|
-- (Just (invid,hs), _) -> doHeldScroll invid hs y w
|
||||||
|
| rbDown -> case _rbOptions w of
|
||||||
|
EquipOptions{} -> w & rbOptions . opSel %~ scrollRBOption yi rbscrollmax
|
||||||
|
NoRightButtonOptions -> w
|
||||||
| lbDown -> w & wCam . camZoom +~ y
|
| lbDown -> w & wCam . camZoom +~ y
|
||||||
| invKeyDown -> changeSwapSel yi w
|
| invKeyDown -> changeSwapSel yi w
|
||||||
| otherwise -> scrollAugInvSel yi w
|
| otherwise -> scrollAugInvSel yi w
|
||||||
|
|||||||
Reference in New Issue
Block a user