opengl-spacenavigator 0.1.5.2 → 0.1.5.4
raw patch · 2 files changed
+28/−17 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
@@ -1,5 +1,5 @@ name: opengl-spacenavigator-version: 0.1.5.2+version: 0.1.5.4 synopsis: Library and example for using a SpaceNavigator-compatible 3-D mouse with OpenGL description: This package contains functions for managing input from a SpaceNavigator \<<http://www.3dconnexion.com/products/spacemouse/spacenavigator.html>\>, or a 3D mouse compatible with its protocols. OpenGL callbacks are provided, along with utilities for quantizing the input from the mouse or tracking its six degrees of freedom. license: MIT@@ -13,7 +13,7 @@ stability: Stable homepage: https://bitbucket.org/bwbush/opengl-spacenavigator bug-reports: https://bwbush.atlassian.net/projects/HOGLSPNV/issues/-package-url: https://bitbucket.org/bwbush/opengl-spacenavigator/downloads/opengl-spacenavigator-0.1.4.2.tar.gz+package-url: https://bitbucket.org/bwbush/opengl-spacenavigator/downloads/opengl-spacenavigator-0.1.5.4.tar.gz extra-source-files: ReadMe.md
@@ -93,6 +93,7 @@ import Data.IORef (IORef) import Graphics.Rendering.OpenGL (MatrixComponent, SettableStateVar, Vector3(..), ($=!), ($~!), get, makeSettableStateVar, rotate, translate) import Graphics.UI.GLUT (KeyState(..), SpaceballInput(..), spaceballCallback)+import System.Info (os) import qualified Data.Binary as B (Binary(..)) @@ -173,30 +174,37 @@ interpretSpaceball (SpaceballMotion rightward upward forward) = Push {- pushRightward = fromIntegral rightward / 1000- , pushUpward = fromIntegral upward / 1000- , pushBackward = - fromIntegral forward / 1000+ pushRightward = fromIntegral rightward / 1000+ , pushUpward = fromIntegral (if reinterpret then - forward else upward ) / 1000+ , pushBackward = - fromIntegral (if reinterpret then - upward else forward ) / 1000 } interpretSpaceball (SpaceballRotation backward counterClockwise rightward) = Tilt {- tiltForward = - fromIntegral backward / 1800- , tiltClockwise = - fromIntegral counterClockwise / 1800- , tiltRightward = fromIntegral rightward / 1800+ tiltForward = - fromIntegral backward / 1800+ , tiltClockwise = - fromIntegral (if reinterpret then - rightward else counterClockwise) / 1800+ , tiltRightward = fromIntegral (if reinterpret then - counterClockwise else rightward ) / 1800 } interpretSpaceball (SpaceballButton button keyState) = Button {- buttonPress = case button of+ buttonPress = case (if reinterpret then button - 1 else button) of 0 -> ButtonLeft 1 -> ButtonRight i -> ButtonOther i- , buttonAction = case keyState of- Down -> ButtonPress- Up -> ButtonRelease+ , buttonAction = if reinterpret+ then ButtonPress -- FIXME: Darwin fails to unmarshall the key state, so we avoid reading it.+ else case keyState of+ Down -> ButtonPress+ Up -> ButtonRelease } +-- | Whether to reinterpret joystick input because of OS dependency.+reinterpret :: Bool+reinterpret = os == "darwin"++ -- | A callback for input from the SpaceNavigator 3D mouse. type SpaceNavigatorCallback a = SpaceNavigatorInput a -> IO () @@ -360,16 +368,20 @@ } track _ tracking (Button ButtonLeft action) = tracking $~!- \t ->+ \t@Track{..} -> t {- trackLeftPress = action == ButtonPress+ trackLeftPress = if reinterpret+ then not trackLeftPress -- FIXME: Darwin fails to unmarshall the key state, so we avoid reading it.+ else action == ButtonPress , trackLastPressed = Just ButtonLeft } track _ tracking (Button ButtonRight action) = tracking $~!- \t ->+ \t@Track{..} -> t {- trackRightPress = action == ButtonPress+ trackRightPress = if reinterpret+ then not trackRightPress -- FIXME: Darwin fails to unmarshall the key state, so we avoid reading it.+ else action == ButtonPress , trackLastPressed = Just ButtonRight } track _ tracking (Button b _) =@@ -378,7 +390,6 @@ t { trackLastPressed = Just b }- -- | Translate a 3-vector. translate3 :: Num a