readability, executional verbosity and correction of y direction

This commit is contained in:
nek0 2020-08-10 12:50:29 +02:00
parent 31976ff185
commit c27d0a72e3

View file

@ -1,7 +1,11 @@
module EventHandler where module EventHandler where
import Control.Monad (when)
import Control.Concurrent.MVar import Control.Concurrent.MVar
import Control.Lens as Lens
import Linear import Linear
import qualified SDL import qualified SDL
@ -39,7 +43,7 @@ moveQuad proj view model evs =
SDL.KeycodeX -> SDL.KeycodeX ->
V3 1 0 0 V3 1 0 0
SDL.KeycodeY -> SDL.KeycodeY ->
V3 0 1 0 V3 0 (-1) 0
_ -> _ ->
V3 0 0 0 V3 0 0 0
) )
@ -47,22 +51,15 @@ moveQuad proj view model evs =
!-! !-!
(identity :: M44 GL.GLfloat) (identity :: M44 GL.GLfloat)
in acc !+! trans in acc !+! trans
_ -> acc !+! _ -> acc
(V4
(V4 0 0 0 0)
(V4 0 0 0 0)
(V4 0 0 0 0)
(V4 0 0 0 0)
)
) )
(V4 zero
(V4 0 0 0 0)
(V4 0 0 0 0)
(V4 0 0 0 0)
(V4 0 0 0 0)
)
<$> readMVar evs <$> 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 return mview
) )