Changeset 20641 for lang/haskell/nario/Main.hs
- Timestamp:
- 10/03/08 23:41:05 (3 months ago)
- Files:
-
- 1 modified
-
lang/haskell/nario/Main.hs (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/haskell/nario/Main.hs
r20534 r20641 75 75 _ -> checkSDLEvent 76 76 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)85 86 77 87 78 -- 状態 … … 144 135 (pl', ev) = updatePlayer kp (fld gs) (pl gs) 145 136 actors_updates = updateActors (actors gs) 146 actors' = map fst actors_updates137 actors' = filterActors $ map fst actors_updates 147 138 ev' = concatMap snd actors_updates 148 139 … … 159 150 procEvent gs ev = foldl f gs ev 160 151 where 161 f gs (EvHitBlock imgtype cx cy) = gs { fld = fld', actors = actors' } 162 where 152 f gs (EvHitBlock imgtype cx cy) 153 | hardBlock c = gs 154 | otherwise = gs { fld = fld', actors = actors' } 155 where 156 c = fieldRef (fld gs) cx cy 157 actors' = actors gs ++ [ObjWrapper $ newAnimBlock cx cy $ fieldRef (fld gs) cx cy] 163 158 fld' = fieldSet (fld gs) cx cy '*' 164 actors' = (ObjWrapper $ newAnimBlock cx cy) : actors gs165 159 f gs (EvSetField cx cy c) = gs { fld = fld' } 166 160 where … … 189 183 renderInfo :: GameGame -> ImageResource -> Scr 190 184 renderInfo gs imgres sur = do 191 puts 3 1 " MARIO"185 puts 3 1 "NARIO" 192 186 puts 3 2 $ deciWide 6 '0' $ getPlayerScore (pl gs) 193 187 puts 11 2 ("?*" ++ deciWide 2 '0' (getPlayerMedal (pl gs)))
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)