SDL-0.6.7.0: Binding to libSDL

Copyright | (c) David Himmelstrup 2005
License | BSD-like
Maintainer | lemmih@gmail.com
Stability | provisional
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell98

Graphics.UI.SDL.Events

Description

Synopsis

- data Event
  - = NoEvent
  - | GotFocus [Focus]
  - | LostFocus [Focus]
  - | KeyDown !Keysym
  - | KeyUp !Keysym
  - | MouseMotion !Word16 !Word16 !Int16 !Int16
  - | MouseButtonDown !Word16 !Word16 !MouseButton
  - | MouseButtonUp !Word16 !Word16 !MouseButton
  - | JoyAxisMotion !Word8 !Word8 !Int16
  - | JoyBallMotion !Word8 !Word8 !Int16 !Int16
  - | JoyHatMotion !Word8 !Word8 !Word8
  - | JoyButtonDown !Word8 !Word8
  - | JoyButtonUp !Word8 !Word8
  - | VideoResize !Int !Int
  - | VideoExpose
  - | Quit
  - | User !UserEventID !Int !(Ptr ()) !(Ptr ())
  - | Unknown
- data SDLEvent
  - = SDLNoEvent
  - | SDLActiveEvent
  - | SDLKeyDown
  - | SDLKeyUp
  - | SDLMouseMotion
  - | SDLMouseButtonDown
  - | SDLMouseButtonUp
  - | SDLJoyAxisMotion
  - | SDLJoyBallMotion
  - | SDLJoyHatMotion
  - | SDLJoyButtonDown
  - | SDLJoyButtonUp
  - | SDLQuit
  - | SDLSysWMEvent
  - | SDLVideoResize
  - | SDLVideoExpose
  - | SDLUserEvent Word8
  - | SDLNumEvents
- data UserEventID
  - = UID0
  - | UID1
  - | UID2
  - | UID3
  - | UID4
  - | UID5
  - | UID6
  - | UID7
- data MouseButton
  - = ButtonLeft
  - | ButtonMiddle
  - | ButtonRight
  - | ButtonWheelUp
  - | ButtonWheelDown
  - | ButtonUnknown !Word8
- data Focus
  - = MouseFocus
  - | InputFocus
  - | ApplicationFocus
- toSafePtr :: Typeable a => a -> IO SafePtr
- tryFromSafePtr :: Typeable a => SafePtr -> IO (Maybe a)
- fromSafePtr :: Typeable a => SafePtr -> IO a
- typeOfSafePtr :: SafePtr -> IO TypeRep
- enableKeyRepeat :: Int -> Int -> IO Bool
- enableUnicode :: Bool -> IO ()
- queryUnicodeState :: IO Bool
- getKeyName :: SDLKey -> String
- getMouseState :: IO (Int, Int, [MouseButton])
- getRelativeMouseState :: IO (Int, Int, [MouseButton])
- getModState :: IO [Modifier]
- setModState :: [Modifier] -> IO ()
- tryPushEvent :: Event -> IO Bool
- pushEvent :: Event -> IO ()
- pollEvent :: IO Event
- waitEvent :: IO Event
- waitEventBlocking :: IO Event
- pumpEvents :: IO ()
- enableEvent :: SDLEvent -> Bool -> IO ()
- queryEventState :: SDLEvent -> IO Bool
- getAppState :: IO [Focus]

# Documentation

data Event Source #

High level event structure.

Constructors

NoEvent |
GotFocus [Focus] |
LostFocus [Focus] |
KeyDown !Keysym |
KeyUp !Keysym |
MouseMotion !Word16 !Word16 !Int16 !Int16 |
MouseButtonDown !Word16 !Word16 !MouseButton |
MouseButtonUp !Word16 !Word16 !MouseButton |
JoyAxisMotion !Word8 !Word8 !Int16 | device index, axis index, axis value.
JoyBallMotion !Word8 !Word8 !Int16 !Int16 | device index, trackball index, relative motion.
JoyHatMotion !Word8 !Word8 !Word8 | device index, hat index, hat position.
JoyButtonDown !Word8 !Word8 | device index, button index.
JoyButtonUp !Word8 !Word8 | device index, button index.
VideoResize !Int !Int | When `Resizable` is passed as a flag to `setVideoMode` the user is allowed to resize the applications window. When the window is resized an `VideoResize` is reported, with the new window width and height values. When an `VideoResize` is recieved the window should be resized to the new dimensions using `setVideoMode`.
VideoExpose | A `VideoExpose` event is triggered when the screen has been modified outside of the application, usually by the window manager and needs to be redrawn.
Quit |
User !UserEventID !Int !(Ptr ()) !(Ptr ()) |
Unknown |

