26 lines
No EOL
1.2 KiB
Haskell
26 lines
No EOL
1.2 KiB
Haskell
module RPGEngine.Render.ActionSelection
|
|
( renderActionSelection
|
|
) where
|
|
|
|
import RPGEngine.Data (State (..), Action (..))
|
|
import Graphics.Gloss
|
|
( Picture, text, pictures, translate, scale, color )
|
|
import Graphics.Gloss.Data.Picture (blank)
|
|
import RPGEngine.Data.Level (getActionText)
|
|
import RPGEngine.Config (uizoom, selectionColor, textColor)
|
|
import RPGEngine.Input.Core (ListSelector(selection))
|
|
import RPGEngine.Render.Playing (renderPlaying)
|
|
import RPGEngine.Render.Core (overlay)
|
|
|
|
------------------------------ Exported ------------------------------
|
|
|
|
renderActionSelection :: State -> Picture
|
|
renderActionSelection (ActionSelection list selector continue) = everything
|
|
where numberedTexts = zip [0::Int ..] $ map getActionText list
|
|
sel = selection selector
|
|
everything = pictures $ [renderPlaying continue, overlay] ++ map render numberedTexts
|
|
render (i, t) | i == sel = color selectionColor $ make (i, t)
|
|
| otherwise = color textColor $ make (i, t)
|
|
make (i, t) = scale uizoom uizoom $ translate 0 (offset i) $ text t
|
|
offset i = negate (250 * uizoom * fromIntegral i)
|
|
renderActionSelection _ = blank |