module Brillo.Interface.Environment where

import Data.IORef (newIORef)

import Brillo.Internals.Interface.Backend (defaultBackendState)
import Brillo.Internals.Interface.Backend.Types qualified as Backend.Types


{-| Get the size of the screen, in pixels.

  This will be the size of the rendered brillo image when
  fullscreen mode is enabled.
-}
getScreenSize :: IO (Int, Int)
getScreenSize :: IO (Int, Int)
getScreenSize = do
  IORef GLFWState
backendStateRef <- GLFWState -> IO (IORef GLFWState)
forall a. a -> IO (IORef a)
newIORef GLFWState
defaultBackendState
  IORef GLFWState -> Bool -> IO ()
forall a. Backend a => IORef a -> Bool -> IO ()
Backend.Types.initializeBackend IORef GLFWState
backendStateRef Bool
False
  IORef GLFWState -> IO (Int, Int)
forall a. Backend a => IORef a -> IO (Int, Int)
Backend.Types.getScreenSize IORef GLFWState
backendStateRef