Show
Ignore:
Timestamp:
10/08/08 07:34:08 (3 months ago)
Author:
mokehehe
Message:

キー入力処理変更
Sキーでスクリーンショットを取れるように

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/haskell/nario/Main.hs

    r20925 r20943  
    8686 
    8787 
    88 -- キー入力を処理して描画コマンドを返す 
     88-- キー入力全体を処理して描画コマンド列を返す 
    8989process :: [[SDLKey]] -> IO [Scr] 
    9090process kss = do 
     
    9393 
    9494        let tmpscrs = doTitle fldmap kss 
    95  
    96         let scrs = map (\scr sur -> scr imgres sur >> flipSurface sur >> return ()) $ tmpscrs 
    97         return $ scrs ++ [(\sur -> do {releaseImageResource imgres})] 
    98  
     95        let scrs = zipWith (common imgres) tmpscrs kss 
     96        return $ scrs ++ [final imgres] 
     97 
     98        where 
     99                -- 共通動作 
     100                common imgres scr ks sur = do 
     101                        scr imgres sur 
     102                        if SDLK_s `elem` ks 
     103                                then saveBMP sur "ss.bmp" >> return () 
     104                                else return () 
     105                        flipSurface sur 
     106                        return () 
     107                -- 後始末 
     108                final imgres sur = releaseImageResource imgres 
    99109 
    100110-- タイトル 
     
    172182                -- 更新 
    173183                updateProc :: KeyProc -> GameGame -> (ImageResource -> Scr, GameGame) 
    174                 updateProc kp gs = (renderProc gs', gs') 
     184                updateProc kp gs = (scr', gs') 
    175185                        where 
    176186                                time' = max 0 (time gs - 1) 
     
    186196                                gstmp = gs { pl = pl'', fld = fld', actors = actors'', time = time' } 
    187197                                gs' = procEvent gstmp (plev ++ ev' ++ screv' ++ ev'') 
     198                                scr' = renderProc gs' 
    188199 
    189200                initialState = GameGame { pl = newPlayer, fld = fldmap, actors = [], time = 400 * timeBase }