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

Safe Haskell | Safe-Inferred
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 Source #

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 Source #

Possible input events.

Constructors

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

#### Instances

Instances details

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

data Key Source #

Constructors

Char Char |
SpecialKey SpecialKey |
MouseButton MouseButton |

#### Instances

Instances details

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

data SpecialKey Source #

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

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

Instance details

Defined in Graphics.Gloss.Internals.Interface.Backend.Types

Methods

compare :: SpecialKey -> SpecialKey -> Ordering Source #

(<) :: SpecialKey -> SpecialKey -> Bool Source #

(<=) :: SpecialKey -> SpecialKey -> Bool Source #

(>) :: SpecialKey -> SpecialKey -> Bool Source #

(>=) :: SpecialKey -> SpecialKey -> Bool Source #

max :: SpecialKey -> SpecialKey -> SpecialKey Source #

min :: SpecialKey -> SpecialKey -> SpecialKey Source #

data MouseButton Source #

Constructors

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

#### Instances

Instances details

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

Instance details

Defined in Graphics.Gloss.Internals.Interface.Backend.Types

Methods

compare :: MouseButton -> MouseButton -> Ordering Source #

(<) :: MouseButton -> MouseButton -> Bool Source #

(<=) :: MouseButton -> MouseButton -> Bool Source #

(>) :: MouseButton -> MouseButton -> Bool Source #

(>=) :: MouseButton -> MouseButton -> Bool Source #

max :: MouseButton -> MouseButton -> MouseButton Source #

min :: MouseButton -> MouseButton -> MouseButton Source #

data KeyState Source #

Constructors

Down |
Up |

#### Instances

Instances details

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

Instance details

Defined in Graphics.Gloss.Internals.Interface.Backend.Types

Methods

compare :: KeyState -> KeyState -> Ordering Source #

(<) :: KeyState -> KeyState -> Bool Source #

(<=) :: KeyState -> KeyState -> Bool Source #

(>) :: KeyState -> KeyState -> Bool Source #

(>=) :: KeyState -> KeyState -> Bool Source #

max :: KeyState -> KeyState -> KeyState Source #

min :: KeyState -> KeyState -> KeyState Source #

data Modifiers Source #

Constructors

Modifiers |

Fields

- shift :: KeyState
- ctrl :: KeyState
- alt :: KeyState

#### Instances

Instances details

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

Instance details

Defined in Graphics.Gloss.Internals.Interface.Backend.Types

Methods

compare :: Modifiers -> Modifiers -> Ordering Source #

(<) :: Modifiers -> Modifiers -> Bool Source #

(<=) :: Modifiers -> Modifiers -> Bool Source #

(>) :: Modifiers -> Modifiers -> Bool Source #

(>=) :: Modifiers -> Modifiers -> Bool Source #

max :: Modifiers -> Modifiers -> Modifiers Source #

min :: Modifiers -> Modifiers -> Modifiers Source #