Changeset 20534 for lang/haskell/nario/Main.hs
- Timestamp:
- 10/03/08 01:04:54 (3 months ago)
- Files:
-
- 1 modified
-
lang/haskell/nario/Main.hs (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/haskell/nario/Main.hs
r20453 r20534 1 {-# OPTIONS_GHC -fglasgow-exts #-} 2 1 3 -- Nario 2 4 … … 74 76 75 77 ---- 78 data ObjWrapper = forall a. Actor a => ObjWrapper a -- 存在型aの動く範囲を型クラスDuckに制限 79 80 updateActors :: [ObjWrapper] -> [(ObjWrapper, [Event])] 81 updateActors = map (\(ObjWrapper x) -> let (x', ev') = update x in (ObjWrapper x', ev')) 82 83 renderActors :: ImageResource -> Int -> Surface -> [ObjWrapper] -> IO () 84 renderActors imgres ofsx sur = mapM_ (\(ObjWrapper x) -> render x imgres ofsx sur) 76 85 77 86 … … 81 90 pl :: Player, 82 91 fld :: Field, 83 actors :: [ Actor],92 actors :: [ObjWrapper], 84 93 time :: Int 85 94 } … … 134 143 time' = max 0 (time gs - one `div` 25) 135 144 (pl', ev) = updatePlayer kp (fld gs) (pl gs) 136 actors_updates = map updateActor(actors gs)145 actors_updates = updateActors (actors gs) 137 146 actors' = map fst actors_updates 138 147 ev' = concatMap snd actors_updates … … 153 162 where 154 163 fld' = fieldSet (fld gs) cx cy '*' 155 actors' = ( newAnimBlock cx cy) : actors gs164 actors' = (ObjWrapper $ newAnimBlock cx cy) : actors gs 156 165 f gs (EvSetField cx cy c) = gs { fld = fld' } 157 166 where … … 170 179 renderPlayer sur imgres scrx (pl gs) 171 180 172 mapM_ (\act -> renderActor act imgres scrx sur)(actors gs)181 renderActors imgres scrx sur (actors gs) 173 182 return () 174 183
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)