module Graphics.Gloss.Internals.Interface.Backend.Types
( module Graphics.Gloss.Internals.Interface.Backend.Types
, module Graphics.Gloss.Data.Display)
where
import Data.IORef
import Graphics.Gloss.Data.Display
class Backend a where
initBackendState :: a
initializeBackend :: IORef a -> Bool -> IO ()
exitBackend :: IORef a -> IO ()
openWindow :: IORef a -> Display -> IO ()
dumpBackendState :: IORef a -> IO ()
installDisplayCallback :: IORef a -> [Callback] -> IO ()
installWindowCloseCallback :: IORef a -> IO ()
installReshapeCallback :: IORef a -> [Callback] -> IO ()
installKeyMouseCallback :: IORef a -> [Callback] -> IO ()
installMotionCallback :: IORef a -> [Callback] -> IO ()
installIdleCallback :: IORef a -> [Callback] -> IO ()
runMainLoop :: IORef a -> IO ()
postRedisplay :: IORef a -> IO ()
getWindowDimensions :: IORef a -> IO (Int,Int)
elapsedTime :: IORef a -> IO Double
sleep :: IORef a -> Double -> IO ()
type DisplayCallback
= forall a . Backend a => IORef a -> IO ()
type KeyboardMouseCallback
= forall a . Backend a => IORef a -> Key -> KeyState -> Modifiers -> (Int,Int) -> IO ()
type MotionCallback
= forall a . Backend a => IORef a -> (Int,Int) -> IO ()
type IdleCallback
= forall a . Backend a => IORef a -> IO ()
type ReshapeCallback
= forall a . Backend a => IORef a -> (Int,Int) -> IO ()
data Callback
= Display DisplayCallback
| KeyMouse KeyboardMouseCallback
| Idle IdleCallback
| Motion MotionCallback
| Reshape ReshapeCallback
isIdleCallback :: Callback -> Bool
isIdleCallback cc
= case cc of
Idle _ -> True
_ -> False
data Key
= Char Char
| SpecialKey SpecialKey
| MouseButton MouseButton
deriving (Show, Eq, Ord)
data MouseButton
= LeftButton
| MiddleButton
| RightButton
| WheelUp
| WheelDown
| AdditionalButton Int
deriving (Show, Eq, Ord)
data KeyState
= Down
| Up
deriving (Show, Eq, Ord)
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
deriving (Show, Eq, Ord)
data Modifiers
= Modifiers
{ shift :: KeyState
, ctrl :: KeyState
, alt :: KeyState }
deriving (Show, Eq, Ord)