-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | HTML Canvas graphics, animations and simulations. -- -- Gleam is a graphics library written in Haskell that uses the -- web-browser as a display. Gleam is inspired by the Picture datatype -- from gloss Gloss and uses Threepenny-gui as its back-end local -- webserver. @package Gleam @version 0.1.0.2 module Text -- | A font. data Font Arial :: Font Verdana :: Font TimesNewRoman :: Font CourierNew :: Font Serif :: Font SansSerif :: Font -- | A html font family Font :: String -> Font -- | A font size, given in points. data FontSize Size :: Int -> FontSize -- | Combines a Font and FontSize to return a html string -- representing them. getCombinedFont :: Font -> FontSize -> String instance GHC.Classes.Eq Text.FontSize instance GHC.Show.Show Text.FontSize instance GHC.Classes.Eq Text.Font instance GHC.Show.Show Text.Font module Color data Color White :: Color Black :: Color Transparent :: Color Red :: Color Green :: Color Blue :: Color Yellow :: Color Cyan :: Color Magenta :: Color Rose :: Color Violet :: Color Azure :: Color Aquamarine :: Color Chartreuse :: Color Orange :: Color -- | A hex color string. RGBA :: String -> Color -- | Converts a color to a html color string. convertColor :: Color -> String instance GHC.Classes.Eq Color.Color instance GHC.Show.Show Color.Color module Picture -- | A 2D picture. data Picture -- | A blank picture, with nothing in it. Blank :: Picture -- | A line along an arbitrary path. Line :: Path -> Picture -- | A polygon filled with a solid color. Polygon :: Path -> Picture -- | A circle with the given radius. Circle :: Double -> Picture -- | A circular arc drawn counter-clockwise between two angles (in degrees) -- at the given radius. Arc :: Double -> Double -> Double -> Picture -- | A rectangle drawn with given width and height. Rectangle :: Double -> Double -> Picture -- | Image to draw from a certain with given width and height. Image :: Source -> Double -> Double -> Picture -- | Some text to draw with a vector font. Text :: String -> Font -> FontSize -> Picture -- | A picture drawn with this color. Color :: Color -> Picture -> Picture -- | A picture drawn with this stroke, given a color and size. Stroke :: Color -> Double -> Picture -> Picture -- | A picture translated by the given x and y coordinates. Translate :: Double -> Double -> Picture -> Picture -- | A picture scaled by the given x and y factors. Scale :: Double -> Double -> Picture -> Picture -- | A picture consisting of several others. Pictures :: [Picture] -> Picture -- | A point on the x-y plane. type Point = (Double, Double) -- | A vector can be treated as a point, and vis-versa. type Vector = Point -- | A path through the x-y plane. type Path = [Point] -- | An image location data Source -- | Path to an image inside ./images. File :: String -> Source -- | An image url. Url :: String -> Source -- | A closed loop along a path. lineLoop :: Path -> Picture -- | A wireframe sector of a circle. An arc is draw counter-clockwise from -- the first to the second angle at the given radius. sectorWire :: Double -> Double -> Double -> Picture -- | A path representing a rectangle centered about the origin rectanglePath :: Double -> Double -> Path -- | A wireframe rectangle centered about the origin. rectangleWire :: Double -> Double -> Picture -- | A solid rectangle centered about the origin. rectangleSolid :: Double -> Double -> Picture instance GHC.Classes.Eq Picture.Picture instance GHC.Show.Show Picture.Picture instance GHC.Classes.Eq Picture.Source instance GHC.Show.Show Picture.Source instance GHC.Base.Monoid Picture.Picture instance Data.Semigroup.Semigroup Picture.Picture module InputEvent -- | An input event. data InputEvent -- | A key or mouse button event EventKey :: Key -> KeyState -> InputEvent -- | A mouse motion event EventMotion :: Point -> Point -> InputEvent -- | A key. data Key -- | A key that can be represented by a character Char :: Char -> Key -- | A special key. SpecialKey :: SpecialKey -> Key -- | A mouse button. Mouse :: Point -> Key -- | State of the key event. data KeyState Down :: KeyState Up :: KeyState -- | Special keys data SpecialKey KeyUnknown :: SpecialKey KeySpace :: SpecialKey KeyEsc :: SpecialKey KeyUp :: SpecialKey KeyDown :: SpecialKey KeyLeft :: SpecialKey KeyRight :: SpecialKey KeyTab :: SpecialKey KeyEnter :: SpecialKey KeyBackspace :: SpecialKey KeyShift :: SpecialKey KeyCtrl :: SpecialKey KeyAlt :: SpecialKey KeyCaps :: SpecialKey instance GHC.Show.Show InputEvent.InputEvent instance GHC.Classes.Eq InputEvent.InputEvent instance GHC.Classes.Ord InputEvent.Key instance GHC.Classes.Eq InputEvent.Key instance GHC.Show.Show InputEvent.Key instance GHC.Classes.Ord InputEvent.SpecialKey instance GHC.Classes.Eq InputEvent.SpecialKey instance GHC.Show.Show InputEvent.SpecialKey instance GHC.Classes.Ord InputEvent.KeyState instance GHC.Classes.Eq InputEvent.KeyState instance GHC.Show.Show InputEvent.KeyState module Settings data Simulation Simulation :: GleamConfig -> model -> (model -> Picture) -> (model -> model) -> (InputEvent -> model -> model) -> String -> Simulation -- | Config for the canvas. [simConfig] :: Simulation -> GleamConfig -- | Initial model for a simulation. [simInitialModel] :: Simulation -> model -- | Function to generate a picture from a model. [simDraw] :: Simulation -> (model -> Picture) -- | Function to update the state of the simulation. [simUpdate] :: Simulation -> (model -> model) -- | Function to handle input events. [simHandler] :: Simulation -> (InputEvent -> model -> model) -- | Title of the simulation. [simTitle] :: Simulation -> String data GleamConfig GleamConfig :: Int -> Int -> GleamConfig -- | Width of the canvas. [width] :: GleamConfig -> Int -- | Height of the canvas. [height] :: GleamConfig -> Int -- | The default config for Gleam defaultGleamConfig :: GleamConfig module Gleam -- | Run a simulation in a window. You decide how the model is represented, -- how to convert the model to a picture and how to update the model. -- This function does the rest. The simulation can be seen on -- `127.0.0.1:8023` play :: GleamConfig -> model -> (model -> Picture) -> (model -> model) -> (InputEvent -> model -> model) -> IO () -- | Run multiple simulations in a window. You decide how each model is -- represented, how to convert each model to a picture and how to update -- the model. This function does the rest. The simulations can be seen on -- `127.0.0.1:8023` playMultiple :: [Simulation] -> IO ()