40 lines
1.0 KiB
Haskell
40 lines
1.0 KiB
Haskell
module Main where
|
|
|
|
import qualified SDL
|
|
|
|
import Linear
|
|
|
|
import Options.Applicative
|
|
|
|
import Control.Monad
|
|
|
|
-- internal imports
|
|
|
|
import Util
|
|
|
|
main :: IO ()
|
|
main = do
|
|
opts <- execParser $ info (options <**> helper)
|
|
( fullDesc
|
|
<> progDesc "A simple PDF presenter written in Haskell using poppler and SDL2"
|
|
)
|
|
SDL.initializeAll
|
|
SDL.screenSaverEnabled SDL.$= False
|
|
disps <- SDL.getDisplays
|
|
putStrLn ("Number of displays detected: " ++ show (length disps))
|
|
putStrLn ("Passed command line options: " ++ show opts)
|
|
-- set Render quality
|
|
SDL.HintrenderScaleQuality SDL.$= SDL.ScaleLinear
|
|
-- check render quality
|
|
renderQuality <- SDL.get SDL.HintRenderScaleQuality
|
|
when (renderQuality /= SDL.SclaeLinear) $
|
|
putErrLn "Linear texture filtering not enabled!"
|
|
putStrLn "Creating window(s)"
|
|
wins = map uncurry SDL.CreateWindow $ if length disps > 1
|
|
then zip
|
|
[ "Ibis - " ++ optFile options
|
|
, "Ibis - " ++ optFile options ++ " - Notes"
|
|
]
|
|
( map makeWindowConfig disps
|
|
)
|