module FPPrac.Graphics.MakePrimitives where
import EventLoop.Output
import EventLoop.CommonTypes
import FPPrac.Graphics.NormalizeNumber
type NormalizedNum = Float
type TextSize = NormalizedNum
type Radius = NormalizedNum
type Angle = NormalizedNum
createDrawCommand :: GObject -> String -> Graphical
createDrawCommand g groupname = Draw g groupname
createMoveGroupCommand :: String -> Pos -> Relative -> Graphical
createMoveGroupCommand groupname pos rel = MoveGroup groupname pos rel
createMoveElementCommand :: String -> Pos -> Relative -> Graphical
createMoveElementCommand name pos rel = MoveElement name pos rel
createRemoveGroupCommand :: String -> Graphical
createRemoveGroupCommand groupname = RemoveGroup groupname
createRemoveElementCommand :: String -> Graphical
createRemoveElementCommand name = RemoveElement name
createGraphicalObject :: String -> Primitive -> [GObject] -> GObject
createGraphicalObject name prim children = GObject name prim children
createGraphicalContainer :: [GObject] -> GObject
createGraphicalContainer contents = Container contents
createTextPrimitive :: Color -> Pos -> TextSize -> Font -> String -> Bool -> Primitive
createTextPrimitive col pos size font str fromCenter = Text (0,0,0) 1 col pos size font str fromCenter
createLinePrimitive :: Color -> [Pos] -> Primitive
createLinePrimitive col positions = Line col 1 positions
createRectPrimitive :: Color -> Pos -> Dimension -> Primitive
createRectPrimitive col pos dim = Rect (0,0,0) 0 col pos dim
createArcPrimitive :: Color -> Pos -> Radius -> Angle -> Angle -> Primitive
createArcPrimitive col pos rad startAngle endAngle = Arc (0,0,0) 0 col pos rad startAngle endAngle
createPosition :: (NormalizeNumber x, NormalizeNumber y) => x -> y -> (NormalizedNum ,NormalizedNum)
createPosition x y = (normalize x, normalize y)
createDimension :: (NormalizeNumber w, NormalizeNumber h) => w -> h -> (NormalizedNum, NormalizedNum)
createDimension w h = (normalize w, normalize h)
createColor :: (NormalizeNumber r, NormalizeNumber g, NormalizeNumber b) => r -> g -> b -> (NormalizedNum, NormalizedNum, NormalizedNum)
createColor r g b = (normalize r, normalize g, normalize b)
createNormalizedNum :: (NormalizeNumber i) => i -> NormalizedNum
createNormalizedNum i = normalize i