diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..9a994af --- /dev/null +++ b/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/src/Main.hs b/src/Main.hs index b026215..14e502c 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -6,6 +6,8 @@ import Linear import Options.Applicative +import Control.Monad + -- internal imports import Util @@ -19,5 +21,19 @@ main = do SDL.initializeAll SDL.screenSaverEnabled SDL.$= False disps <- SDL.getDisplays - putStrLn ("number of displays detected: " ++ show (length disps)) + 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 + ) diff --git a/src/Util.hs b/src/Util.hs index e3ba041..f230669 100644 --- a/src/Util.hs +++ b/src/Util.hs @@ -4,6 +4,8 @@ import qualified SDL import Options.Applicative +import System.IO + -- internal imports import Types @@ -15,6 +17,9 @@ glWindowConfig = SDL.defaultWindow } } +putErrLn :: String -> IO () +putErrLn s = hputStrLn stderr s + options :: Parser Options options = Options <$> switch @@ -33,3 +38,6 @@ options = Options ( help "Input file" <> metavar "FILE" ) + +-- makeWindowConfig :: SDL.Display -> SDL.WindowConfig +-- makeWindowConfig d =