summaryrefslogtreecommitdiffstats
path: root/src/Render.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Render.hs')
-rw-r--r--src/Render.hs21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/Render.hs b/src/Render.hs
index 839859e..ec7ae62 100644
--- a/src/Render.hs
+++ b/src/Render.hs
@@ -5,7 +5,9 @@ module Render ( setup
import Paths_htanks
import Game
+import MainLoop
import Level
+import Player
import Tank
import Texture
@@ -37,8 +39,9 @@ texturePath t = getDataFileName $ path t
path TextureTank = "tex/Tank.png"
path TextureCannon = "tex/Cannon.png"
path TextureBullet = "tex/Bullet.png"
+ path TextureCrosshair = "tex/Crosshair.png"
-getTexture :: Texture -> Game TextureObject
+getTexture :: Texture -> Main TextureObject
getTexture t = do
ts <- gets textures
let tobj = M.lookup t ts
@@ -53,7 +56,7 @@ getTexture t = do
return tex
-setup :: Game ()
+setup :: Main ()
setup = do
liftIO $ do
blend $= Enabled
@@ -64,21 +67,24 @@ setup = do
getTexture TextureTank
getTexture TextureCannon
getTexture TextureBullet
+ getTexture TextureCrosshair
return ()
-render :: Game ()
+render :: Main ()
render = do
- tanklist <- gets tanks
- bulletlist <- gets bullets
+ tanklist <- lift $ gets tanks
+ bulletlist <- lift $ gets bullets
+ playerlist <- gets players
textureWood <- getTexture TextureWood
textureTank <- getTexture TextureTank
textureCannon <- getTexture TextureCannon
textureBullet <- getTexture TextureBullet
+ textureCrosshair <- getTexture TextureCrosshair
- (lw, lh) <- gets level >>= \l -> return (fromIntegral . levelWidth $ l :: GLfloat, fromIntegral . levelHeight $ l :: GLfloat)
+ (lw, lh) <- lift $ gets level >>= \l -> return (fromIntegral . levelWidth $ l :: GLfloat, fromIntegral . levelHeight $ l :: GLfloat)
liftIO $ do
clear [ColorBuffer]
@@ -162,3 +168,6 @@ render = do
texCoord $ TexCoord2 (1 :: GLfloat) (0 :: GLfloat)
vertex $ Vertex2 (0.1 :: GLfloat) (-0.1 :: GLfloat)
+
+ textureBinding Texture2D $= Just textureCrosshair
+ forM_ playerlist renderPlayer