--{-# LANGUAGE TupleSections #-}
module Dodge.Render.Picture
    ( fixedCoordPictures
    ) where
import Dodge.Data
import Dodge.Base.Window
import Dodge.Picture.Layer
import Dodge.Render.HUD
import Dodge.Render.MenuScreen
import Geometry
import Picture

fixedCoordPictures :: World -> Picture
fixedCoordPictures w = case _menuLayers w of 
    [] -> pictures
        [ hudDrawings w
        , customMouseCursor w
        ]
    (lay:_) -> scaler . onLayer MenuDepth $ menuScreen w lay
  where 
    scaler = setDepth (-1) . scale (2 / getWindowX w) (2 / getWindowY w)

customMouseCursor :: World -> Picture
customMouseCursor w = 
    scale (2 /getWindowX w) (2/ getWindowY w) 
    . uncurryV translate (_mousePos w)
    . color white
    $ pictures [ line [V2 (-5) 0,V2 5 0] , line [V2 0 (-5),V2 0 5] ]

