Changeset 20670 for lang/haskell/nario/Actor.hs
- Timestamp:
- 10/04/08 13:02:36 (3 months ago)
- Files:
-
- 1 modified
-
lang/haskell/nario/Actor.hs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/haskell/nario/Actor.hs
r20661 r20670 2 2 3 3 module Actor ( 4 Actor (..),5 ObjWrapper (..),4 Actor(..), 5 ObjWrapper(..), 6 6 updateActors, 7 7 filterActors, … … 13 13 import Event 14 14 import AppUtil 15 import Field 15 16 16 17 17 18 class Actor a where 18 update :: a -> (a, [Event])19 update :: Field -> a -> (a, [Event]) 19 20 render :: a -> ImageResource -> Int -> Surface -> IO () 20 21 bDead :: a -> Bool 21 22 bDead _ = False 22 23 23 24 -- ============================================================================ … … 26 27 data ObjWrapper = forall a. Actor a => ObjWrapper a -- 存在型aの動く範囲を型クラスに制限 27 28 28 updateActors :: [ObjWrapper] -> [(ObjWrapper, [Event])]29 updateActors = map (\(ObjWrapper x) -> let (x', ev') = updatex in (ObjWrapper x', ev'))29 updateActors :: Field -> [ObjWrapper] -> [(ObjWrapper, [Event])] 30 updateActors fld = map (\(ObjWrapper x) -> let (x', ev') = update fld x in (ObjWrapper x', ev')) 30 31 31 32 filterActors :: [ObjWrapper] -> [ObjWrapper]
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)