#### Instances

Instances details

Storable Event Source # |

Instance details

Defined in Graphics.UI.SDL.Events

Methods

sizeOf :: Event -> Int Source #

alignment :: Event -> Int Source #

peekElemOff :: Ptr Event -> Int -> IO Event Source #

pokeElemOff :: Ptr Event -> Int -> Event -> IO () Source #

peekByteOff :: Ptr b -> Int -> IO Event Source #

pokeByteOff :: Ptr b -> Int -> Event -> IO () Source #

peek :: Ptr Event -> IO Event Source #

poke :: Ptr Event -> Event -> IO () Source #

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

data SDLEvent Source #

Low level event structure keeping a one-to-one relation with the C event structure.

Constructors

SDLNoEvent |
SDLActiveEvent |
SDLKeyDown |
SDLKeyUp |
SDLMouseMotion |
SDLMouseButtonDown |
SDLMouseButtonUp |
SDLJoyAxisMotion |
SDLJoyBallMotion |
SDLJoyHatMotion |
SDLJoyButtonDown |
SDLJoyButtonUp |
SDLQuit |
SDLSysWMEvent |
SDLVideoResize |
SDLVideoExpose |
SDLUserEvent Word8 |
SDLNumEvents |

#### Instances

Instances details

Bounded SDLEvent Source # |
Instance details Defined in Graphics.UI.SDL.Events Methods minBound :: SDLEvent Source # maxBound :: SDLEvent Source #
Show SDLEvent Source # |
Instance details Defined in Graphics.UI.SDL.Events Methods showsPrec :: Int -> SDLEvent -> ShowS Source # show :: SDLEvent -> String Source # showList :: [SDLEvent] -> ShowS Source #
Eq SDLEvent Source # |
Instance details Defined in Graphics.UI.SDL.Events Methods (==) :: SDLEvent -> SDLEvent -> Bool Source # (/=) :: SDLEvent -> SDLEvent -> Bool Source #
Ord SDLEvent Source # |
Instance details Defined in Graphics.UI.SDL.Events Methods compare :: SDLEvent -> SDLEvent -> Ordering Source # (<) :: SDLEvent -> SDLEvent -> Bool Source # (<=) :: SDLEvent -> SDLEvent -> Bool Source # (>) :: SDLEvent -> SDLEvent -> Bool Source # (>=) :: SDLEvent -> SDLEvent -> Bool Source # max :: SDLEvent -> SDLEvent -> SDLEvent Source # min :: SDLEvent -> SDLEvent -> SDLEvent Source #

data UserEventID Source #

Typed user events ranging from 0 to 7

Constructors

UID0 |
UID1 |
UID2 |
UID3 |
UID4 |
UID5 |
UID6 |
UID7 |

#### Instances

Instances details

Enum UserEventID Source # |

Instance details

Defined in Graphics.UI.SDL.Events

Methods

succ :: UserEventID -> UserEventID Source #

pred :: UserEventID -> UserEventID Source #

toEnum :: Int -> UserEventID Source #

fromEnum :: UserEventID -> Int Source #

enumFrom :: UserEventID -> [UserEventID] Source #

enumFromThen :: UserEventID -> UserEventID -> [UserEventID] Source #

enumFromTo :: UserEventID -> UserEventID -> [UserEventID] Source #

enumFromThenTo :: UserEventID -> UserEventID -> UserEventID -> [UserEventID] Source #

Show UserEventID Source # |
Instance details Defined in Graphics.UI.SDL.Events Methods showsPrec :: Int -> UserEventID -> ShowS Source # show :: UserEventID -> String Source # showList :: [UserEventID] -> ShowS Source #
Eq UserEventID Source # |
Instance details Defined in Graphics.UI.SDL.Events Methods (==) :: UserEventID -> UserEventID -> Bool Source # (/=) :: UserEventID -> UserEventID -> Bool Source #

data MouseButton Source #

Constructors

ButtonLeft |
ButtonMiddle |
ButtonRight |
ButtonWheelUp |
ButtonWheelDown |
ButtonUnknown !Word8 |

#### Instances

Instances details

Show MouseButton Source # |
Instance details Defined in Graphics.UI.SDL.Events Methods showsPrec :: Int -> MouseButton -> ShowS Source # show :: MouseButton -> String Source # showList :: [MouseButton] -> ShowS Source #
Eq MouseButton Source # |
Instance details Defined in Graphics.UI.SDL.Events Methods (==) :: MouseButton -> MouseButton -> Bool Source # (/=) :: MouseButton -> MouseButton -> Bool Source #
Ord MouseButton Source # |

