diff options
Diffstat (limited to 'Render.hs')
-rw-r--r-- | Render.hs | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -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) |