Cleanup particles slightly

This commit is contained in:
2021-09-03 17:26:21 +01:00
parent 111b86d2df
commit fd85093833
10 changed files with 64 additions and 95 deletions
+15 -16
View File
@@ -8,8 +8,8 @@ module Dodge.Render.MenuScreen
import Dodge.Data.Menu
import Dodge.Data
--import Dodge.Config.Update
import Dodge.Config.Data
--import Dodge.Base (halfWidth,halfHeight)
--import Dodge.Config.Data
import Dodge.Base.Window
import Picture
import Geometry
import Dodge.Menu
@@ -17,18 +17,15 @@ import Dodge.Menu
menuScreen
:: World
-> Configuration
-> Float -- Half width of screen
-> Float -- Half height of screen
-> [MenuLayer]
-> Picture
menuScreen w cfig hw hh mLays = case mLays of
(LevelMenu x:_) -> optionsFromList w hw hh ("LEVEL"++show x) levelMenuOptions
(PauseMenu : _) -> optionsFromList w hw hh "PAUSED" pauseMenuOptions
(GameOverMenu : _) -> optionsFromList w hw hh "GAME OVER" pauseMenuOptions
(OptionMenu : _) -> optionsFromList w hw hh "OPTIONS" optionsOptions
(SoundOptionMenu : _) -> optionsFromList w hw hh "OPTIONS:VOLUME" soundMenuOptions
(GraphicsOptionMenu : _) -> optionsFromList w hw hh "OPTIONS:GRAPHICS" graphicsMenuOptions
menuScreen w mLays = case mLays of
(LevelMenu x:_) -> optionsFromList w ("LEVEL"++show x) levelMenuOptions
(PauseMenu : _) -> optionsFromList w "PAUSED" pauseMenuOptions
(GameOverMenu : _) -> optionsFromList w "GAME OVER" pauseMenuOptions
(OptionMenu : _) -> optionsFromList w "OPTIONS" optionsOptions
(SoundOptionMenu : _) -> optionsFromList w "OPTIONS:VOLUME" soundMenuOptions
(GraphicsOptionMenu : _) -> optionsFromList w "OPTIONS:GRAPHICS" graphicsMenuOptions
(ControlList : _) -> pictures
[color (withAlpha 0.5 black) $ polygon $ screenBox hw hh
,tst (-100) 100 0.4 "CONTROLS"
@@ -40,6 +37,8 @@ menuScreen w cfig hw hh mLays = case mLays of
_ -> blank
where
tst x y sc t = translate x y $ scale sc sc $ color white $ text t
hh = halfHeight w
hw = halfWidth w
displayStringList :: Float -> Float -> [String] -> Picture
displayStringList hw hh ss = pictures
@@ -52,12 +51,10 @@ displayStringList hw hh ss = pictures
optionsFromList
:: World
-> Float -- ^ Half screen width
-> Float -- ^ Half screen height
-> String -- ^ Title
-> [MenuOption] -- ^ Options
-> Picture
optionsFromList w hw hh tit ops = pictures $
optionsFromList w title ops = pictures $
[darkenBackground
,theTitle]
++
@@ -68,7 +65,9 @@ optionsFromList w hw hh tit ops = pictures $
notInvisible _ = True
placeString x y sc t = translate x y $ scale sc sc $ color white $ text t
darkenBackground = color (withAlpha 0.5 black) $ polygon $ screenBox hw hh
theTitle = placeString (-hw + 30) (hh - 50) 0.4 tit
theTitle = placeString (-hw + 30) (hh - 50) 0.4 title
hh = halfHeight w
hw = halfWidth w
menuOptionToString :: World -> MenuOption -> String
menuOptionToString w mo@(Toggle{})
= (scodeToChar $ _moKey mo) : ':' : _moString mo w