cam now moves with height.

- cam still has NaN-Issues
This commit is contained in:
Stefan Dresselhaus
2014-05-15 15:10:10 +02:00
parent b7be183c25
commit d83c87db1d
6 changed files with 96 additions and 83 deletions

View File

@ -43,6 +43,7 @@ import Render.Render (initRendering,
import Render.Types
import UI.Callbacks
import Map.Graphics
import Map.Creation (exportedMap)
import Types
import Importer.IQM.Parser
--import Data.Attoparsec.Char8 (parseTest)
@ -53,7 +54,7 @@ import Importer.IQM.Parser
--------------------------------------------------------------------------------
testParser :: String -> IO ()
testParser a = putStrLn . show =<< parseIQM a
testParser a = print =<< parseIQM a
{-do
f <- B.readFile a
putStrLn "reading in:"
@ -85,7 +86,8 @@ main =
(SDL.Size fbWidth fbHeight) <- SDL.glGetDrawableSize window'
initRendering
--generate map vertices
glMap' <- initMapShader 4 =<< getMapBufferObject
curMap <- exportedMap
glMap' <- initMapShader 4 =<< getMapBufferObject curMap
eventQueue <- newTQueueIO :: IO (TQueue SDL.Event)
now <- getCurrentTime
--font <- TTF.openFont "fonts/ttf-04B_03B_/04B_03B_.TTF" 10
@ -125,7 +127,7 @@ main =
, _yAngle = pi/2
, _zDist = 10
, _frustum = frust
, _camObject = createFlatCam 25 25
, _camObject = createFlatCam 25 25 curMap
}
, _io = IOState
{ _clock = now
@ -153,7 +155,7 @@ main =
, _glFramebuffer = frameBuffer
}
, _game = GameState
{
{ _currentMap = curMap
}
, _ui = UIState
{ _uiHasChanged = True
@ -216,7 +218,7 @@ run = do
- 0.2 * kyrot * mults
mody y' = y' + 0.2 * kxrot * mults
- 0.2 * kyrot * multc
modify $ camera.camObject %~ (\c -> moveBy c (\(x,y) -> (modx x,mody y)))
modify $ camera.camObject %~ (\c -> moveBy c (\(x,y) -> (modx x,mody y)) (state ^. game.currentMap))
{-
--modify the state with all that happened in mt time.