Added player cursor

This commit is contained in:
Matthias Schiffer 2010-04-10 14:17:08 +02:00
parent 083619cc87
commit 546da85814
8 changed files with 60 additions and 31 deletions

View file

@ -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