Add graphics menu options
This commit is contained in:
@@ -19,45 +19,37 @@ menuScreen
|
||||
-> Picture
|
||||
menuScreen cfig hw hh mLays = case mLays of
|
||||
[] -> blank
|
||||
(LevelMenu x:_) -> pictures
|
||||
[color (withAlpha 0.5 black) $ polygon $ screenBox hw hh
|
||||
,tst (-100) 100 0.4 ("LEVEL "++show x)
|
||||
(LevelMenu x:_) -> optionsList hw hh ("LEVEL"++show x) []
|
||||
(PauseMenu:_) -> optionsList hw hh "PAUSED"
|
||||
["n - NEW LEVEL"
|
||||
,"r - RESTART"
|
||||
,"o - OPTIONS"
|
||||
,"c - CONTROLS"
|
||||
]
|
||||
(PauseMenu:_) -> pictures
|
||||
[color (withAlpha 0.5 black) $ polygon $ screenBox hw hh
|
||||
,tst (-100) 100 0.4 "PAUSED"
|
||||
,tst (-100) 50 0.2 "n - new level"
|
||||
,tst (-100) 0 0.2 "r - restart"
|
||||
,tst (-100) (-50) 0.2 "o - options"
|
||||
,tst (-100) (-100) 0.2 "c - controls"
|
||||
(GameOverMenu:_) -> optionsList hw hh "GAME OVER"
|
||||
["n - NEW LEVEL"
|
||||
,"r - RESTART"
|
||||
,"o - OPTIONS"
|
||||
,"c - CONTROLS"
|
||||
]
|
||||
(GameOverMenu:_) -> pictures
|
||||
[color (withAlpha 0.5 black) $ polygon $ screenBox hw hh
|
||||
,tst (-100) 100 0.4 "GAME OVER"
|
||||
,tst (-100) 50 0.2 "n - new level"
|
||||
,tst (-100) 0 0.2 "r - restart"
|
||||
,tst (-100) (-50) 0.2 "o - options"
|
||||
,tst (-100) (-100) 0.2 "c - controls"
|
||||
(OptionMenu : _) -> optionsList hw hh "OPTIONS"
|
||||
["v - VOLUME"
|
||||
,"g - GRAPHICS"
|
||||
]
|
||||
(OptionMenu : _) -> pictures
|
||||
[color (withAlpha 0.5 black) $ polygon $ screenBox hw hh
|
||||
,tst (-100) 100 0.4 "OPTIONS"
|
||||
,tst (-180) 50 0.2 $ "y - master volume + u : " ++ mavol
|
||||
,tst (-180) 0 0.2 $ "h - sound volume + j : " ++ snvol
|
||||
,tst (-180) (-50) 0.2 $ "n - music volume + m : " ++ muvol
|
||||
(SoundOptionMenu : _) -> optionsList hw hh "OPTIONS:VOLUME"
|
||||
["y - MASTER VOLUME + u : " ++ mavol
|
||||
,"h - SOUND VOLUME + j : " ++ snvol
|
||||
,"n - MUSIC VOLUME + m : " ++ muvol
|
||||
]
|
||||
(GraphicsOptionMenu : _) -> optionsList hw hh "OPTIONS:GRAPHICS"
|
||||
["w - WALL TEXTURES"
|
||||
]
|
||||
(ControlList : _) -> pictures
|
||||
[color (withAlpha 0.5 black) $ polygon $ screenBox hw hh
|
||||
,tst (-100) 100 0.4 "CONTROLS"
|
||||
,controlsList
|
||||
]
|
||||
(ConfigSaveScreen : _) -> pictures
|
||||
[color (withAlpha 0.5 black) $ polygon $ screenBox hw hh
|
||||
,tst (-100) 100 0.4 "OPTIONS"
|
||||
,tst (-180) 50 0.2 $ "y - master volume + u : " ++ mavol
|
||||
,tst (-180) 0 0.2 $ "h - sound volume + j : " ++ snvol
|
||||
,tst (-180) (-50) 0.2 $ "n - music volume + m : " ++ muvol
|
||||
]
|
||||
(ConfigSaveScreen : _) -> optionsList hw hh "SAVING..." []
|
||||
_ -> blank
|
||||
where
|
||||
tst x y sc t = translate x y $ scale sc sc $ color white $ text t
|
||||
@@ -66,6 +58,20 @@ menuScreen cfig hw hh mLays = case mLays of
|
||||
muvol = f $ _volume_music $ cfig
|
||||
f x = show $ round $ 10 * x
|
||||
|
||||
optionsList
|
||||
:: Float -- ^ Half screen width
|
||||
-> Float -- ^ Half screen height
|
||||
-> String -- ^ Title
|
||||
-> [String] -- ^ Options
|
||||
-> Picture
|
||||
optionsList hw hh tit ops = pictures $
|
||||
[color (withAlpha 0.5 black) $ polygon $ screenBox hw hh
|
||||
,placeString (-hw + 30) (hh - 50) 0.4 tit]
|
||||
++
|
||||
zipWith (\ s vpos -> placeString (-hw + 50) vpos 0.2 s) ops [hh-100,hh-150 ..]
|
||||
where
|
||||
placeString x y sc t = translate x y $ scale sc sc $ color white $ text t
|
||||
|
||||
controlsList = pictures $ concat $ zipWith butAndEff
|
||||
[("wasd", "movement")
|
||||
,("[rmb]", "aim")
|
||||
@@ -85,8 +91,8 @@ controlsList = pictures $ concat $ zipWith butAndEff
|
||||
]
|
||||
|
||||
screenBox
|
||||
:: Float
|
||||
-> Float
|
||||
:: Float -- ^ Half screen width
|
||||
-> Float -- ^ Half screen height
|
||||
-> [(Float,Float)]
|
||||
screenBox halfW halfH =
|
||||
[ (halfW, halfH)
|
||||
|
||||
Reference in New Issue
Block a user