#4 Setup interaction
This commit is contained in:
parent
ef784c2dbc
commit
9addf1ed07
13 changed files with 223 additions and 33 deletions
26
lib/RPGEngine/Render/ActionSelection.hs
Normal file
26
lib/RPGEngine/Render/ActionSelection.hs
Normal file
|
@ -0,0 +1,26 @@
|
|||
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
|
Reference in a new issue