Make buttons have shape, expose multiple bugs

This commit is contained in:
2021-09-27 12:28:53 +01:00
parent d9ad55ec50
commit 743c1c878d
19 changed files with 157 additions and 71 deletions
+1 -1
View File
@@ -93,7 +93,7 @@ crDraw w c = _spPicture $ _crPict c c w
ppDraw :: PressPlate -> Picture
ppDraw c = uncurryV translate (_ppPos c) $ rotate (_ppRot c) (_ppPict c)
btDraw :: Button -> Picture
btDraw c = uncurryV translate (_btPos c) $ rotate (_btRot c) (_btPict c)
btDraw c = uncurryV translate (_btPos c) $ rotate (_btRot c) (_spPicture $ _btPict c c)
clDraw :: Cloud -> Picture
clDraw c = translate3 (_clPos c) (_clPict c c)
+4
View File
@@ -15,10 +15,14 @@ worldShape w = _foregroundShape w
<> foldMap (crShape w) (IM.filter (pointIsClose . _crPos) (_creatures w))
<> foldMap (_spShape . floorItemSPic) (IM.filter (pointIsClose . _flItPos) $ _floorItems w)
<> foldMap (_spShape . dbArg _prDraw) (IM.filter (pointIsClose . _pjPos) $ _props w)
<> foldMap btShape (IM.filter (pointIsClose . _btPos) $ _buttons w)
where
pointIsClose p = dist camCen p < winSize
winSize = 30 + max (getWindowX w) (getWindowY w)
camCen = _cameraCenter w
btShape :: Button -> Shape
btShape bt = uncurryV translateSHf (_btPos bt) $ rotateSH (_btRot bt) (_spShape $ _btPict bt bt)
crShape :: World -> Creature -> Shape
crShape w c = _spShape $ _crPict c c w