diff options
Diffstat (limited to 'GLDriver.hs')
-rw-r--r-- | GLDriver.hs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/GLDriver.hs b/GLDriver.hs index 2e3dafc..9fb2642 100644 --- a/GLDriver.hs +++ b/GLDriver.hs @@ -1,6 +1,7 @@ {-# LANGUAGE ExistentialQuantification, DeriveDataTypeable #-} module GLDriver ( Driver(..) + , SomeDriver(..) , Event , SomeEvent(..) , QuitEvent(..) @@ -21,6 +22,15 @@ class Driver a where nextEvent :: a -> IO (Maybe SomeEvent) +data SomeDriver = forall d. Driver d => SomeDriver d + +instance Driver SomeDriver where + initialized (SomeDriver d) = initialized d + initGL (SomeDriver d) = initGL d >>= return . SomeDriver + deinitGL (SomeDriver d) = deinitGL d + swapBuffers (SomeDriver d) = swapBuffers d + nextEvent (SomeDriver d) = nextEvent d + class Typeable a => Event a @@ -34,4 +44,4 @@ data QuitEvent = QuitEvent deriving Typeable instance Event QuitEvent data ResizeEvent = ResizeEvent Int Int deriving Typeable -instance Event ResizeEvent
\ No newline at end of file +instance Event ResizeEvent |