Safe Haskell | None |
---|---|
Language | Haskell98 |
- drawingOf :: Picture -> IO ()
- pictureOf :: Picture -> IO ()
- animationOf :: (Double -> Picture) -> IO ()
- simulationOf :: world -> (Double -> world -> world) -> (world -> Picture) -> IO ()
- interactionOf :: world -> (Double -> world -> world) -> (Event -> world -> world) -> (world -> Picture) -> IO ()
- data Picture
- data TextStyle
- data Font
- blank :: Picture
- line :: [Point] -> Picture
- thickLine :: Double -> [Point] -> Picture
- path :: [Point] -> Picture
- thickPath :: Double -> [Point] -> Picture
- polygon :: [Point] -> Picture
- thickPolygon :: Double -> [Point] -> Picture
- solidPolygon :: [Point] -> Picture
- curve :: [Point] -> Picture
- thickCurve :: Double -> [Point] -> Picture
- loop :: [Point] -> Picture
- thickLoop :: Double -> [Point] -> Picture
- solidLoop :: [Point] -> Picture
- rectangle :: Double -> Double -> Picture
- solidRectangle :: Double -> Double -> Picture
- thickRectangle :: Double -> Double -> Double -> Picture
- circle :: Double -> Picture
- solidCircle :: Double -> Picture
- thickCircle :: Double -> Double -> Picture
- arc :: Double -> Double -> Double -> Picture
- sector :: Double -> Double -> Double -> Picture
- thickArc :: Double -> Double -> Double -> Double -> Picture
- text :: Text -> Picture
- styledText :: TextStyle -> Font -> Text -> Picture
- colored :: Color -> Picture -> Picture
- coloured :: Color -> Picture -> Picture
- translated :: Double -> Double -> Picture -> Picture
- scaled :: Double -> Double -> Picture -> Picture
- dilated :: Double -> Double -> Picture -> Picture
- rotated :: Double -> Picture -> Picture
- pictures :: [Picture] -> Picture
- (&) :: Picture -> Picture -> Picture
- (<>) :: Monoid m => m -> m -> m
- coordinatePlane :: Picture
- codeWorldLogo :: Picture
- type Point = (Double, Double)
- type Vector = (Double, Double)
- vectorSum :: Vector -> Vector -> Vector
- vectorDifference :: Vector -> Vector -> Vector
- scaledVector :: Double -> Vector -> Vector
- rotatedVector :: Double -> Vector -> Vector
- dotProduct :: Vector -> Vector -> Double
- data Color = RGBA !Double !Double !Double !Double
- type Colour = Color
- black :: Color
- white :: Color
- red :: Color
- green :: Color
- blue :: Color
- cyan :: Color
- magenta :: Color
- yellow :: Color
- aquamarine :: Color
- orange :: Color
- azure :: Color
- violet :: Color
- chartreuse :: Color
- rose :: Color
- brown :: Color
- pink :: Color
- purple :: Color
- gray :: Double -> Color
- grey :: Double -> Color
- mixed :: Color -> Color -> Color
- lighter :: Double -> Color -> Color
- light :: Color -> Color
- darker :: Double -> Color -> Color
- dark :: Color -> Color
- brighter :: Double -> Color -> Color
- bright :: Color -> Color
- duller :: Double -> Color -> Color
- dull :: Color -> Color
- translucent :: Color -> Color
- hue :: Color -> Double
- saturation :: Color -> Double
- luminosity :: Color -> Double
- fromHSL :: Double -> Double -> Double -> Color
- data Event
- data MouseButton
- trace :: Text -> a -> a
Entry points
pictureOf :: Picture -> IO () Source #
Warning: Please use drawingOf instead of pictureOf
Draws a Picture
. This is the simplest CodeWorld entry point.
animationOf :: (Double -> Picture) -> IO () Source #
Shows an animation, with a picture for each time given by the parameter.
simulationOf :: world -> (Double -> world -> world) -> (world -> Picture) -> IO () Source #
Shows a simulation, which is essentially a continuous-time dynamical system described by an initial value and step function.
interactionOf :: world -> (Double -> world -> world) -> (Event -> world -> world) -> (world -> Picture) -> IO () Source #
Runs an interactive event-driven CodeWorld program. This is the most advanced CodeWorld entry point.
Pictures
line :: [Point] -> Picture Source #
Warning: Please use path instead of line
A thin sequence of line segments, with these points as endpoints
thickLine :: Double -> [Point] -> Picture Source #
Warning: Please use thickPath instead of thickLine
A thick sequence of line segments, with this line width and endpoints
thickPath :: Double -> [Point] -> Picture Source #
A thick sequence of line segments, with given line width and endpoints
thickPolygon :: Double -> [Point] -> Picture Source #
A thick polygon with this line width and these points as vertices
solidPolygon :: [Point] -> Picture Source #
A solid polygon with these points as vertices
thickCurve :: Double -> [Point] -> Picture Source #
A thick smooth curve with this line width, passing through these points.
thickLoop :: Double -> [Point] -> Picture Source #
A thick smooth closed loop with this line width, passing through these points.
thickRectangle :: Double -> Double -> Double -> Picture Source #
A thick rectangle, with this line width, and width and height
solidCircle :: Double -> Picture Source #
A solid circle, with this radius
arc :: Double -> Double -> Double -> Picture Source #
A thin arc, starting and ending at these angles, with this radius
Angles are in radians.
sector :: Double -> Double -> Double -> Picture Source #
A solid sector of a circle (i.e., a pie slice) starting and ending at these angles, with this radius
Angles are in radians.
thickArc :: Double -> Double -> Double -> Double -> Picture Source #
A thick arc with this line width, starting and ending at these angles, with this radius.
Angles are in radians.
translated :: Double -> Double -> Picture -> Picture Source #
A picture drawn translated in these directions.
rotated :: Double -> Picture -> Picture Source #
A picture rotated by this angle.
Angles are in radians.
(&) :: Picture -> Picture -> Picture infixr 0 Source #
Warning: Please use <> from Data.Monoid instead of &
coordinatePlane :: Picture Source #
A coordinate plane. Adding this to your pictures can help you measure distances more accurately.
Example:
main = pictureOf(myPicture & coordinatePlane) myPicture = ...
codeWorldLogo :: Picture Source #
The CodeWorld logo.
Colors
aquamarine :: Color Source #
chartreuse :: Color Source #
translucent :: Color -> Color Source #
saturation :: Color -> Double Source #
luminosity :: Color -> Double Source #
Events
An event initiated by the user.
Values of this type represent events that the user triggers when
using an interaction, defined with interactionOf
.
Key events describe the key as Text
. Most keys are represented
by a single character text string, with the capital letter or other
symbol from the key. Keys that don't correspond to a single
character use longer names from the following list. Keep in mind
that not all of these keys appear on all keyboards.
- Up, Down, Left, and Right for the cursor keys.
- F1, F2, etc. for function keys.
- Backspace
- Tab
- Enter
- Shift
- Ctrl
- Alt
- Esc
- PageUp
- PageDown
- End
- Home
- Insert
- Delete
- CapsLock
- NumLock
- ScrollLock
- PrintScreen
- Break
- Separator
- Cancel
- Help
data MouseButton Source #