File: ClientOptions.hs

package info (click to toggle)
haskell-lambdahack 0.11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,056 kB
  • sloc: haskell: 45,636; makefile: 219
file content (111 lines) | stat: -rw-r--r-- 4,007 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
{-# LANGUAGE DeriveGeneric #-}
-- | Options that affect the behaviour of the client.
module Game.LambdaHack.Common.ClientOptions
  ( FullscreenMode(..), ClientOptions(..), defClientOptions
  ) where

import Prelude ()

import Game.LambdaHack.Core.Prelude

import Control.DeepSeq
import Data.Binary
import GHC.Generics (Generic)

import Game.LambdaHack.Common.Misc

-- | Kinds of fullscreen or windowed mode. See <https://hackage.haskell.org/package/sdl2-2.5.3.0/docs/SDL-Video.html#t:WindowMode>.
data FullscreenMode =
    NotFullscreen        -- ^ a normal window instead of fullscreen
  | BigBorderlessWindow  -- ^ fake fullscreen; window the size of the desktop;
                         --   this is the preferred one, if it works
  | ModeChange           -- ^ real fullscreen with a video mode change
  deriving (Show, Read, Eq, Generic)

instance NFData FullscreenMode

instance Binary FullscreenMode

-- | Options that affect the behaviour of the client (but not game rules).
data ClientOptions = ClientOptions
  { schosenFontset    :: Maybe Text
      -- ^ Font set chosen by the player for the whole UI.
  , sallFontsScale    :: Maybe Double
      -- ^ The scale applied to all fonts, resizing the whole UI.
  , sfonts            :: [(Text, FontDefinition)]
      -- ^ Available fonts as defined in config file.
  , sfontsets         :: [(Text, FontSet)]
      -- ^ Available font sets as defined in config file.
  , sfullscreenMode   :: Maybe FullscreenMode
      -- ^ Whether to start in fullscreen mode and in which one.
  , slogPriority      :: Maybe Int
      -- ^ How much to log (e.g., from SDL). 1 is all, 5 is errors, the default.
  , smaxFps           :: Maybe Double
      -- ^ Maximal frames per second.
      -- This is better low and fixed, to avoid jerkiness and delays
      -- that tell the player there are many intelligent enemies on the level.
      -- That's better than scaling AI sofistication down based
      -- on the FPS setting and machine speed.
  , sdisableAutoYes   :: Bool
      -- ^ Never auto-answer all prompts, even if under AI control.
  , snoAnim           :: Maybe Bool
      -- ^ Don't show any animations.
  , snewGameCli       :: Bool
      -- ^ Start a new game, overwriting the save file.
  , sbenchmark        :: Bool
      -- ^ Don't create directories and files and show time stats.
  , sbenchMessages    :: Bool
      -- ^ Display messages in realistic was under AI control (e.g., for benchmarking).
  , stitle            :: Maybe String
  , ssavePrefixCli    :: String
      -- ^ Prefix of the save game file name.
  , sfrontendANSI     :: Bool
      -- ^ Whether to use the ANSI frontend.
  , sfrontendTeletype :: Bool
      -- ^ Whether to use the stdout/stdin frontend.
  , sfrontendNull     :: Bool
      -- ^ Whether to use null (no input/output) frontend.
  , sfrontendLazy     :: Bool
      -- ^ Whether to use lazy (output not even calculated) frontend.
  , sdbgMsgCli        :: Bool
      -- ^ Show clients' internal debug messages.
  , sstopAfterSeconds :: Maybe Int
  , sstopAfterFrames  :: Maybe Int
  , sprintEachScreen  :: Bool
  , sexposePlaces     :: Bool
  , sexposeItems      :: Bool
  , sexposeActors     :: Bool
  }
  deriving (Show, Eq, Generic)

instance Binary ClientOptions

-- | Default value of client options.
defClientOptions :: ClientOptions
defClientOptions = ClientOptions
  { schosenFontset = Nothing
  , sallFontsScale = Nothing
  , sfonts = []
  , sfontsets = []
  , sfullscreenMode = Nothing
  , slogPriority = Nothing
  , smaxFps = Nothing
  , sdisableAutoYes = False
  , snoAnim = Nothing
  , snewGameCli = False
  , sbenchmark = False
  , sbenchMessages = False
  , stitle = Nothing
  , ssavePrefixCli = ""
  , sfrontendANSI = False
  , sfrontendTeletype = False
  , sfrontendNull = False
  , sfrontendLazy = False
  , sdbgMsgCli = False
  , sstopAfterSeconds = Nothing
  , sstopAfterFrames = Nothing
  , sprintEachScreen = False
  , sexposePlaces = False
  , sexposeItems = False
  , sexposeActors = False
  }