Cleanup creature picture
This commit is contained in:
@@ -6,7 +6,7 @@ module Dodge.Event.Keyboard
|
||||
)
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.Data.Menu
|
||||
--import Dodge.Data.Menu
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.Base
|
||||
import Dodge.Creature.Action
|
||||
@@ -18,6 +18,7 @@ import Dodge.Creature.Inanimate
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import Dodge.Event.Test
|
||||
import Dodge.Event.Menu
|
||||
import Dodge.Menu
|
||||
|
||||
import SDL
|
||||
import Data.Maybe
|
||||
@@ -39,7 +40,7 @@ handleKeyboardEvent kev w = case keyboardEventKeyMotion kev of
|
||||
|
||||
handlePressedKey :: Bool -> Scancode -> World -> Maybe World
|
||||
handlePressedKey True _ w = Just w
|
||||
handlePressedKey _ ScancodeSemicolon w | not (inTerminal w) = Just $ gotoTerminal w
|
||||
handlePressedKey _ ScancodeSemicolon w = Just $ gotoTerminal w
|
||||
handlePressedKey _ scode w
|
||||
| null (_menuLayers w) = handlePressedKeyInGame scode w
|
||||
| otherwise = handlePressedKeyInMenu (head $ _menuLayers w) scode w
|
||||
@@ -67,15 +68,10 @@ toggleInv x y
|
||||
| x == y = TopInventory
|
||||
| otherwise = x
|
||||
|
||||
|
||||
inTerminal :: World -> Bool
|
||||
inTerminal w = case _menuLayers w of
|
||||
(Terminal _ : _) -> True
|
||||
_ -> False
|
||||
gotoTerminal :: World -> World
|
||||
gotoTerminal w = case _menuLayers w of
|
||||
(Terminal _ : _ ) -> w
|
||||
_ -> w & menuLayers %~ (Terminal [] :)
|
||||
(InputScreen _ : _ ) -> w
|
||||
_ -> w & menuLayers %~ (InputScreen [] :)
|
||||
|
||||
spaceAction :: World -> World
|
||||
spaceAction w = if _carteDisplay w
|
||||
@@ -89,7 +85,7 @@ spaceAction w = if _carteDisplay w
|
||||
updateTopCloseObject i w' = w' & closeActiveObjects %~ ( Right (_buttons w' IM.! i) : ) . tail
|
||||
|
||||
pauseGame :: World -> World
|
||||
pauseGame w = w {_menuLayers = [PauseMenu]}
|
||||
pauseGame w = w {_menuLayers = [pauseMenu]}
|
||||
|
||||
toggleMap :: World -> World
|
||||
toggleMap w = w & carteDisplay %~ not
|
||||
|
||||
Reference in New Issue
Block a user