diff --git a/src/Dodge/Render/Picture.hs b/src/Dodge/Render/Picture.hs index 35c6522f4..fdacaca18 100644 --- a/src/Dodge/Render/Picture.hs +++ b/src/Dodge/Render/Picture.hs @@ -10,6 +10,7 @@ import Dodge.Picture.SizeInvariant import Dodge.Picture.Layer import Dodge.Render.HUD import Dodge.Render.MenuScreen +import Dodge.Render.ShapePicture import Dodge.SoundLogic.LoadSound import Dodge.Config.Data import Sound.Data @@ -30,7 +31,7 @@ worldPictures w = pictures ,concatMapPic (crDraw w) . IM.filter crIsClose $ _creatures w ,concatMapPic (dbArg _ptDraw) $ _particles w ,testPic w - ,concatMapPic drawItem $ _floorItems w + ,concatMapPic (_spPicture . floorItemSPic) $ _floorItems w ,concatMapPic (crDraw w) $ _creatures w ,concatMapPic clDraw $ _clouds w ,concatMapPic ppDraw $ _pressPlates w @@ -42,7 +43,7 @@ worldPictures w = pictures crIsClose cr = dist (_crPos cr) camCen < winSize winSize = 30 + max (getWindowX w) (getWindowY w) camCen = _cameraCenter w - + fixedCoordPictures :: World -> Picture fixedCoordPictures w = case _menuLayers w of [] -> pictures @@ -194,10 +195,6 @@ extendConeToScreenEdge w c (x,y) = orderPolygon $ wallScreenIntersect ++ [x,y] + rectangleSolid :: Float -> Float -> Picture rectangleSolid x y = polygon $ map toV2 [(x,y),(x,-y),(-x,-y),(-x,y)] -drawItem :: FloorItem -> Picture -drawItem flit = uncurryV translate (_flItPos flit) - $ rotate (_flItRot flit) (_spPicture $ _itFloorPict (_flIt flit)) - ffToDraw :: World -> [ForceField] ffToDraw _ = [] diff --git a/src/Dodge/Render/Shape.hs b/src/Dodge/Render/Shape.hs index 7dd0d5930..8f7eaaf76 100644 --- a/src/Dodge/Render/Shape.hs +++ b/src/Dodge/Render/Shape.hs @@ -6,15 +6,24 @@ import Geometry --import Color import ShapePicture import Dodge.Base.Window +import Dodge.Render.ShapePicture import qualified Data.IntMap as IM worldShape :: World -> Shape worldShape w = _foregroundShape w <> mconcat (map (crShape w) (IM.elems $ IM.filter crIsClose (_creatures w))) + <> mconcat (map (_spShape . floorItemSPic) $ IM.elems $ _floorItems w) where crIsClose cr = dist (_crPos cr) camCen < winSize winSize = 30 + max (getWindowX w) (getWindowY w) camCen = _cameraCenter w +pointIsClose :: World -> Point2 -> Bool +pointIsClose w p = dist p camCen < winSize + where + winSize = 30 + max (getWindowX w) (getWindowY w) + camCen = _cameraCenter w + + crShape :: World -> Creature -> Shape crShape w c = _spShape $ _crPict c c w diff --git a/src/Dodge/Render/ShapePicture.hs b/src/Dodge/Render/ShapePicture.hs new file mode 100644 index 000000000..e7f33204b --- /dev/null +++ b/src/Dodge/Render/ShapePicture.hs @@ -0,0 +1,10 @@ +module Dodge.Render.ShapePicture + where +import Dodge.Data +import Geometry +import ShapePicture + +floorItemSPic :: FloorItem -> SPic +floorItemSPic flit = uncurryV translateSPf (_flItPos flit) + $ rotateSP (_flItRot flit) (_itFloorPict (_flIt flit)) +