summaryrefslogtreecommitdiffstats
path: root/Render.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Render.hs')
-rw-r--r--Render.hs20
1 files changed, 13 insertions, 7 deletions
diff --git a/Render.hs b/Render.hs
index 86a7ccf..b11e2ff 100644
--- a/Render.hs
+++ b/Render.hs
@@ -5,6 +5,7 @@ module Render ( setup
import Game
+import Tank
import Control.Monad.State
@@ -16,8 +17,9 @@ import Graphics.Rendering.OpenGL.GL.VertexSpec
setup :: Int -> Int -> IO ()
-setup = resize
-
+setup w h = do
+ resize w h
+
resize :: Int -> Int -> IO ()
resize w h = do
let wn = fromIntegral w
@@ -34,11 +36,15 @@ resize w h = do
render :: Game ()
-render = liftIO $ do
+render = do
+ tank <- liftM head $ gets tanks
+ let x = posx tank
+ y = posy tank
+
+ liftIO $ do
clear [ColorBuffer]
renderPrimitive Triangles $ do
- vertex $ Vertex2 (-0.5 :: GLfloat) (0.5 :: GLfloat)
- vertex $ Vertex2 (0.5 :: GLfloat) (0.5 :: GLfloat)
- vertex $ Vertex2 (0.5 :: GLfloat) (-0.5 :: GLfloat)
- \ No newline at end of file
+ vertex $ Vertex2 (x-0.5 :: GLfloat) (y+0.5 :: GLfloat)
+ vertex $ Vertex2 (x+0.5 :: GLfloat) (y+0.5 :: GLfloat)
+ vertex $ Vertex2 (x+0.5 :: GLfloat) (y-0.5 :: GLfloat)