diff options
Diffstat (limited to 'GLX.hs')
-rw-r--r-- | GLX.hs | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -138,6 +138,10 @@ handleEvent glx xevent = do | keysym == xK_Down -> return (glx, Just $ SomeEvent $ KeyPressEvent KeyDown) | keysym == xK_Left -> return (glx, Just $ SomeEvent $ KeyPressEvent KeyLeft) | keysym == xK_Right -> return (glx, Just $ SomeEvent $ KeyPressEvent KeyRight) + | keysym == xK_w -> return (glx, Just $ SomeEvent $ KeyPressEvent KeyUp) + | keysym == xK_s -> return (glx, Just $ SomeEvent $ KeyPressEvent KeyDown) + | keysym == xK_a -> return (glx, Just $ SomeEvent $ KeyPressEvent KeyLeft) + | keysym == xK_d -> return (glx, Just $ SomeEvent $ KeyPressEvent KeyRight) | otherwise -> return (glx, Nothing) | evtype == keyRelease -> do keysym <- keycodeToKeysym (glxDisplay glx) (ev_keycode event) 0 @@ -146,6 +150,10 @@ handleEvent glx xevent = do | keysym == xK_Down -> return (glx, Just $ SomeEvent $ KeyReleaseEvent KeyDown) | keysym == xK_Left -> return (glx, Just $ SomeEvent $ KeyReleaseEvent KeyLeft) | keysym == xK_Right -> return (glx, Just $ SomeEvent $ KeyReleaseEvent KeyRight) + | keysym == xK_w -> return (glx, Just $ SomeEvent $ KeyReleaseEvent KeyUp) + | keysym == xK_s -> return (glx, Just $ SomeEvent $ KeyReleaseEvent KeyDown) + | keysym == xK_a -> return (glx, Just $ SomeEvent $ KeyReleaseEvent KeyLeft) + | keysym == xK_d -> return (glx, Just $ SomeEvent $ KeyReleaseEvent KeyRight) | otherwise -> return (glx, Nothing) | evtype == clientMessage -> do if ((glxDeleteWindow glx) == (fromIntegral . head . ev_data $ event)) @@ -162,7 +170,7 @@ handleEvent glx xevent = do s = fromRational . glxScale $ glx lw = fromIntegral . glxLevelWidth $ glx lh = fromIntegral . glxLevelHeight $ glx - return (glx, Just $ SomeEvent $ MouseMotionEvent ((w/2+x)/s - lw/2) ((h/2-y)/s + lh/2)) + return (glx, Just $ SomeEvent $ MouseMotionEvent ((-w/2+x)/s + lw/2) ((h/2-y)/s + lh/2)) | otherwise -> return (glx, Nothing) |