This repository has been archived on 2025-03-03. You can view files and clone it, but cannot push or open issues or pull requests.
htanks/GLDriver.hs

34 lines
678 B
Haskell
Raw Normal View History

2010-02-22 18:27:18 +01:00
{-# LANGUAGE ExistentialQuantification, DeriveDataTypeable #-}
2010-02-22 16:50:42 +01:00
2010-02-22 18:27:18 +01:00
module GLDriver ( Driver(..)
2010-02-22 16:50:42 +01:00
, Event
, SomeEvent(..)
2010-02-22 22:25:06 +01:00
, QuitEvent(..)
, fromEvent
2010-02-22 16:50:42 +01:00
) where
import Data.Typeable
2010-02-22 18:27:18 +01:00
class Driver a where
2010-02-22 16:50:42 +01:00
initialized :: a -> Bool
initGL :: a -> IO a
deinitGL :: a -> IO ()
swapBuffers :: a -> IO ()
2010-02-22 16:50:42 +01:00
nextEvent :: a -> IO (Maybe SomeEvent)
class Typeable a => Event a
data SomeEvent = forall a. Event a => SomeEvent a
fromEvent :: Event a => SomeEvent -> Maybe a
fromEvent (SomeEvent a) = cast a
2010-02-22 18:27:18 +01:00
data QuitEvent = QuitEvent deriving Typeable
instance Event QuitEvent