module Graphics.Gloss.Interface.Environment where

import Data.IORef (newIORef)

import qualified Graphics.Gloss.Internals.Interface.Backend.Types as Backend.Types
import Graphics.Gloss.Internals.Interface.Backend (defaultBackendState)

-- | 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
defaultBackendState
       IORef GLUTState -> Bool -> IO ()
forall a. Backend a => IORef a -> Bool -> IO ()
Backend.Types.initializeBackend IORef GLUTState
backendStateRef Bool
False
       IORef GLUTState -> IO (Int, Int)
forall a. Backend a => IORef a -> IO (Int, Int)
Backend.Types.getScreenSize IORef GLUTState
backendStateRef