Cleanup, hide item selection cursor when in terminal
This commit is contained in:
@@ -14,8 +14,8 @@ cardVec cp = case cp of
|
|||||||
East -> V2 1 0
|
East -> V2 1 0
|
||||||
West -> V2 (-1) 0
|
West -> V2 (-1) 0
|
||||||
|
|
||||||
cardEightVec :: CardinalEightPoint -> Point2
|
card8Vec :: Cardinal8 -> Point2
|
||||||
cardEightVec cp = case cp of
|
card8Vec cp = case cp of
|
||||||
North8 -> V2 0 1
|
North8 -> V2 0 1
|
||||||
NorthEast8 -> V2 1 1
|
NorthEast8 -> V2 1 1
|
||||||
East8 -> V2 1 0
|
East8 -> V2 1 0
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ data CardinalPointBetween
|
|||||||
| NorthWest
|
| NorthWest
|
||||||
deriving (Eq, Ord, Show, Bounded, Enum)
|
deriving (Eq, Ord, Show, Bounded, Enum)
|
||||||
|
|
||||||
data CardinalEightPoint
|
data Cardinal8
|
||||||
= North8
|
= North8
|
||||||
| NorthEast8
|
| NorthEast8
|
||||||
| East8
|
| East8
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import Dodge.Data.CardinalPoint
|
|||||||
import Dodge.Data.ScreenPos
|
import Dodge.Data.ScreenPos
|
||||||
import Picture.Data
|
import Picture.Data
|
||||||
|
|
||||||
data ListDisplayParams = ListDisplayParams
|
data LDParams = LDP -- List display parameters
|
||||||
{ _ldpPos :: ScreenPos
|
{ _ldpPos :: ScreenPos
|
||||||
, _ldpScale :: Float
|
, _ldpScale :: Float
|
||||||
, _ldpVerticalGap :: Float
|
, _ldpVerticalGap :: Float
|
||||||
@@ -54,7 +54,7 @@ data SIDisplayMod
|
|||||||
= NoSIDisplayMod
|
= NoSIDisplayMod
|
||||||
| HighlightSI
|
| HighlightSI
|
||||||
|
|
||||||
makeLenses ''ListDisplayParams
|
makeLenses ''LDParams
|
||||||
makeLenses ''SelectionItem
|
makeLenses ''SelectionItem
|
||||||
makeLenses ''SelSection
|
makeLenses ''SelSection
|
||||||
makeLenses ''SectionCursor
|
makeLenses ''SectionCursor
|
||||||
|
|||||||
@@ -16,9 +16,8 @@ import Dodge.Data.World
|
|||||||
import Linear
|
import Linear
|
||||||
import SDL (MouseButton (..))
|
import SDL (MouseButton (..))
|
||||||
|
|
||||||
defaultLDP :: ListDisplayParams
|
defaultLDP :: LDParams
|
||||||
defaultLDP =
|
defaultLDP = LDP
|
||||||
ListDisplayParams
|
|
||||||
{ _ldpVerticalGap = 0
|
{ _ldpVerticalGap = 0
|
||||||
, _ldpScale = 1
|
, _ldpScale = 1
|
||||||
, _ldpPos =
|
, _ldpPos =
|
||||||
@@ -29,7 +28,7 @@ defaultLDP =
|
|||||||
, _ldpBorder = Nothing
|
, _ldpBorder = Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
invDP :: ListDisplayParams
|
invDP :: LDParams
|
||||||
--invDP = defaultLDP & ldpPos . spPixelOff .~ V2 6 0
|
--invDP = defaultLDP & ldpPos . spPixelOff .~ V2 6 0
|
||||||
invDP = defaultLDP & ldpPos . spPixelOff .~ V2 16 (-20)
|
invDP = defaultLDP & ldpPos . spPixelOff .~ V2 16 (-20)
|
||||||
|
|
||||||
@@ -40,7 +39,7 @@ invCursorParams w = BoundaryCursor $ case w ^? hud . subInventory of
|
|||||||
_ | ButtonRight `M.member` _mouseButtons (_input w) -> [North, South, East, West]
|
_ | ButtonRight `M.member` _mouseButtons (_input w) -> [North, South, East, West]
|
||||||
_ -> [North, South, West]
|
_ -> [North, South, West]
|
||||||
|
|
||||||
secondColumnLDP :: ListDisplayParams
|
secondColumnLDP :: LDParams
|
||||||
secondColumnLDP = defaultLDP & ldpPos . spPixelOff .~ V2 subInvX (-20)
|
secondColumnLDP = defaultLDP & ldpPos . spPixelOff .~ V2 subInvX (-20)
|
||||||
|
|
||||||
subInvX :: Float
|
subInvX :: Float
|
||||||
@@ -49,5 +48,5 @@ subInvX = 10 * fromIntegral topInvW + 170
|
|||||||
topInvW :: Int
|
topInvW :: Int
|
||||||
topInvW = 15
|
topInvW = 15
|
||||||
|
|
||||||
menuLDP :: ListDisplayParams
|
menuLDP :: LDParams
|
||||||
menuLDP = defaultLDP & ldpPos . spPixelOff .~ V2 11 (-70) & ldpScale .~ 2
|
menuLDP = defaultLDP & ldpPos . spPixelOff .~ V2 11 (-70) & ldpScale .~ 2
|
||||||
|
|||||||
+39
-54
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
module Dodge.Render.HUD (drawHUD) where
|
module Dodge.Render.HUD (drawHUD) where
|
||||||
|
|
||||||
import Data.List (elemIndex)
|
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import qualified Data.IntSet as IS
|
import qualified Data.IntSet as IS
|
||||||
|
import Data.List (elemIndex)
|
||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import qualified Data.Vector as V
|
import qualified Data.Vector as V
|
||||||
@@ -57,9 +57,14 @@ drawHUD cfig w = case w ^. hud of
|
|||||||
drawInventory sections w cfig subinv
|
drawInventory sections w cfig subinv
|
||||||
<> drawSubInventory subinv cfig w
|
<> drawSubInventory subinv cfig w
|
||||||
|
|
||||||
drawInventory :: IM.IntMap (SelSection ()) -> World -> Config -> SubInventory -> Picture
|
drawInventory :: IMSS () -> World -> Config -> SubInventory -> Picture
|
||||||
drawInventory sss w cfig = \case
|
drawInventory sss w cfig = \case
|
||||||
-- DisplayTerminal {} -> mempty
|
DisplayTerminal {} ->
|
||||||
|
drawSelectionSections sss invDP cfig
|
||||||
|
-- <> drawSSCursor sss invDP curs cfig (f $ w ^? hud . diSelection . _Just)
|
||||||
|
-- <> drawRootCursor w sss (f $ w ^? hud . diSelection . _Just) invDP cfig
|
||||||
|
<> itemconnections
|
||||||
|
<> drawMouseOver cfig w
|
||||||
_ ->
|
_ ->
|
||||||
drawSelectionSections sss invDP cfig
|
drawSelectionSections sss invDP cfig
|
||||||
<> drawSSCursor sss invDP curs cfig (f $ w ^? hud . diSelection . _Just)
|
<> drawSSCursor sss invDP curs cfig (f $ w ^? hud . diSelection . _Just)
|
||||||
@@ -77,12 +82,7 @@ drawInventory sss w cfig = \case
|
|||||||
_ -> return . drawItemConnections sss cfig $ invAdj inv
|
_ -> return . drawItemConnections sss cfig $ invAdj inv
|
||||||
|
|
||||||
drawRootCursor ::
|
drawRootCursor ::
|
||||||
World ->
|
World -> IMSS () -> Maybe (Int, Int) -> LDParams -> Config -> Picture
|
||||||
IM.IntMap (SelSection ()) ->
|
|
||||||
Maybe (Int, Int) ->
|
|
||||||
ListDisplayParams ->
|
|
||||||
Config ->
|
|
||||||
Picture
|
|
||||||
drawRootCursor w sss msel ldp cfig = fromMaybe mempty $ do
|
drawRootCursor w sss msel ldp cfig = fromMaybe mempty $ do
|
||||||
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||||
guard $ crIsAiming cr
|
guard $ crIsAiming cr
|
||||||
@@ -169,7 +169,6 @@ drawDragSelecting cfig w = do
|
|||||||
|
|
||||||
drawSubInventory :: SubInventory -> Config -> World -> Picture
|
drawSubInventory :: SubInventory -> Config -> World -> Picture
|
||||||
drawSubInventory subinv cfig w = case subinv of
|
drawSubInventory subinv cfig w = case subinv of
|
||||||
-- LockedInventory -> mempty -- topInvCursor col cursPos cfig w
|
|
||||||
NoSubInventory{} -> drawRBOptions cfig w
|
NoSubInventory{} -> drawRBOptions cfig w
|
||||||
ExamineInventory -> drawExamineInventory cfig w
|
ExamineInventory -> drawExamineInventory cfig w
|
||||||
DisplayTerminal tid -> (drawTerminalDisplay w cfig tid)
|
DisplayTerminal tid -> (drawTerminalDisplay w cfig tid)
|
||||||
@@ -185,7 +184,7 @@ drawMapperInventory itid w = fold $ do
|
|||||||
where
|
where
|
||||||
f = worldPosToScreen (w ^. wCam)
|
f = worldPosToScreen (w ^. wCam)
|
||||||
|
|
||||||
drawCombineInventory :: Config -> IM.IntMap (SelSection CombItem) -> World -> Picture
|
drawCombineInventory :: Config -> IMSS CombItem -> World -> Picture
|
||||||
drawCombineInventory cfig sss w =
|
drawCombineInventory cfig sss w =
|
||||||
drawSelectionSections sss secondColumnLDP cfig
|
drawSelectionSections sss secondColumnLDP cfig
|
||||||
<> drawSSCursor sss secondColumnLDP curs cfig msel
|
<> drawSSCursor sss secondColumnLDP curs cfig msel
|
||||||
@@ -319,16 +318,13 @@ equipAllocString = \case
|
|||||||
RemoveEquipment{} -> "TAKE OFF"
|
RemoveEquipment{} -> "TAKE OFF"
|
||||||
|
|
||||||
drawItemConnections ::
|
drawItemConnections ::
|
||||||
IM.IntMap (SelSection ()) ->
|
IMSS () -> Config -> IM.IntMap (Maybe (Int, Int), [Int], [Int]) -> Picture
|
||||||
Config ->
|
|
||||||
IM.IntMap (Maybe (Int, Int), [Int], [Int]) ->
|
|
||||||
Picture
|
|
||||||
drawItemConnections sss cfig =
|
drawItemConnections sss cfig =
|
||||||
translate (negate 5) 0
|
translate (negate 5) 0
|
||||||
. IM.foldMapWithKey (drawItemChildrenConnect sss cfig)
|
. IM.foldMapWithKey (drawItemChildrenConnect sss cfig)
|
||||||
. fmap (\(_, a, b) -> a <> b)
|
. fmap (\(_, a, b) -> a <> b)
|
||||||
|
|
||||||
drawItemChildrenConnect :: IM.IntMap (SelSection ()) -> Config -> Int -> [Int] -> Picture
|
drawItemChildrenConnect :: IMSS () -> Config -> Int -> [Int] -> Picture
|
||||||
drawItemChildrenConnect sss cfig i is = fromMaybe mempty $ do
|
drawItemChildrenConnect sss cfig i is = fromMaybe mempty $ do
|
||||||
p <- snum i
|
p <- snum i
|
||||||
let ps = mapMaybe snum is
|
let ps = mapMaybe snum is
|
||||||
@@ -337,7 +333,7 @@ drawItemChildrenConnect sss cfig i is = fromMaybe mempty $ do
|
|||||||
snum = selNumPos cfig invDP sss 0
|
snum = selNumPos cfig invDP sss 0
|
||||||
|
|
||||||
combineInventoryExtra ::
|
combineInventoryExtra ::
|
||||||
IM.IntMap (SelSection CombItem) -> Maybe (Int, Int) -> Config -> World -> Picture
|
IMSS CombItem -> Maybe (Int, Int) -> Config -> World -> Picture
|
||||||
combineInventoryExtra sss msel cfig w = fold $ do
|
combineInventoryExtra sss msel cfig w = fold $ do
|
||||||
(i, j) <- msel
|
(i, j) <- msel
|
||||||
si <- sss ^? ix i . ssItems . ix j
|
si <- sss ^? ix i . ssItems . ix j
|
||||||
@@ -345,13 +341,13 @@ combineInventoryExtra sss msel cfig w = fold $ do
|
|||||||
lnks <- si ^? siPayload . _Just . ciInvIDs
|
lnks <- si ^? siPayload . _Just . ciInvIDs
|
||||||
return (lnkMidPosInvSelsCol cfig w j col lnks) <> Just (foldMap invcursor lnks)
|
return (lnkMidPosInvSelsCol cfig w j col lnks) <> Just (foldMap invcursor lnks)
|
||||||
where
|
where
|
||||||
invcursor i =
|
invcursor i =
|
||||||
translateScreenPos cfig (invDP ^. ldpPos) $
|
translateScreenPos cfig (invDP ^. ldpPos) $
|
||||||
selSecDrawCursor
|
selSecDrawCursor
|
||||||
invDP
|
invDP
|
||||||
(BoundaryCursor [North, South, East, West])
|
(BoundaryCursor [North, South, East, West])
|
||||||
(w ^. hud . diSections)
|
(w ^. hud . diSections)
|
||||||
(Just (0, i))
|
(Just (0, i))
|
||||||
|
|
||||||
drawTerminalDisplay :: World -> Config -> Int -> Picture
|
drawTerminalDisplay :: World -> Config -> Int -> Picture
|
||||||
drawTerminalDisplay w cfig tid = fold $ do
|
drawTerminalDisplay w cfig tid = fold $ do
|
||||||
@@ -370,8 +366,9 @@ drawTerminalDisplay w cfig tid = fold $ do
|
|||||||
TerminalLineRead -> (++ [(spincurs, termTextColor)])
|
TerminalLineRead -> (++ [(spincurs, termTextColor)])
|
||||||
TerminalTextInput s -> (++ [(getPromptTM ++ s ++ [cFilledRect], white)])
|
TerminalTextInput s -> (++ [(getPromptTM ++ s ++ [cFilledRect], white)])
|
||||||
TerminalPressTo s -> (++ [(s, white)])
|
TerminalPressTo s -> (++ [(s, white)])
|
||||||
return $ drawSelectionList (secondColumnLDP & ldpBorder ?~ (49, 16)) cfig f
|
return $
|
||||||
<> drawTerminalCursorLink w cfig tm
|
drawSelectionList (secondColumnLDP & ldpBorder ?~ (49, 16)) cfig f
|
||||||
|
<> drawTerminalCursorLink w cfig tm
|
||||||
where
|
where
|
||||||
-- <> tm ^. tmButtonID
|
-- <> tm ^. tmButtonID
|
||||||
|
|
||||||
@@ -389,15 +386,20 @@ drawTerminalDisplay w cfig tid = fold $ do
|
|||||||
drawTerminalCursorLink :: World -> Config -> Terminal -> Picture
|
drawTerminalCursorLink :: World -> Config -> Terminal -> Picture
|
||||||
drawTerminalCursorLink w cfig tm = fold $ do
|
drawTerminalCursorLink w cfig tm = fold $ do
|
||||||
j <- elemIndex (tm ^. tmButtonID) $ w ^. hud . closeButtons
|
j <- elemIndex (tm ^. tmButtonID) $ w ^. hud . closeButtons
|
||||||
lp <- selNumPos cfig invDP (w^. hud . diSections) 5 j
|
lp <- selNumPos cfig invDP (w ^. hud . diSections) 5 j
|
||||||
let rp = screenPosAbs cfig (secondColumnLDP ^. ldpPos) - V2 5 10
|
let rp = screenPosAbs cfig (secondColumnLDP ^. ldpPos) - V2 5 10
|
||||||
lcol <- selSecSelCol 5 j (w ^. hud . diSections)
|
lcol <- selSecSelCol 5 j (w ^. hud . diSections)
|
||||||
return $ translateScreenPos cfig (invDP ^. ldpPos)
|
return $
|
||||||
(selSecDrawCursor invDP
|
translateScreenPos
|
||||||
(BoundaryCursor [North,South,East,West])
|
cfig
|
||||||
(w ^. hud . diSections)
|
(invDP ^. ldpPos)
|
||||||
(Just (5,j)))
|
( selSecDrawCursor
|
||||||
<> lConnectCol (lp + V2 155 0) rp lcol white white
|
invDP
|
||||||
|
(BoundaryCursor [North, South, East, West])
|
||||||
|
(w ^. hud . diSections)
|
||||||
|
(Just (5, j))
|
||||||
|
)
|
||||||
|
<> lConnectCol (lp + V2 155 0) rp lcol white white
|
||||||
|
|
||||||
lnkMidPosInvSelsCol :: Config -> World -> Int -> Color -> [Int] -> Picture
|
lnkMidPosInvSelsCol :: Config -> World -> Int -> Color -> [Int] -> Picture
|
||||||
lnkMidPosInvSelsCol cfig w i col = fromMaybe mempty . foldMap f
|
lnkMidPosInvSelsCol cfig w i col = fromMaybe mempty . foldMap f
|
||||||
@@ -459,13 +461,7 @@ invHead cfig =
|
|||||||
-- textSelItems = map (picsToSelectable . (: []))
|
-- textSelItems = map (picsToSelectable . (: []))
|
||||||
|
|
||||||
-- would be nice to add parameter to orient this with NSEW, cf cursor
|
-- would be nice to add parameter to orient this with NSEW, cf cursor
|
||||||
selNumPos ::
|
selNumPos :: Config -> LDParams -> IMSS a -> Int -> Int -> Maybe Point2
|
||||||
Config ->
|
|
||||||
ListDisplayParams ->
|
|
||||||
IMSS a ->
|
|
||||||
Int ->
|
|
||||||
Int ->
|
|
||||||
Maybe Point2
|
|
||||||
selNumPos = selNumPosCardinal West8
|
selNumPos = selNumPosCardinal West8
|
||||||
|
|
||||||
-- selNumPos cfig ldp sss i j = do
|
-- selNumPos cfig ldp sss i j = do
|
||||||
@@ -483,26 +479,15 @@ selNumPos = selNumPosCardinal West8
|
|||||||
|
|
||||||
-- need to be able to determine a selection item's width for this
|
-- need to be able to determine a selection item's width for this
|
||||||
selNumPosCardinal ::
|
selNumPosCardinal ::
|
||||||
CardinalEightPoint ->
|
Cardinal8 -> Config -> LDParams -> IMSS a -> Int -> Int -> Maybe Point2
|
||||||
Config ->
|
|
||||||
ListDisplayParams ->
|
|
||||||
IM.IntMap (SelSection a) ->
|
|
||||||
Int ->
|
|
||||||
Int ->
|
|
||||||
Maybe Point2
|
|
||||||
selNumPosCardinal card cfig ldp sss i j = do
|
selNumPosCardinal card cfig ldp sss i j = do
|
||||||
ipos <- selSecYint i j sss
|
ipos <- selSecYint i j sss
|
||||||
-- size <- selSecSelSize i j sss
|
|
||||||
ysize <- fromIntegral <$> sss ^? ix i . ssItems . ix j . siHeight
|
ysize <- fromIntegral <$> sss ^? ix i . ssItems . ix j . siHeight
|
||||||
xsize <- fromIntegral <$> sss ^? ix i . ssItems . ix j . siWidth
|
xsize <- fromIntegral <$> sss ^? ix i . ssItems . ix j . siWidth
|
||||||
itmindent <- fromIntegral <$> sss ^? ix i . ssItems . ix j . siOffX
|
itmindent <- fromIntegral <$> sss ^? ix i . ssItems . ix j . siOffX
|
||||||
sindent <- fromIntegral <$> sss ^? ix i . ssIndent
|
sindent <- fromIntegral <$> sss ^? ix i . ssIndent
|
||||||
let indent = itmindent + sindent
|
let indent = itmindent + sindent
|
||||||
let offset =
|
let offset = s *^ (card8Vec card * V2 (xsize * 5) (ysize * 10))
|
||||||
cardEightVec card
|
|
||||||
* V2
|
|
||||||
(xsize * 0.5 * 10 * s)
|
|
||||||
(ysize * 0.5 * 20 * s)
|
|
||||||
return $
|
return $
|
||||||
screenPosAbs cfig (ldp ^. ldpPos)
|
screenPosAbs cfig (ldp ^. ldpPos)
|
||||||
+ offset
|
+ offset
|
||||||
@@ -513,5 +498,5 @@ selNumPosCardinal card cfig ldp sss i j = do
|
|||||||
s = _ldpScale ldp
|
s = _ldpScale ldp
|
||||||
ygap = _ldpVerticalGap ldp
|
ygap = _ldpVerticalGap ldp
|
||||||
|
|
||||||
selSecSelCol :: Int -> Int -> IM.IntMap (SelSection a) -> Maybe Color
|
selSecSelCol :: Int -> Int -> IMSS a -> Maybe Color
|
||||||
selSecSelCol i j = (^? ix i . ssItems . ix j . siColor)
|
selSecSelCol i j = (^? ix i . ssItems . ix j . siColor)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import LensHelp
|
|||||||
import ListHelp
|
import ListHelp
|
||||||
import Picture
|
import Picture
|
||||||
|
|
||||||
drawSelectionList :: ListDisplayParams -> Config -> [SelectionItem a] -> Picture
|
drawSelectionList :: LDParams -> Config -> [SelectionItem a] -> Picture
|
||||||
drawSelectionList ldps cfig sl =
|
drawSelectionList ldps cfig sl =
|
||||||
translateScreenPos cfig (ldps ^. ldpPos) $
|
translateScreenPos cfig (ldps ^. ldpPos) $
|
||||||
drawListYgapScaleYoff ygap sf 0 (makeSelectionListPictures sl)
|
drawListYgapScaleYoff ygap sf 0 (makeSelectionListPictures sl)
|
||||||
@@ -57,7 +57,7 @@ drawTitleBackground cfig =
|
|||||||
$ rectNSWE 70 0 0 560
|
$ rectNSWE 70 0 0 560
|
||||||
|
|
||||||
drawSelectionListBackground ::
|
drawSelectionListBackground ::
|
||||||
ListDisplayParams ->
|
LDParams ->
|
||||||
Config ->
|
Config ->
|
||||||
Int -> -- list length
|
Int -> -- list length
|
||||||
Picture
|
Picture
|
||||||
@@ -77,12 +77,7 @@ makeSelectionListPictures = concatMap f
|
|||||||
|
|
||||||
-- note this does not take into account any selectionsection indent
|
-- note this does not take into account any selectionsection indent
|
||||||
drawCursorAt ::
|
drawCursorAt ::
|
||||||
Maybe Int ->
|
Maybe Int -> [SelectionItem a] -> LDParams -> Int -> CursorDisplay -> Picture
|
||||||
[SelectionItem a] ->
|
|
||||||
ListDisplayParams ->
|
|
||||||
Int ->
|
|
||||||
CursorDisplay ->
|
|
||||||
Picture
|
|
||||||
drawCursorAt mi lis ldps width curs = fromMaybe mempty $ do
|
drawCursorAt mi lis ldps width curs = fromMaybe mempty $ do
|
||||||
i <- mi
|
i <- mi
|
||||||
selit <- lis !? i
|
selit <- lis !? i
|
||||||
@@ -110,11 +105,7 @@ stackPicturesAtOff :: Int -> [Picture] -> Picture
|
|||||||
stackPicturesAtOff i = mconcat . zipWith (drawListElement 10 1 0) [i, i - 1 ..]
|
stackPicturesAtOff i = mconcat . zipWith (drawListElement 10 1 0) [i, i - 1 ..]
|
||||||
|
|
||||||
selSecDrawCursorAt ::
|
selSecDrawCursorAt ::
|
||||||
ListDisplayParams ->
|
LDParams -> CursorDisplay -> IM.IntMap (SelSection a) -> (Int, Int) -> Picture
|
||||||
CursorDisplay ->
|
|
||||||
IM.IntMap (SelSection a) ->
|
|
||||||
(Int, Int) ->
|
|
||||||
Picture
|
|
||||||
selSecDrawCursorAt ldp curs sss (i, j) = fold $ do
|
selSecDrawCursorAt ldp curs sss (i, j) = fold $ do
|
||||||
yint <- selSecYint i j sss
|
yint <- selSecYint i j sss
|
||||||
sindent <- sss ^? ix i . ssIndent
|
sindent <- sss ^? ix i . ssIndent
|
||||||
@@ -131,11 +122,7 @@ selSecDrawCursorAt ldp curs sss (i, j) = fold $ do
|
|||||||
(_siHeight si)
|
(_siHeight si)
|
||||||
|
|
||||||
selSecDrawCursor ::
|
selSecDrawCursor ::
|
||||||
ListDisplayParams ->
|
LDParams -> CursorDisplay -> IM.IntMap (SelSection a) -> Maybe (Int, Int) -> Picture
|
||||||
CursorDisplay ->
|
|
||||||
IM.IntMap (SelSection a) ->
|
|
||||||
Maybe (Int, Int) ->
|
|
||||||
Picture
|
|
||||||
selSecDrawCursor ldp curs = maybe mempty . selSecDrawCursorAt ldp curs
|
selSecDrawCursor ldp curs = maybe mempty . selSecDrawCursorAt ldp curs
|
||||||
|
|
||||||
-- displays a cursor that should match up to list text pictures
|
-- displays a cursor that should match up to list text pictures
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import Dodge.Data.Universe
|
|||||||
import LensHelp
|
import LensHelp
|
||||||
import Linear
|
import Linear
|
||||||
|
|
||||||
getAvailableListLines :: ListDisplayParams -> Config -> Int
|
getAvailableListLines :: LDParams -> Config -> Int
|
||||||
getAvailableListLines ldps cfig = floor ((dToBot - vgap) / itmHeight)
|
getAvailableListLines ldps cfig = floor ((dToBot - vgap) / itmHeight)
|
||||||
where
|
where
|
||||||
vgap = ldps ^. ldpVerticalGap
|
vgap = ldps ^. ldpVerticalGap
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ selSecSelSize :: Int -> Int -> IMSS a -> Maybe Int
|
|||||||
selSecSelSize i j = (^? ix i . ssItems . ix j . siHeight)
|
selSecSelSize i j = (^? ix i . ssItems . ix j . siHeight)
|
||||||
|
|
||||||
-- need to check that the vertical gap is correctly put in here
|
-- need to check that the vertical gap is correctly put in here
|
||||||
posSelSecYint :: Config -> ListDisplayParams -> Float -> Int
|
posSelSecYint :: Config -> LDParams -> Float -> Int
|
||||||
posSelSecYint cfig ldp y = floor $ (y0 - y) / (20 / ldp ^. ldpScale + ldp ^. ldpVerticalGap)
|
posSelSecYint cfig ldp y = floor $ (y0 - y) / (20 / ldp ^. ldpScale + ldp ^. ldpVerticalGap)
|
||||||
where
|
where
|
||||||
V2 _ y0 = screenPosAbs cfig (ldp ^. ldpPos)
|
V2 _ y0 = screenPosAbs cfig (ldp ^. ldpPos)
|
||||||
@@ -175,12 +175,7 @@ inverseSelSecYint yint sss
|
|||||||
return $ NonInf (i, j)
|
return $ NonInf (i, j)
|
||||||
|
|
||||||
inverseSelSecYintXPosCheck ::
|
inverseSelSecYintXPosCheck ::
|
||||||
Config ->
|
Config -> LDParams -> Float -> Int -> IMSS a -> Maybe (Int,Int)
|
||||||
ListDisplayParams ->
|
|
||||||
Float ->
|
|
||||||
Int ->
|
|
||||||
IMSS a ->
|
|
||||||
Maybe (Int,Int)
|
|
||||||
inverseSelSecYintXPosCheck cfig ldp x yint sss = do
|
inverseSelSecYintXPosCheck cfig ldp x yint sss = do
|
||||||
(i,j) <- inverseSelSecYint yint sss ^? nonInf
|
(i,j) <- inverseSelSecYint yint sss ^? nonInf
|
||||||
let V2 x0 _ = screenPosAbs cfig (ldp ^. ldpPos)
|
let V2 x0 _ = screenPosAbs cfig (ldp ^. ldpPos)
|
||||||
@@ -190,6 +185,6 @@ inverseSelSecYintXPosCheck cfig ldp x yint sss = do
|
|||||||
guard $ x - x1 < 160 && x > x1
|
guard $ x - x1 < 160 && x > x1
|
||||||
return (i,j)
|
return (i,j)
|
||||||
|
|
||||||
inverseSelNumPos :: Config -> ListDisplayParams -> Point2 -> IMSS a -> Maybe (Int, Int)
|
inverseSelNumPos :: Config -> LDParams -> Point2 -> IMSS a -> Maybe (Int, Int)
|
||||||
inverseSelNumPos cfig ldp (V2 x y) =
|
inverseSelNumPos cfig ldp (V2 x y) =
|
||||||
inverseSelSecYintXPosCheck cfig ldp x (posSelSecYint cfig ldp y)
|
inverseSelSecYintXPosCheck cfig ldp x (posSelSecYint cfig ldp y)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import Dodge.ScreenPos
|
|||||||
import Dodge.SelectionSections
|
import Dodge.SelectionSections
|
||||||
import Picture.Base
|
import Picture.Base
|
||||||
|
|
||||||
drawSelectionSections :: IM.IntMap (SelSection a) -> ListDisplayParams -> Config -> Picture
|
drawSelectionSections :: IM.IntMap (SelSection a) -> LDParams -> Config -> Picture
|
||||||
drawSelectionSections sss ldp cfig =
|
drawSelectionSections sss ldp cfig =
|
||||||
translateScreenPos cfig (ldp ^. ldpPos) $
|
translateScreenPos cfig (ldp ^. ldpPos) $
|
||||||
drawListYgapScaleYoff
|
drawListYgapScaleYoff
|
||||||
@@ -29,12 +29,7 @@ drawSelectionSections sss ldp cfig =
|
|||||||
)
|
)
|
||||||
|
|
||||||
drawSSCursor ::
|
drawSSCursor ::
|
||||||
IM.IntMap (SelSection a) ->
|
IM.IntMap (SelSection a) -> LDParams -> CursorDisplay -> Config -> Maybe (Int, Int) -> Picture
|
||||||
ListDisplayParams ->
|
|
||||||
CursorDisplay ->
|
|
||||||
Config ->
|
|
||||||
Maybe (Int, Int) ->
|
|
||||||
Picture
|
|
||||||
drawSSCursor sss ldp curs cfig =
|
drawSSCursor sss ldp curs cfig =
|
||||||
translateScreenPos cfig (ldp ^. ldpPos) .
|
translateScreenPos cfig (ldp ^. ldpPos) .
|
||||||
selSecDrawCursor ldp curs sss
|
selSecDrawCursor ldp curs sss
|
||||||
@@ -43,7 +38,7 @@ drawSSMultiCursor ::
|
|||||||
IM.IntMap (SelSection a) ->
|
IM.IntMap (SelSection a) ->
|
||||||
Maybe (Int, Int) ->
|
Maybe (Int, Int) ->
|
||||||
Maybe Int ->
|
Maybe Int ->
|
||||||
ListDisplayParams ->
|
LDParams ->
|
||||||
CursorDisplay ->
|
CursorDisplay ->
|
||||||
Config ->
|
Config ->
|
||||||
Picture
|
Picture
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ mouseClickOptionsList u = fromMaybe u $ do
|
|||||||
return $ f u & uvSoundQueue .:~ click1S
|
return $ f u & uvSoundQueue .:~ click1S
|
||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
|
|
||||||
ldpSelection :: Config -> ListDisplayParams -> Point2 -> Maybe Int
|
ldpSelection :: Config -> LDParams -> Point2 -> Maybe Int
|
||||||
ldpSelection cfig ldp (V2 _ y)
|
ldpSelection cfig ldp (V2 _ y)
|
||||||
| yupper == ylower = Just yupper
|
| yupper == ylower = Just yupper
|
||||||
| otherwise = Nothing
|
| otherwise = Nothing
|
||||||
|
|||||||
Reference in New Issue
Block a user