Changeset 20174 for lang/haskell
- Timestamp:
- 09/29/08 00:06:16 (2 months ago)
- Location:
- lang/haskell/nario
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/haskell/nario/Main.hs
r20156 r20174 12 12 import Field 13 13 import Util 14 import Const 14 15 15 16 wndTitle = "delayed-stream test" … … 88 89 process :: [[SDLKey]] -> IO [Scr] 89 90 process kss = do 90 imgres <- loadImageResource 91 imgres <- loadImageResource images 91 92 st <- initialState 92 return $ map (\scr -> scr imgres) $ loop [] st kss 93 let scrs = map (\scr -> scr imgres) $ loop [] st kss 94 return $ scrs ++ [(\sur -> do {releaseImageResource imgres})] 93 95 where 94 96 loop :: [SDLKey] -> GameState -> [[SDLKey]] -> [(ImageResource -> Scr)] -
lang/haskell/nario/Util.hs
r20156 r20174 73 73 74 74 -- 画像リソース読み込み 75 loadImageResource :: IO ImageResource76 loadImageResource = mapM load images75 loadImageResource :: [ImageType] -> IO ImageResource 76 loadImageResource = mapM load 77 77 where 78 78 load imgtype = do 79 79 sur <- loadBMP $ ("data/img/" ++) $ imageFn imgtype 80 -- colorKey <- mapRGB (surfacePixelFormat sur) $ Color r g b a 81 let colorKey = 0xff00ff 82 setColorKey sur [SRCCOLORKEY] colorKey 83 return (imgtype, sur) 84 r = 255 85 g = 0 86 b = 255 87 a = 255 80 setNuki sur 81 converted <- displayFormat sur 82 freeSurface sur 83 return (imgtype, converted) 88 84 85 setNuki sur = do 86 let fmt = surfacePixelFormat sur 87 if not $ null $ pfPalette fmt 88 then setColorKey sur [SRCCOLORKEY] 0 >> return () -- パレット0番目をぬき色に 89 else return () 90 91 releaseImageResource :: ImageResource -> IO () 92 releaseImageResource = mapM_ (\(t, sur) -> freeSurface sur) 89 93 90 94 getImageSurface :: ImageResource -> ImageType -> Surface
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)