module GridBox.Row
(
Row
, getBoxPositionX
, getBoxPositionY
, createBox
, makeRow
, topX
, topY) where
import GridBox.Box (Box, makeBox)
import Data.List (map)
type Row = [Box]
getBoxPositionX :: Int -> Double -> Double -> Double
getBoxPositionX col size xOffset =
topX (fromIntegral(col) * size + size/2) xOffset
getBoxPositionY :: Int -> Double -> Double -> Double
getBoxPositionY row size yOffset =
topY (fromIntegral(row) * size + size/2) yOffset
createBox :: (Double, Double) -> Double -> Double -> Int -> Int -> Box
createBox (sizeX, sizeY) xOffset yOffset row col =
makeBox (getBoxPositionX col sizeX xOffset) (getBoxPositionY row sizeY yOffset) row col (sizeX, sizeY)
makeRow :: (Double, Double) -> Double -> Double -> [Int] -> Int -> Row
makeRow size xOffset yOffset cols row =
map (createBox size xOffset yOffset row) cols
topX :: Double -> Double -> Double
topX pos xOffset =
pos + xOffset
topY :: Double -> Double -> Double
topY pos yOffset =
pos + yOffset