Instance details

Defined in Graphics.UI.SDL.Events

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 #

Enum MouseButton Word8 Source # |
Instance details Defined in Graphics.UI.SDL.Events Methods succ :: MouseButton -> MouseButton Source # pred :: MouseButton -> MouseButton Source # toEnum :: Word8 -> MouseButton Source # fromEnum :: MouseButton -> Word8 Source # enumFromTo :: MouseButton -> MouseButton -> [MouseButton] Source #

data Focus Source #

Constructors

MouseFocus |
InputFocus |
ApplicationFocus |

#### Instances

Instances details

Bounded Focus Source # |
Instance details Defined in Graphics.UI.SDL.Events Methods minBound :: Focus Source # maxBound :: Focus Source #
Show Focus Source # |
Instance details Defined in Graphics.UI.SDL.Events Methods showsPrec :: Int -> Focus -> ShowS Source # show :: Focus -> String Source # showList :: [Focus] -> ShowS Source #
Eq Focus Source # |
Instance details Defined in Graphics.UI.SDL.Events Methods (==) :: Focus -> Focus -> Bool Source # (/=) :: Focus -> Focus -> Bool Source #
Ord Focus Source # |
Instance details Defined in Graphics.UI.SDL.Events Methods compare :: Focus -> Focus -> Ordering Source # (<) :: Focus -> Focus -> Bool Source # (<=) :: Focus -> Focus -> Bool Source # (>) :: Focus -> Focus -> Bool Source # (>=) :: Focus -> Focus -> Bool Source # max :: Focus -> Focus -> Focus Source # min :: Focus -> Focus -> Focus Source #
Enum Focus Word8 Source # |
Instance details Defined in Graphics.UI.SDL.Events Methods succ :: Focus -> Focus Source # pred :: Focus -> Focus Source # toEnum :: Word8 -> Focus Source # fromEnum :: Focus -> Word8 Source # enumFromTo :: Focus -> Focus -> [Focus] Source #

toSafePtr :: Typeable a => a -> IO SafePtr Source #

Constructs a safe pointer from an arbitrary value.

tryFromSafePtr :: Typeable a => SafePtr -> IO (Maybe a) Source #

Get object from a safe pointer. `Nothing` on type mismatch.

fromSafePtr :: Typeable a => SafePtr -> IO a Source #

Get object from a safe pointer. Throws an exception on type mismatch.

typeOfSafePtr :: SafePtr -> IO TypeRep Source #

Return the type of the object the safe pointer was created from.

enableKeyRepeat Source #

Arguments

:: Int | Initial delay. `0` to disable.
-> Int | Interval.
-> IO Bool |

Sets keyboard repeat rate. Returns `False` on error.

enableUnicode :: Bool -> IO () Source #

Enables or disables unicode translation.

queryUnicodeState :: IO Bool Source #

Returns the current state of unicode translation. See also `enableUnicode`.

getKeyName :: SDLKey -> String Source #

Gets the name of an SDL virtual keysym.

getMouseState :: IO (Int, Int, [MouseButton]) Source #

Retrieves the current state of the mouse. Returns (X position, Y position, pressed buttons).

getRelativeMouseState :: IO (Int, Int, [MouseButton]) Source #

Retrieve the current state of the mouse. Like `getMouseState` except that X and Y are set to the change since last call to getRelativeMouseState.

getModState :: IO [Modifier] Source #

Gets the state of modifier keys.

setModState :: [Modifier] -> IO () Source #

Sets the internal state of modifier keys.

tryPushEvent :: Event -> IO Bool Source #

Pushes an event onto the event queue. Returns `False` on error.

pushEvent :: Event -> IO () Source #

Pushes an event onto the event queue. Throws an exception on error.

pollEvent :: IO Event Source #

Polls for currently pending events.

waitEvent :: IO Event Source #

Waits indefinitely for the next available event.

waitEventBlocking :: IO Event Source #

Waits indefinitely for the next available event. Blocks Haskell threads.

pumpEvents :: IO () Source #

Pumps the event loop, gathering events from the input devices.

enableEvent :: SDLEvent -> Bool -> IO () Source #

Enable or disable events from being processed.

queryEventState :: SDLEvent -> IO Bool Source #

Checks current state of a event. See also `enableEvent`.

getAppState :: IO [Focus] Source #

Gets the state of the application.