Rename shaders, remove a dependency on Dodge.Data
This commit is contained in:
@@ -1,22 +1,30 @@
|
||||
{-
|
||||
The menu picture.
|
||||
-}
|
||||
module Dodge.Render.MenuScreen
|
||||
( menuScreen
|
||||
)
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.Data.Menu
|
||||
import Dodge.Config.Update
|
||||
import Dodge.Config.Data
|
||||
import Dodge.Base (halfWidth,halfHeight)
|
||||
import Picture
|
||||
|
||||
menuScreen :: World -> Picture
|
||||
menuScreen w = case _menuLayers w of
|
||||
menuScreen
|
||||
:: Configuration
|
||||
-> Float -- Half width of screen
|
||||
-> Float -- Half height of screen
|
||||
-> [MenuLayer]
|
||||
-> Picture
|
||||
menuScreen cfig hw hh mLays = case mLays of
|
||||
[] -> blank
|
||||
(LevelMenu x:_) -> pictures
|
||||
[color (withAlpha 0.5 black) $ polygon $ screenBox w
|
||||
[color (withAlpha 0.5 black) $ polygon $ screenBox hw hh
|
||||
,tst (-100) 100 0.4 ("LEVEL "++show x)
|
||||
]
|
||||
(PauseMenu:_) -> pictures
|
||||
[color (withAlpha 0.5 black) $ polygon $ screenBox w
|
||||
[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"
|
||||
@@ -24,7 +32,7 @@ menuScreen w = case _menuLayers w of
|
||||
,tst (-100) (-100) 0.2 "c - controls"
|
||||
]
|
||||
(GameOverMenu:_) -> pictures
|
||||
[color (withAlpha 0.5 black) $ polygon $ screenBox w
|
||||
[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"
|
||||
@@ -32,19 +40,19 @@ menuScreen w = case _menuLayers w of
|
||||
,tst (-100) (-100) 0.2 "c - controls"
|
||||
]
|
||||
(OptionMenu : _) -> pictures
|
||||
[color (withAlpha 0.5 black) $ polygon $ screenBox w
|
||||
[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
|
||||
]
|
||||
(ControlList : _) -> pictures
|
||||
[color (withAlpha 0.5 black) $ polygon $ screenBox w
|
||||
[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 w
|
||||
[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
|
||||
@@ -53,9 +61,9 @@ menuScreen w = case _menuLayers w of
|
||||
_ -> blank
|
||||
where
|
||||
tst x y sc t = translate x y $ scale sc sc $ color white $ text t
|
||||
mavol = f $ _volume_master $ _config w
|
||||
snvol = f $ _volume_sound $ _config w
|
||||
muvol = f $ _volume_music $ _config w
|
||||
mavol = f $ _volume_master $ cfig
|
||||
snvol = f $ _volume_sound $ cfig
|
||||
muvol = f $ _volume_music $ cfig
|
||||
f x = show $ round $ 10 * x
|
||||
|
||||
controlsList = pictures $ concat $ zipWith butAndEff
|
||||
@@ -76,9 +84,14 @@ controlsList = pictures $ concat $ zipWith butAndEff
|
||||
,translate 0 y $ scale 0.15 0.15 $ color white $ text etext
|
||||
]
|
||||
|
||||
screenBox w = [ (halfWidth w, halfHeight w)
|
||||
, (-halfWidth w, halfHeight w)
|
||||
, (-halfWidth w,-halfHeight w)
|
||||
, ( halfWidth w,-halfHeight w)
|
||||
]
|
||||
screenBox
|
||||
:: Float
|
||||
-> Float
|
||||
-> [(Float,Float)]
|
||||
screenBox halfW halfH =
|
||||
[ (halfW, halfH)
|
||||
, (-halfW, halfH)
|
||||
, (-halfW,-halfH)
|
||||
, ( halfW,-halfH)
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user