Separate out concrete part of world
This commit is contained in:
@@ -9,8 +9,8 @@ doButtonEvent :: ButtonEvent -> Button -> World -> World
|
||||
doButtonEvent be = case be of
|
||||
ButtonDoNothing -> const id
|
||||
ButtonPress newstate newevent thesound f -> \b -> doWorldEffect f
|
||||
. set (buttons . ix (_btID b) . btState) newstate
|
||||
. set (buttons . ix (_btID b) . btEvent) newevent
|
||||
. set (cWorld . buttons . ix (_btID b) . btState) newstate
|
||||
. set (cWorld . buttons . ix (_btID b) . btEvent) newevent
|
||||
. soundStart (LeverSound 0) (_btPos b) thesound Nothing
|
||||
--ButtonSwitch onstate onevent onsound oneff offstate offevent offsound offeff -> undefined
|
||||
ButtonSimpleSwith oneff offeff -> flipSwitch oneff offeff
|
||||
@@ -19,9 +19,9 @@ doButtonEvent be = case be of
|
||||
flipSwitch :: WdWd -> WdWd -> Button -> World -> World
|
||||
flipSwitch oneff offeff bt
|
||||
| _btState bt == BtOff = doWorldEffect oneff . dosound
|
||||
. over (buttons . ix (_btID bt)) turnon
|
||||
. over (cWorld . buttons . ix (_btID bt)) turnon
|
||||
| otherwise = doWorldEffect offeff . dosound
|
||||
. over (buttons . ix (_btID bt)) turnoff
|
||||
. over (cWorld . buttons . ix (_btID bt)) turnoff
|
||||
where
|
||||
turnon = (btState .~ BtOn ) . (btText .~ "SWITCH\\")
|
||||
turnoff = (btState .~ BtOff) . (btText .~ "SWITCH/")
|
||||
|
||||
Reference in New Issue
Block a user