diff --git a/src/EventHandler.hs b/src/EventHandler.hs index 3d9aceb..614e581 100644 --- a/src/EventHandler.hs +++ b/src/EventHandler.hs @@ -1,7 +1,11 @@ module EventHandler where +import Control.Monad (when) + import Control.Concurrent.MVar +import Control.Lens as Lens + import Linear import qualified SDL @@ -39,7 +43,7 @@ moveQuad proj view model evs = SDL.KeycodeX -> V3 1 0 0 SDL.KeycodeY -> - V3 0 1 0 + V3 0 (-1) 0 _ -> V3 0 0 0 ) @@ -47,22 +51,15 @@ moveQuad proj view model evs = !-! (identity :: M44 GL.GLfloat) in acc !+! trans - _ -> acc !+! - (V4 - (V4 0 0 0 0) - (V4 0 0 0 0) - (V4 0 0 0 0) - (V4 0 0 0 0) - ) + _ -> acc ) - (V4 - (V4 0 0 0 0) - (V4 0 0 0 0) - (V4 0 0 0 0) - (V4 0 0 0 0) - ) + zero <$> readMVar evs - return $ mmodel !+! plusModel + let retval = mmodel !+! plusModel + when (not $ plusModel == zero) $ + print ("Current Position of object: " <> + show (Lens.view translation $ retval)) + return retval ) return mview )