Clicking on button in inventory list activates button
This commit is contained in:
+11
-12
@@ -34,26 +34,25 @@ import Picture
|
|||||||
|
|
||||||
drawSelectionList :: LDParams -> Config -> [SelectionItem a] -> Picture
|
drawSelectionList :: LDParams -> Config -> [SelectionItem a] -> Picture
|
||||||
drawSelectionList ldps cfig sl =
|
drawSelectionList ldps cfig sl =
|
||||||
translateScreenPos cfig (ldps ^. ldpPos) $
|
translateScreenPos
|
||||||
drawListYgapScaleYoff ygap sf 0 (makeSelectionListPictures sl)
|
cfig
|
||||||
<> foldMap (g . f) (ldps ^. ldpBorder)
|
(ldps ^. ldpPos)
|
||||||
|
(drawListYgapScaleYoff ygap sf 0 (makeSelectionListPictures sl))
|
||||||
|
<> foldMap (g . f) (ldpRect cfig ldps)
|
||||||
where
|
where
|
||||||
g xs = color white (polygonWire xs) <> setDepth 0.5 (polygon xs)
|
g xs = color white (polygonWire xs) <> setDepth 0.5 (polygon xs)
|
||||||
ygap = ldps ^. ldpVerticalGap
|
ygap = ldps ^. ldpVerticalGap
|
||||||
sf = ldps ^. ldpScale
|
sf = ldps ^. ldpScale
|
||||||
f (x, y) =
|
f (V2 xmin ymax, V2 xmax ymin) = rectNSWE ymax ymin xmin xmax
|
||||||
rectNSWE
|
|
||||||
5
|
|
||||||
(negate $ (20 * sf + ygap) * fromIntegral y + 5)
|
|
||||||
(-5)
|
|
||||||
(10 * sf * fromIntegral x)
|
|
||||||
|
|
||||||
ldpRect :: Config -> LDParams -> Maybe (Point2, Point2) -- (NW, SE)
|
ldpRect :: Config -> LDParams -> Maybe (Point2, Point2) -- (NW, SE)
|
||||||
ldpRect cfig ldp = do
|
ldpRect cfig ldp = do
|
||||||
(x,y) <- ldp ^? ldpBorder . _Just
|
(x, y) <- ldp ^? ldpBorder . _Just
|
||||||
return $ ( V2 (-5) 5
|
return $
|
||||||
|
( V2 (-5) 5
|
||||||
, V2 (10 * sf * fromIntegral x) (negate $ (20 * sf + ygap) * fromIntegral y + 5)
|
, V2 (10 * sf * fromIntegral x) (negate $ (20 * sf + ygap) * fromIntegral y + 5)
|
||||||
) & each +~ screenPosAbs cfig (ldp ^. ldpPos)
|
)
|
||||||
|
& each +~ screenPosAbs cfig (ldp ^. ldpPos)
|
||||||
where
|
where
|
||||||
sf = ldp ^. ldpScale
|
sf = ldp ^. ldpScale
|
||||||
ygap = ldp ^. ldpVerticalGap
|
ygap = ldp ^. ldpVerticalGap
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import Dodge.Projectile.Update
|
|||||||
import Dodge.Prop.Moving
|
import Dodge.Prop.Moving
|
||||||
import Dodge.RadarBlip
|
import Dodge.RadarBlip
|
||||||
import Dodge.RadarSweep
|
import Dodge.RadarSweep
|
||||||
import Dodge.ScreenPos
|
|
||||||
import Dodge.ScrollValue
|
import Dodge.ScrollValue
|
||||||
import Dodge.SelectionSections
|
import Dodge.SelectionSections
|
||||||
import Dodge.Shockwave.Update
|
import Dodge.Shockwave.Update
|
||||||
@@ -403,13 +402,6 @@ isOverTerminalScreen :: Config -> Point2 -> Bool
|
|||||||
isOverTerminalScreen cfig (V2 x y) = fromMaybe False $ do
|
isOverTerminalScreen cfig (V2 x y) = fromMaybe False $ do
|
||||||
(V2 xmin ymax, V2 xmax ymin) <- ldpRect cfig terminalLDP
|
(V2 xmin ymax, V2 xmax ymin) <- ldpRect cfig terminalLDP
|
||||||
return $ x <= xmax && x >= xmin && y <= ymax && y >= ymin
|
return $ x <= xmax && x >= xmin && y <= ymax && y >= ymin
|
||||||
where
|
|
||||||
-- ldp = terminalLDP
|
|
||||||
-- V2 xmin ymax = screenPosAbs cfig (ldp ^. ldpPos)
|
|
||||||
-- tsize = fromIntegral $ getMaxLinesTM + 1
|
|
||||||
-- s = 5 + tsize * (20 * ldp ^. ldpScale + ldp ^. ldpVerticalGap)
|
|
||||||
-- ymin = ymax - s
|
|
||||||
-- xmax = xmin + 555 -- HACK drawSelectionListBackground
|
|
||||||
|
|
||||||
updateWheelEvents :: World -> World
|
updateWheelEvents :: World -> World
|
||||||
updateWheelEvents w = case w ^. input . scrollAmount of
|
updateWheelEvents w = case w ^. input . scrollAmount of
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ module Dodge.Update.Input.InGame (
|
|||||||
updateMouseInGame,
|
updateMouseInGame,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Dodge.Button.Event
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
@@ -219,6 +220,10 @@ updateMouseClickInGame cfig w = case w ^. input . mouseContext of
|
|||||||
| selsec == Just 2 ->
|
| selsec == Just 2 ->
|
||||||
w & hud . diSelection %~ endRegex 2 w
|
w & hud . diSelection %~ endRegex 2 w
|
||||||
& hud . diCloseFilter .~ Nothing
|
& hud . diCloseFilter .~ Nothing
|
||||||
|
OverInvSelect (5, j) -> fromMaybe w $ do
|
||||||
|
k <- w ^? hud . closeButtons . ix j
|
||||||
|
but <- w ^? cWorld . lWorld . buttons . ix k
|
||||||
|
return $ doButtonEvent (but ^. btEvent) but w
|
||||||
OverInvSelect x
|
OverInvSelect x
|
||||||
| ScancodeLShift `M.member` (w ^. input . pressedKeys)
|
| ScancodeLShift `M.member` (w ^. input . pressedKeys)
|
||||||
&& isGroupSelectableSection (fst x) ->
|
&& isGroupSelectableSection (fst x) ->
|
||||||
|
|||||||
Reference in New Issue
Block a user