Commit before restricting menu options
This commit is contained in:
@@ -3,6 +3,7 @@ module Dodge.Update.Input
|
||||
, doInputScreenInput
|
||||
) where
|
||||
|
||||
import Dodge.Debug.Terminal
|
||||
import Dodge.WorldPos
|
||||
import Dodge.Button.Event
|
||||
import Dodge.Inventory
|
||||
@@ -16,10 +17,12 @@ import Dodge.Data.Universe
|
||||
import SDL
|
||||
import LensHelp
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Map.Strict as M
|
||||
|
||||
doInputScreenInput :: Universe -> Universe
|
||||
doInputScreenInput u = u & uvScreenLayers . _head . scInput %~ (`T.append` thetext)
|
||||
doInputScreenInput :: T.Text -> Universe -> Universe
|
||||
doInputScreenInput s u = u & uvScreenLayers . _head . scInput %~ (`T.append` T.toUpper thetext)
|
||||
& checkBackspace
|
||||
& checkEndStatus
|
||||
where
|
||||
thetext = u ^. uvWorld . input . textInput
|
||||
checkBackspace = case u ^. uvWorld . input . pressedKeys . at ScancodeBackspace of
|
||||
@@ -27,6 +30,11 @@ doInputScreenInput u = u & uvScreenLayers . _head . scInput %~ (`T.append` thete
|
||||
Just LongPress -> f
|
||||
_ -> id
|
||||
f = uvScreenLayers . _head . scInput %~ doBackspace
|
||||
pkeys = u ^. uvWorld . input . pressedKeys
|
||||
checkEndStatus
|
||||
| ScancodeReturn `M.member` pkeys = (uvScreenLayers %~ tail) . applyTerminalString (words $ T.unpack s)
|
||||
| ScancodeEscape `M.member` pkeys = uvScreenLayers %~ tail
|
||||
| otherwise = id
|
||||
|
||||
doBackspace :: T.Text -> T.Text
|
||||
doBackspace t = case T.unsnoc t of
|
||||
|
||||
Reference in New Issue
Block a user