47 lines
849 B
Haskell
47 lines
849 B
Haskell
module Util where
|
|
|
|
import qualified SDL
|
|
|
|
import Options.Applicative
|
|
|
|
import System.IO
|
|
|
|
-- internal imports
|
|
|
|
import Types
|
|
|
|
glWindowConfig :: SDL.WindowConfig
|
|
glWindowConfig = SDL.defaultWindow
|
|
{ SDL.windowOpenGL = Just SDL.defaultOpenGL
|
|
{ SDL.glProfile = SDL.Core SDL.Normal 3 3
|
|
}
|
|
}
|
|
|
|
putErrLn :: String -> IO ()
|
|
putErrLn s = hPutStrLn stderr s
|
|
|
|
options :: Parser Options
|
|
options = Options
|
|
<$> switch
|
|
( long "fullscreen"
|
|
<> short 'f'
|
|
<> help "Toggle fullscreen"
|
|
<> showDefault
|
|
)
|
|
<*> switch
|
|
( long "flip"
|
|
<> short 'p'
|
|
<> help "Flip screens"
|
|
<> showDefault
|
|
)
|
|
<*> argument str
|
|
( help "Input file"
|
|
<> metavar "FILE"
|
|
)
|
|
|
|
makeWindowConfig :: SDL.Display -> SDL.WindowConfig
|
|
makeWindowConfig d =
|
|
glWindowConfig
|
|
{ SDL.windowPosition = SDL.Absolute (SDL.displayBoundsPosition d)
|
|
}
|