    module Graphics.Gloss.Interface.Environment where
    import Graphics.Gloss.Internals.Interface.Backend.GLUT
    import qualified Graphics.UI.GLUT as GLUT
    import qualified Graphics.Rendering.OpenGL as GL
    import Data.IORef

    -- | Get the size of the screen, in pixels.
    --
    --   This will be the size of the rendered gloss image when
    --   fullscreen mode is enabled.
    --
    getScreenSize :: IO (Int, Int)
    getScreenSize :: IO (Int, Int)
    getScreenSize
     = do   IORef GLUTState
    backendStateRef         <- GLUTState -> IO (IORef GLUTState)
    forall a. a -> IO (IORef a)
    newIORef GLUTState
    glutStateInit
            IORef GLUTState -> Bool -> IO ()
    initializeGLUT IORef GLUTState
    backendStateRef Bool
    False
            GL.Size width :: GLsizei
    width height :: GLsizei
    height    <- GettableStateVar Size -> GettableStateVar Size
    forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
    GLUT.get GettableStateVar Size
    GLUT.screenSize
            (Int, Int) -> IO (Int, Int)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (GLsizei -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral GLsizei
    width, GLsizei -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral GLsizei
    height)