Safe Haskell | None |
---|
- module SimpleH.Reactive
- module SimpleH
- data V2 t = V2 !t !t
- data V3 t = V3 !t !t !t
- data V4 t = V4 !t !t !t !t
- class Graphics g where
- type EventHandler = Event Seconds Position -> Event Seconds (Button, KeyButtonState) -> IO (Event Seconds (IO ()))
- type Position = V2 Coord
- type Title = String
- spawnWindow :: Title -> EventHandler -> IO ()
- data Button
- data KeyButtonState
- data Size = Size !GLsizei !GLsizei
- data GettableStateVar a
- data SettableStateVar a
- type Scene t = [Widget t]
- data Widget t
- data Transform t
- data Shape t = Polygon [Vertex t]
- data ShapeProp = Texture Texture
- data Vertex t = Vertex [VertexProp t] !t !t !t
- data VertexProp t
- clearScreen :: IO ()
- drawScene :: Scene Coord -> IO ()
- swapBuffers :: IO ()
- type Coord = GLfloat
- white :: Num t => V4 t
- black :: Num t => V4 t
- grey :: Num t => t -> V4 t
- gray :: Num t => t -> V4 t
- red :: Num t => V4 t
- green :: Num t => V4 t
- blue :: Num t => V4 t
- yellow :: (Num t, Semigroup t) => V4 t
- magenta :: (Num t, Semigroup t) => V4 t
- cyan :: (Num t, Semigroup t) => V4 t
- vert :: t -> t -> t -> Vertex t
- cvert :: VertexProp t -> t -> t -> t -> Vertex t
Documentation
module SimpleH.Reactive
module SimpleH
A two-element vector
V2 !t !t |
A three-element vector
V3 !t !t !t |
A three-element vector
V4 !t !t !t !t |
Creating windows & Handling events
type EventHandler = Event Seconds Position -> Event Seconds (Button, KeyButtonState) -> IO (Event Seconds (IO ()))Source
spawnWindow :: Title -> EventHandler -> IO ()Source
Create an OpenGL window and sinks all events into the given handler.
data KeyButtonState
Key or button state.
data Size
A 2-dimensional size, measured in pixels.
Examining and modifying the window
data GettableStateVar a
A concrete implementation of a read-only state variable, carrying an IO action to read the value.
data SettableStateVar a
A concrete implementation of a write-only state variable, carrying an IO action to write the new value.
Drawing the scene
clearScreen :: IO ()Source
swapBuffers :: IO ()
Swap the back and front color buffers of the window. If AutoPollEvent
is
enabled by enableSpecial
(which is the default), it also polls for new
events before the swapping.
Basic types
Utilities
Basic colors
Vertices
cvert :: VertexProp t -> t -> t -> t -> Vertex tSource