module Texture (textureSet) where import Graphics.Rendering.OpenGL import Graphics.UI.GLUT import Foreign import Data.Maybe import Data.Bitmap.IO import Data.Bitmap.OpenGL import Codec.Image.STB import System.Exit import Data.IORef import States import qualified Data.Map as Map ------テクスチャグループのセット textureSet :: (IORef TexObjGrp) -> IO () textureSet tObjs = do let fname00 = "./images/gboard.png" fname10 = "./images/stone_1.png" fname11 = "./images/stone_2.png" texObj00 <- setTexObj fname00 texObj10 <- setTexObj fname10 texObj11 <- setTexObj fname11 tObjs $= Map.fromList [(KeyTexStone , [texObj10 , texObj11]) , (KeyTexGameBoard , [texObj00])] setTexObj :: FilePath -> (IO TextureObject) setTexObj fname = do teximg <- loadImage fname >>= \result -> case result of Left err -> putStrLn err >> exitFailure Right img -> return img texObj <- makeSimpleBitmapTexture teximg return texObj