module Dodge.Render.Shape
  where
import Dodge.Data
import Shape
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 (pointIsClose . _crPos) (_creatures w)))
    <> mconcat (map (_spShape . floorItemSPic) $ IM.elems $ IM.filter (pointIsClose . _flItPos) $ _floorItems w)
  where
    pointIsClose p = dist camCen p < winSize
    winSize = 30 + max (getWindowX w) (getWindowY w)
    camCen = _cameraCenter w

crShape :: World -> Creature -> Shape
crShape w c = _spShape $ _crPict c c w
