Debian Codegraph @

src/Graphics/UI/GLUT/QueryUtils.hs

raw
1 {-# OPTIONS_HADDOCK hide #-}
2 --------------------------------------------------------------------------------
3 -- |
4 -- Module : Graphics.UI.GLUT.QueryUtils
5 -- Copyright : (c) Sven Panne 2002-2018
6 -- License : BSD3
7 --
8 -- Maintainer : Sven Panne <[email protected]>
9 -- Stability : stable
10 -- Portability : portable
11 --
12 -- This is a purely internal module with utilities to query GLUT state.
13 --
14 --------------------------------------------------------------------------------
15
16 module Graphics.UI.GLUT.QueryUtils (
17 Getter, simpleGet, layerGet, deviceGet
18 ) where
19
20 import Foreign.C.Types ( CInt )
21 import Graphics.Rendering.OpenGL ( GLenum )
22
23 import Graphics.UI.GLUT.Raw
24
25 --------------------------------------------------------------------------------
26
27 type PrimGetter = GLenum -> IO CInt
28 type Getter a = (CInt -> a) -> GLenum -> IO a
29
30 makeGetter :: PrimGetter -> Getter a
31 makeGetter g f = fmap f . g
32
33 simpleGet, layerGet, deviceGet :: Getter a
34 simpleGet = makeGetter glutGet
35 layerGet = makeGetter glutLayerGet
36 deviceGet = makeGetter glutDeviceGet