diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2010-03-09 02:21:39 +0100 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2010-03-09 02:21:39 +0100 |
commit | aa00912206351431e931cde0645712c3016edf70 (patch) | |
tree | d4d965b33efefd9681a550933e63848abb1d621a /Render.hs | |
parent | d3e50ab004d80943e456aee8e425f69ca3d01d5d (diff) | |
download | htanks-aa00912206351431e931cde0645712c3016edf70.tar htanks-aa00912206351431e931cde0645712c3016edf70.zip |
Get texture paths through cabal
Diffstat (limited to 'Render.hs')
-rw-r--r-- | Render.hs | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -3,6 +3,7 @@ module Render ( setup ) where +import Paths_htanks import Game import Level import Texture @@ -28,12 +29,13 @@ import Graphics.Rendering.OpenGL.GL.Texturing.Specification (TextureTarget(..)) import Graphics.Rendering.OpenGL.GL.VertexSpec -texturePath :: Texture -> String -texturePath t - | t == TextureWood = "tex/Wood.png" - | t == TextureTank = "tex/Tank.png" - | t == TextureCannon = "tex/Cannon.png" - | t == TextureBullet = "tex/Bullet.png" +texturePath :: Texture -> IO FilePath +texturePath t = getDataFileName $ path t + where + path TextureWood = "tex/Wood.png" + path TextureTank = "tex/Tank.png" + path TextureCannon = "tex/Cannon.png" + path TextureBullet = "tex/Bullet.png" getTexture :: Texture -> Game TextureObject getTexture t = do @@ -44,7 +46,8 @@ getTexture t = do then return $ fromJust tobj else do - tex <- liftIO $ pngBind (texturePath t) BuildMipmap Alpha (Repeated, Repeat) (Linear', Just Linear') Linear' >>= return . TextureObject . fromIntegral . fst + path <- liftIO $ texturePath t + tex <- liftIO $ pngBind path BuildMipmap Alpha (Repeated, Repeat) (Linear', Just Linear') Linear' >>= return . TextureObject . fromIntegral . fst modify $ \state -> state {textures = M.insert t tex ts} return tex |