gloss-1.13.2.1: Painless 2D vector graphics, animations and simulations.

Safe Haskell | None
Language | Haskell2010

Graphics.Gloss.Interface.IO.Game

Description

This game mode lets you manage your own input. Pressing ESC will not abort the program. You also don't get automatic pan and zoom controls like with `display`.

Synopsis

- module Graphics.Gloss.Data.Display
- module Graphics.Gloss.Data.Picture
- module Graphics.Gloss.Data.Color
- playIO :: forall world. Display -> Color -> Int -> world -> (world -> IO Picture) -> (Event -> world -> IO world) -> (Float -> world -> IO world) -> IO ()
- data Event
  - = EventKey Key KeyState Modifiers (Float, Float)
  - | EventMotion (Float, Float)
  - | EventResize (Int, Int)
- data Key
  - = Char Char
  - | SpecialKey SpecialKey
  - | MouseButton MouseButton
- data SpecialKey
  - = KeyUnknown
  - | KeySpace
  - | KeyEsc
  - | KeyF1
  - | KeyF2
  - | KeyF3
  - | KeyF4
  - | KeyF5
  - | KeyF6
  - | KeyF7
  - | KeyF8
  - | KeyF9
  - | KeyF10
  - | KeyF11
  - | KeyF12
  - | KeyF13
  - | KeyF14
  - | KeyF15
  - | KeyF16
  - | KeyF17
  - | KeyF18
  - | KeyF19
  - | KeyF20
  - | KeyF21
  - | KeyF22
  - | KeyF23
  - | KeyF24
  - | KeyF25
  - | KeyUp
  - | KeyDown
  - | KeyLeft
  - | KeyRight
  - | KeyTab
  - | KeyEnter
  - | KeyBackspace
  - | KeyInsert
  - | KeyNumLock
  - | KeyBegin
  - | KeyDelete
  - | KeyPageUp
  - | KeyPageDown
  - | KeyHome
  - | KeyEnd
  - | KeyShiftL
  - | KeyShiftR
  - | KeyCtrlL
  - | KeyCtrlR
  - | KeyAltL
  - | KeyAltR
  - | KeyPad0
  - | KeyPad1
  - | KeyPad2
  - | KeyPad3
  - | KeyPad4
  - | KeyPad5
  - | KeyPad6
  - | KeyPad7
  - | KeyPad8
  - | KeyPad9
  - | KeyPadDivide
  - | KeyPadMultiply
  - | KeyPadSubtract
  - | KeyPadAdd
  - | KeyPadDecimal
  - | KeyPadEqual
  - | KeyPadEnter
- data MouseButton
  - = LeftButton
  - | MiddleButton
  - | RightButton
  - | WheelUp
  - | WheelDown
  - | AdditionalButton Int
- data KeyState
  - = Down
  - | Up
- data Modifiers = Modifiers {
  - shift :: KeyState
  - ctrl :: KeyState
  - alt :: KeyState
  }

# Documentation

module Graphics.Gloss.Data.Display

module Graphics.Gloss.Data.Picture

module Graphics.Gloss.Data.Color

playIO #

Arguments

:: forall world. Display | Display mode.
-> Color | Background color.
-> Int | Number of simulation steps to take for each second of real time.
-> world | The initial world.
-> (world -> IO Picture) | An action to convert the world a picture.
-> (Event -> world -> IO world) | A function to handle input events.
-> (Float -> world -> IO world) | A function to step the world one iteration. It is passed the period of time (in seconds) needing to be advanced.
-> IO () |

Play a game in a window, using IO actions to build the pictures.

data Event #

Possible input events.

Constructors

EventKey Key KeyState Modifiers (Float, Float) |
EventMotion (Float, Float) |
EventResize (Int, Int) |

#### Instances

Instances details

Eq Event # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Event Methods (==) :: Event -> Event -> Bool # (/=) :: Event -> Event -> Bool #
Show Event # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Event Methods showsPrec :: Int -> Event -> ShowS # show :: Event -> String # showList :: [Event] -> ShowS #

data Key #

Constructors

Char Char |
SpecialKey SpecialKey |
MouseButton MouseButton |

#### Instances

Instances details

Eq Key # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Backend.Types Methods (==) :: Key -> Key -> Bool # (/=) :: Key -> Key -> Bool #
Ord Key # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Backend.Types Methods compare :: Key -> Key -> Ordering # (<) :: Key -> Key -> Bool # (<=) :: Key -> Key -> Bool # (>) :: Key -> Key -> Bool # (>=) :: Key -> Key -> Bool # max :: Key -> Key -> Key # min :: Key -> Key -> Key #
Show Key # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Backend.Types Methods showsPrec :: Int -> Key -> ShowS # show :: Key -> String # showList :: [Key] -> ShowS #

data SpecialKey #

Constructors

