Linting, haddocking
This commit is contained in:
+10
-10
@@ -23,7 +23,7 @@ hudDrawings w = setLayer 1 . setDepth (-0.5) . pictures $
|
||||
selectionText = if _carteDisplay w
|
||||
then drawLocations w
|
||||
else drawInventory w
|
||||
scaler = scale (2 / _windowX w) (2 / _windowY w)
|
||||
scaler = scale (2 / getWindowX w) (2 / getWindowY w)
|
||||
|
||||
drawInventory :: World -> [Picture]
|
||||
drawInventory w =
|
||||
@@ -42,7 +42,7 @@ displayListTopLeft scols w =
|
||||
( map (\x -> halfHeight w - (20 * (fromIntegral x+1))) [0..] )
|
||||
( map (\(s,col) -> scale 0.1 0.1 . dShadCol col $ text s) scols )
|
||||
where
|
||||
scaler = scale (2 / _windowX w) (2 / _windowY w)
|
||||
scaler = scale (2 / getWindowX w) (2 / getWindowY w)
|
||||
|
||||
displayInv :: Int -> World -> [Picture]
|
||||
displayInv n w = displayListTopLeft scols w
|
||||
@@ -78,14 +78,14 @@ displayListCoords :: World -> [Point2]
|
||||
displayListCoords w = map (g . f) [1..]
|
||||
where
|
||||
f i = ( 15 - halfWidth w , halfHeight w - (20 * fromIntegral i) )
|
||||
g (x,y) = (2*x / _windowX w, 2*y / _windowY w)
|
||||
g (x,y) = (2*x / getWindowX w, 2*y / getWindowY w)
|
||||
|
||||
displayListEndCoords :: World -> [String] -> [Point2]
|
||||
displayListEndCoords w ss = map g $ zipWith h ss $ map f [1..]
|
||||
where
|
||||
f :: Int -> Point2
|
||||
f i = ( 15 - halfWidth w , 2.5 + halfHeight w - (20 * fromIntegral i) )
|
||||
g (x,y) = (2*x / _windowX w, 2*y / _windowY w)
|
||||
g (x,y) = (2*x / getWindowX w, 2*y / getWindowY w)
|
||||
h :: String -> Point2 -> Point2
|
||||
h s (x,y) = (x + 9 * fromIntegral (length s), y)
|
||||
|
||||
@@ -107,16 +107,16 @@ mapWall w wl =
|
||||
(x:y:_) = _wlLine wl
|
||||
c = _wlColor wl
|
||||
|
||||
{- Pictures of popup text for items close to your position.-}
|
||||
{- | Pictures of popup text for items close to your position.-}
|
||||
closeObjectTexts :: World -> Picture
|
||||
closeObjectTexts w = pictures $ zipWith renderList [0..] (map colAndText $ _closeActiveObjects w)
|
||||
++ maybeToList maybeLine
|
||||
where
|
||||
colAndText (Left x) = (_itInvColor $ _flIt x, _itName $ _flIt x)
|
||||
colAndText (Right x) = (white, _btText x)
|
||||
renderList i (c,t) = scale (2/_windowX w) (2/_windowY w)
|
||||
renderList i (c,t) = scale (2/getWindowX w) (2/getWindowY w)
|
||||
. tran
|
||||
. translate (xtran i) (0 - 20 * fromIntegral i)
|
||||
. translate (xtran i) (negate (20 * fromIntegral i))
|
||||
. scale 0.1 0.1
|
||||
. color c
|
||||
$ text t
|
||||
@@ -135,7 +135,7 @@ closeObjectTexts w = pictures $ zipWith renderList [0..] (map colAndText $ _clos
|
||||
objPos obj = case obj of Left flit -> _flItPos flit
|
||||
Right bt -> _btPos bt
|
||||
mayScreenPos = mayObj >>= (\theObj -> Just (worldPosToScreen w $ objPos theObj))
|
||||
sc (x, y) = (x*2/_windowX w, y*2/_windowY w)
|
||||
sc (x, y) = (x*2/getWindowX w, y*2/getWindowY w)
|
||||
maybeLine = do
|
||||
itScreenPos <- mayScreenPos
|
||||
theText <- fmap (snd . colAndText) mayObj
|
||||
@@ -153,7 +153,7 @@ closeObjectTexts w = pictures $ zipWith renderList [0..] (map colAndText $ _clos
|
||||
,(sc p , col)
|
||||
]
|
||||
|
||||
{- Add coloured drop shadow. -}
|
||||
{- | Add coloured drop shadow. -}
|
||||
dShadCol :: Color -> Picture -> Picture
|
||||
dShadCol c p = pictures
|
||||
[ color black $ uncurry translate (1.2,-1.2) p
|
||||
@@ -161,7 +161,7 @@ dShadCol c p = pictures
|
||||
]
|
||||
|
||||
drawListCursor :: Color -> Int -> World -> Picture
|
||||
drawListCursor c iPos w = scale (2 / _windowX w) (2 / _windowY w)
|
||||
drawListCursor c iPos w = scale (2 / getWindowX w) (2 / getWindowY w)
|
||||
. translate (105-halfWidth w) (halfHeight w - (20* fromIntegral iPos) - 20)
|
||||
$ lineCol [(( 100,12.5) ,withAlpha 0 c)
|
||||
,((-100,12.5) ,c)
|
||||
|
||||
Reference in New Issue
Block a user