module Graphics.Gloss.Shapes
( lineLoop
, rectangleWire, rectangleSolid, rectanglePath
, rectangleUpperWire, rectangleUpperSolid, rectangleUpperPath )
where
import Graphics.Gloss.Picture
lineLoop :: Path -> Picture
lineLoop [] = Line []
lineLoop (x:xs) = Line ((x:xs) ++ [x])
rectangleWire
:: Float
-> Float
-> Picture
rectangleWire sizeX sizeY
= lineLoop $ rectanglePath sizeX sizeY
rectangleSolid
:: Float
-> Float
-> Picture
rectangleSolid sizeX sizeY
= Polygon $ rectanglePath sizeX sizeY
rectanglePath
:: Float
-> Float
-> Path
rectanglePath sizeX sizeY
= let sx = sizeX / 2
sy = sizeY / 2
in [(sx, sy), (sx, sy), (sx, sy), (sx, sy)]
rectangleUpperWire
:: Float
-> Float
-> Picture
rectangleUpperWire sizeX sizeY
= lineLoop $ rectangleUpperPath sizeX sizeY
rectangleUpperSolid
:: Float
-> Float
-> Picture
rectangleUpperSolid sizeX sizeY
= Polygon $ rectangleUpperPath sizeX sizeY
rectangleUpperPath
:: Float
-> Float
-> Path
rectangleUpperPath sizeX sy
= let sx = sizeX / 2
in [(sx, 0), (sx, sy), (sx, sy), (sx, 0)]