KeyUnknown |
KeySpace |
KeyEsc |
KeyF1 |
KeyF2 |
KeyF3 |
KeyF4 |
KeyF5 |
KeyF6 |
KeyF7 |
KeyF8 |
KeyF9 |
KeyF10 |
KeyF11 |
KeyF12 |
KeyF13 |
KeyF14 |
KeyF15 |
KeyF16 |
KeyF17 |
KeyF18 |
KeyF19 |
KeyF20 |
KeyF21 |
KeyF22 |
KeyF23 |
KeyF24 |
KeyF25 |
KeyUp |
KeyDown |
KeyLeft |
KeyRight |
KeyTab |
KeyEnter |
KeyBackspace |
KeyInsert |
KeyNumLock |
KeyBegin |
KeyDelete |
KeyPageUp |
KeyPageDown |
KeyHome |
KeyEnd |
KeyShiftL |
KeyShiftR |
KeyCtrlL |
KeyCtrlR |
KeyAltL |
KeyAltR |
KeyPad0 |
KeyPad1 |
KeyPad2 |
KeyPad3 |
KeyPad4 |
KeyPad5 |
KeyPad6 |
KeyPad7 |
KeyPad8 |
KeyPad9 |
KeyPadDivide |
KeyPadMultiply |
KeyPadSubtract |
KeyPadAdd |
KeyPadDecimal |
KeyPadEqual |
KeyPadEnter |

#### Instances

Instances details

Eq SpecialKey # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Backend.Types Methods (==) :: SpecialKey -> SpecialKey -> Bool # (/=) :: SpecialKey -> SpecialKey -> Bool #
Ord SpecialKey # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Backend.Types Methods compare :: SpecialKey -> SpecialKey -> Ordering # (<) :: SpecialKey -> SpecialKey -> Bool # (<=) :: SpecialKey -> SpecialKey -> Bool # (>) :: SpecialKey -> SpecialKey -> Bool # (>=) :: SpecialKey -> SpecialKey -> Bool # max :: SpecialKey -> SpecialKey -> SpecialKey # min :: SpecialKey -> SpecialKey -> SpecialKey #
Show SpecialKey # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Backend.Types Methods showsPrec :: Int -> SpecialKey -> ShowS # show :: SpecialKey -> String # showList :: [SpecialKey] -> ShowS #

data MouseButton #

Constructors

LeftButton |
MiddleButton |
RightButton |
WheelUp |
WheelDown |
AdditionalButton Int |

#### Instances

Instances details

Eq MouseButton # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Backend.Types Methods (==) :: MouseButton -> MouseButton -> Bool # (/=) :: MouseButton -> MouseButton -> Bool #
Ord MouseButton # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Backend.Types Methods compare :: MouseButton -> MouseButton -> Ordering # (<) :: MouseButton -> MouseButton -> Bool # (<=) :: MouseButton -> MouseButton -> Bool # (>) :: MouseButton -> MouseButton -> Bool # (>=) :: MouseButton -> MouseButton -> Bool # max :: MouseButton -> MouseButton -> MouseButton # min :: MouseButton -> MouseButton -> MouseButton #
Show MouseButton # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Backend.Types Methods showsPrec :: Int -> MouseButton -> ShowS # show :: MouseButton -> String # showList :: [MouseButton] -> ShowS #

data KeyState #

Constructors

Down |
Up |

#### Instances

Instances details

Eq KeyState # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Backend.Types Methods (==) :: KeyState -> KeyState -> Bool # (/=) :: KeyState -> KeyState -> Bool #
Ord KeyState # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Backend.Types Methods compare :: KeyState -> KeyState -> Ordering # (<) :: KeyState -> KeyState -> Bool # (<=) :: KeyState -> KeyState -> Bool # (>) :: KeyState -> KeyState -> Bool # (>=) :: KeyState -> KeyState -> Bool # max :: KeyState -> KeyState -> KeyState # min :: KeyState -> KeyState -> KeyState #
Show KeyState # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Backend.Types Methods showsPrec :: Int -> KeyState -> ShowS # show :: KeyState -> String # showList :: [KeyState] -> ShowS #

data Modifiers #

Constructors

Modifiers |
Fields shift :: KeyState ctrl :: KeyState alt :: KeyState

#### Instances

Instances details

Eq Modifiers # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Backend.Types Methods (==) :: Modifiers -> Modifiers -> Bool # (/=) :: Modifiers -> Modifiers -> Bool #
Ord Modifiers # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Backend.Types Methods compare :: Modifiers -> Modifiers -> Ordering # (<) :: Modifiers -> Modifiers -> Bool # (<=) :: Modifiers -> Modifiers -> Bool # (>) :: Modifiers -> Modifiers -> Bool # (>=) :: Modifiers -> Modifiers -> Bool # max :: Modifiers -> Modifiers -> Modifiers # min :: Modifiers -> Modifiers -> Modifiers #
Show Modifiers # |
Instance details Defined in Graphics.Gloss.Internals.Interface.Backend.Types Methods showsPrec :: Int -> Modifiers -> ShowS # show :: Modifiers -> String # showList :: [Modifiers] -> ShowS #