packages feed

astrds-0.1: src/Options.hs

module Options where

import System.Console.GetOpt
import qualified Graphics.UI.SDL as SDL

----------------------------------------------------------------------------
-- * Option handling
----------------------------------------------------------------------------

data Options = Options { debug       :: Bool
                       , fullscreen  :: Bool
                       , joystick    :: Maybe SDL.Joystick 
                       , audio       :: Bool
                       , name        :: Maybe String
                       , help        :: Bool
                       }

defaultOptions :: Options
defaultOptions = Options { debug       = False
                         , fullscreen  = False
                         , joystick    = Nothing 
                         , audio       = True
                         , name        = Nothing 
                         , help        = False }

optdescrs :: [OptDescr (Options -> Options)]
optdescrs = 
  [Option "d" ["debug"]      (NoArg (\ o -> o { debug = True }))      "enable debug output",
   Option "f" ["fullscreen"] (NoArg (\ o -> o { fullscreen = True })) "enable fullscreen mode",
   Option "h" ["help"]       (NoArg (\o  -> o { help = True }))       "show this help",
   Option "s" ["silent"]     (NoArg (\o  -> o { audio = False}))      "silent mode -- no audio"
  ]