HGamer3D-SFML-Binding 0.1.9 → 0.2.0
raw patch · 20 files changed
+409/−487 lines, 20 filesdep ~HGamer3D-DataPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: HGamer3D-Data
API changes (from Hackage documentation)
+ HGamer3D.Bindings.SFML.ClassListener: getDirection :: IO (Vec3)
+ HGamer3D.Bindings.SFML.ClassListener: getDirection'_ :: (Vec3Ptr) -> (IO ())
+ HGamer3D.Bindings.SFML.ClassListener: getPosition :: IO (Vec3)
+ HGamer3D.Bindings.SFML.ClassListener: getPosition'_ :: (Vec3Ptr) -> (IO ())
+ HGamer3D.Bindings.SFML.ClassSoundSource: getPosition :: HG3DClass -> IO (Vec3)
+ HGamer3D.Bindings.SFML.ClassSoundSource: getPosition'_ :: (HG3DClassPtr) -> ((Vec3Ptr) -> (IO ()))
+ HGamer3D.Bindings.SFML.StructVec3: Vector3f :: Vec3 -> Vector3f
+ HGamer3D.Bindings.SFML.StructVec3: instance Storable Vector3f
+ HGamer3D.Bindings.SFML.StructVec3: newtype Vector3f
+ HGamer3D.Bindings.SFML.StructVec3: peekVec3 :: Ptr a -> IO Vec3
+ HGamer3D.Bindings.SFML.StructVec3: type Vec3Ptr = Ptr (Vec3)
+ HGamer3D.Bindings.SFML.StructVec3: type Vector3fPtr = Ptr (Vector3f)
+ HGamer3D.Bindings.SFML.StructVec3: withVec3 :: Vec3 -> (Vec3Ptr -> IO b) -> IO b
Files
- HGamer3D-SFML-Binding.cabal +6/−6
- HGamer3D/Bindings/SFML/ClassJoystick.hs +11/−25
- HGamer3D/Bindings/SFML/ClassKeyboard.hs +2/−4
- HGamer3D/Bindings/SFML/ClassListener.hs +37/−22
- HGamer3D/Bindings/SFML/ClassMouse.hs +2/−4
- HGamer3D/Bindings/SFML/ClassMouseHG3D.hs +1/−2
- HGamer3D/Bindings/SFML/ClassMusic.hs +5/−11
- HGamer3D/Bindings/SFML/ClassSound.hs +17/−36
- HGamer3D/Bindings/SFML/ClassSoundBuffer.hs +11/−24
- HGamer3D/Bindings/SFML/ClassSoundSource.hs +51/−69
- HGamer3D/Bindings/SFML/ClassSoundStream.hs +16/−33
- HGamer3D/Bindings/SFML/EnumJoystickAxis.hs +8/−17
- HGamer3D/Bindings/SFML/EnumKey.hs +102/−208
- HGamer3D/Bindings/SFML/EnumMouseButton.hs +6/−13
- HGamer3D/Bindings/SFML/EnumSoundSourceStatus.hs +3/−7
- HGamer3D/Bindings/SFML/StructVec3.hs +78/−0
- include/ClassListener.h +7/−0
- include/ClassSoundSource.h +4/−0
- include/SFMLDllDefines.h +6/−6
- include/StructVec3.h +36/−0
HGamer3D-SFML-Binding.cabal view
@@ -1,5 +1,5 @@ Name: HGamer3D-SFML-Binding -Version: 0.1.9 +Version: 0.2.0 Synopsis: Windows Game Engine for the Haskell Programmer - SFML Bindings Description: HGamer3D is a game engine for developing 3D games in the programming @@ -15,15 +15,15 @@ Author: Peter Althainz Maintainer: althainz@gmail.com Build-Type: Simple -Cabal-Version: >=1.2 +Cabal-Version: >=1.4 Homepage: http://www.hgamer3d.org -Category: Game -Extra-source-files: Setup.hs, include/ClassJoystick.h, include/ClassKeyboard.h, include/ClassListener.h, include/ClassMouse.h, include/ClassMouseHG3D.h, include/ClassMusic.h, include/ClassPtr.h, include/ClassSound.h, include/ClassSoundBuffer.h, include/ClassSoundSource.h, include/ClassSoundStream.h, include/EnumJoystickAxis.h, include/EnumKey.h, include/EnumMouseButton.h, include/EnumSoundSourceStatus.h, include/SFMLDllDefines.h, include/StructHG3DClass.h +Category: Game Engine, Audio, Graphics +Extra-source-files: Setup.hs, include/ClassJoystick.h, include/ClassKeyboard.h, include/ClassListener.h, include/ClassMouse.h, include/ClassMouseHG3D.h, include/ClassMusic.h, include/ClassPtr.h, include/ClassSound.h, include/ClassSoundBuffer.h, include/ClassSoundSource.h, include/ClassSoundStream.h, include/EnumJoystickAxis.h, include/EnumKey.h, include/EnumMouseButton.h, include/EnumSoundSourceStatus.h, include/SFMLDllDefines.h, include/StructHG3DClass.h, include/StructVec3.h Library - Build-Depends: base >= 3 && < 5, HGamer3D-Data >= 0.1.9 + Build-Depends: base >= 3 && < 5, HGamer3D-Data >= 0.2.0 - Exposed-modules: HGamer3D.Bindings.SFML.Utils, HGamer3D.Bindings.SFML.ClassPtr, HGamer3D.Bindings.SFML.StructHG3DClass, HGamer3D.Bindings.SFML.EnumJoystickAxis, HGamer3D.Bindings.SFML.EnumKey, HGamer3D.Bindings.SFML.EnumMouseButton, HGamer3D.Bindings.SFML.EnumSoundSourceStatus, HGamer3D.Bindings.SFML.ClassJoystick, HGamer3D.Bindings.SFML.ClassKeyboard, HGamer3D.Bindings.SFML.ClassListener, HGamer3D.Bindings.SFML.ClassMouse, HGamer3D.Bindings.SFML.ClassMouseHG3D, HGamer3D.Bindings.SFML.ClassMusic, HGamer3D.Bindings.SFML.ClassSound, HGamer3D.Bindings.SFML.ClassSoundBuffer, HGamer3D.Bindings.SFML.ClassSoundSource, HGamer3D.Bindings.SFML.ClassSoundStream + Exposed-modules: HGamer3D.Bindings.SFML.Utils, HGamer3D.Bindings.SFML.ClassPtr, HGamer3D.Bindings.SFML.StructHG3DClass, HGamer3D.Bindings.SFML.EnumJoystickAxis, HGamer3D.Bindings.SFML.EnumKey, HGamer3D.Bindings.SFML.EnumMouseButton, HGamer3D.Bindings.SFML.EnumSoundSourceStatus, HGamer3D.Bindings.SFML.StructVec3, HGamer3D.Bindings.SFML.ClassJoystick, HGamer3D.Bindings.SFML.ClassKeyboard, HGamer3D.Bindings.SFML.ClassListener, HGamer3D.Bindings.SFML.ClassMouse, HGamer3D.Bindings.SFML.ClassMouseHG3D, HGamer3D.Bindings.SFML.ClassMusic, HGamer3D.Bindings.SFML.ClassSound, HGamer3D.Bindings.SFML.ClassSoundBuffer, HGamer3D.Bindings.SFML.ClassSoundSource, HGamer3D.Bindings.SFML.ClassSoundStream Other-modules: ghc-options:
HGamer3D/Bindings/SFML/ClassJoystick.hs view
@@ -50,10 +50,8 @@ import HGamer3D.Bindings.SFML.EnumJoystickAxis {-# LINE 43 ".\\HGamer3D\\Bindings\\SFML\\ClassJoystick.chs" #-} --- | Check if a joystick is connected. -isConnected :: Int -- ^ joystick - Index of the joystick to check - -> IO (Bool) - -- ^ return value - True if the joystick is connected, false otherwise +{- function isConnected -} +isConnected :: Int -> IO (Bool) isConnected a1 = let {a1' = fromIntegral a1} in alloca $ \a2' -> @@ -62,10 +60,8 @@ return (a2'') {-# LINE 49 ".\\HGamer3D\\Bindings\\SFML\\ClassJoystick.chs" #-} --- | Return the number of buttons supported by a joystick. - Details: If the joystick is not connected, this function returns 0. -getButtonCount :: Int -- ^ joystick - -> IO (Int) - -- ^ +{- function getButtonCount -} +getButtonCount :: Int -> IO (Int) getButtonCount a1 = let {a1' = fromIntegral a1} in alloca $ \a2' -> @@ -74,11 +70,8 @@ return (a2'') {-# LINE 54 ".\\HGamer3D\\Bindings\\SFML\\ClassJoystick.chs" #-} --- | Check if a joystick supports a given axis. - Details: If the joystick is not connected, this function returns false. -hasAxis :: Int -- ^ joystick - -> EnumJoystickAxis -- ^ axis - -> IO (Bool) - -- ^ +{- function hasAxis -} +hasAxis :: Int -> EnumJoystickAxis -> IO (Bool) hasAxis a1 a2 = let {a1' = fromIntegral a1} in let {a2' = cIntFromEnum a2} in @@ -88,11 +81,8 @@ return (a3'') {-# LINE 60 ".\\HGamer3D\\Bindings\\SFML\\ClassJoystick.chs" #-} --- | Check if a joystick button is pressed. - Details: If the joystick is not connected, this function returns false. -isButtonPressed :: Int -- ^ joystick - -> Int -- ^ button - -> IO (Bool) - -- ^ +{- function isButtonPressed -} +isButtonPressed :: Int -> Int -> IO (Bool) isButtonPressed a1 a2 = let {a1' = fromIntegral a1} in let {a2' = fromIntegral a2} in @@ -102,11 +92,8 @@ return (a3'') {-# LINE 66 ".\\HGamer3D\\Bindings\\SFML\\ClassJoystick.chs" #-} --- | Get the current position of a joystick axis. - Details: If the joystick is not connected, this function returns 0. -getAxisPosition :: Int -- ^ joystick - -> EnumJoystickAxis -- ^ axis - -> IO (Float) - -- ^ +{- function getAxisPosition -} +getAxisPosition :: Int -> EnumJoystickAxis -> IO (Float) getAxisPosition a1 a2 = let {a1' = fromIntegral a1} in let {a2' = cIntFromEnum a2} in @@ -116,9 +103,8 @@ return (a3'') {-# LINE 72 ".\\HGamer3D\\Bindings\\SFML\\ClassJoystick.chs" #-} --- | Update the states of all joysticks. - Details: This function is used internally by SFML, so you normally don't have to call it explicitely. However, you may need to call it if you have no window yet (or no window at all): in this case the joysticks states are not updated automatically. +{- function update -} update :: IO () - -- ^ update = update'_ >>= \res -> return ()
HGamer3D/Bindings/SFML/ClassKeyboard.hs view
@@ -50,10 +50,8 @@ import HGamer3D.Bindings.SFML.EnumKey {-# LINE 43 ".\\HGamer3D\\Bindings\\SFML\\ClassKeyboard.chs" #-} --- | Check if a key is pressed. -isKeyPressed :: EnumKey -- ^ key - Key to check - -> IO (Bool) - -- ^ return value - True if the key is pressed, false otherwise +{- function isKeyPressed -} +isKeyPressed :: EnumKey -> IO (Bool) isKeyPressed a1 = let {a1' = cIntFromEnum a1} in alloca $ \a2' ->
HGamer3D/Bindings/SFML/ClassListener.hs view
@@ -47,56 +47,65 @@ {-# LINE 41 ".\\HGamer3D\\Bindings\\SFML\\ClassListener.chs" #-} import HGamer3D.Bindings.SFML.StructHG3DClass {-# LINE 42 ".\\HGamer3D\\Bindings\\SFML\\ClassListener.chs" #-} +import HGamer3D.Bindings.SFML.StructVec3 +{-# LINE 43 ".\\HGamer3D\\Bindings\\SFML\\ClassListener.chs" #-} --- | Change the global volume of all the sounds and musics. - Details: The volume is a number between 0 and 100; it is combined with the individual volume of each sound / music. The default value for the volume is 100 (maximum). -setGlobalVolume :: Float -- ^ volume - -> IO () - -- ^ +{- function setGlobalVolume -} +setGlobalVolume :: Float -> IO () setGlobalVolume a1 = let {a1' = realToFrac a1} in setGlobalVolume'_ a1' >>= \res -> return () -{-# LINE 47 ".\\HGamer3D\\Bindings\\SFML\\ClassListener.chs" #-} +{-# LINE 48 ".\\HGamer3D\\Bindings\\SFML\\ClassListener.chs" #-} --- | Get the current value of the global volume. - Details: setGlobalVolume +{- function getGlobalVolume -} getGlobalVolume :: IO (Float) - -- ^ return value - Current global volume, in the range [0, 100] getGlobalVolume = alloca $ \a1' -> getGlobalVolume'_ a1' >>= \res -> peekFloatConv a1'>>= \a1'' -> return (a1'') -{-# LINE 51 ".\\HGamer3D\\Bindings\\SFML\\ClassListener.chs" #-} +{-# LINE 52 ".\\HGamer3D\\Bindings\\SFML\\ClassListener.chs" #-} --- | Set the position of the listener in the scene. - Details: The default listener's position is (0, 0, 0). -setPosition :: Float -- ^ x - -> Float -- ^ y - -> Float -- ^ z - -> IO () - -- ^ +{- function setPosition -} +setPosition :: Float -> Float -> Float -> IO () setPosition a1 a2 a3 = let {a1' = realToFrac a1} in let {a2' = realToFrac a2} in let {a3' = realToFrac a3} in setPosition'_ a1' a2' a3' >>= \res -> return () -{-# LINE 57 ".\\HGamer3D\\Bindings\\SFML\\ClassListener.chs" #-} +{-# LINE 58 ".\\HGamer3D\\Bindings\\SFML\\ClassListener.chs" #-} --- | Set the orientation of the listener in the scene. - Details: The orientation defines the 3D axes of the listener (left, up, front) in the scene. The orientation vector doesn't have to be normalized. The default listener's orientation is (0, 0, -1). -setDirection :: Float -- ^ x - -> Float -- ^ y - -> Float -- ^ z - -> IO () - -- ^ +{- function getPosition -} +getPosition :: IO (Vec3) +getPosition = + alloca $ \a1' -> + getPosition'_ a1' >>= \res -> + peekVec3 a1'>>= \a1'' -> + return (a1'') +{-# LINE 62 ".\\HGamer3D\\Bindings\\SFML\\ClassListener.chs" #-} + +{- function setDirection -} +setDirection :: Float -> Float -> Float -> IO () setDirection a1 a2 a3 = let {a1' = realToFrac a1} in let {a2' = realToFrac a2} in let {a3' = realToFrac a3} in setDirection'_ a1' a2' a3' >>= \res -> return () -{-# LINE 63 ".\\HGamer3D\\Bindings\\SFML\\ClassListener.chs" #-} +{-# LINE 68 ".\\HGamer3D\\Bindings\\SFML\\ClassListener.chs" #-} +{- function getDirection -} +getDirection :: IO (Vec3) +getDirection = + alloca $ \a1' -> + getDirection'_ a1' >>= \res -> + peekVec3 a1'>>= \a1'' -> + return (a1'') +{-# LINE 72 ".\\HGamer3D\\Bindings\\SFML\\ClassListener.chs" #-} + foreign import ccall safe "HGamer3D\\Bindings\\SFML\\ClassListener.chs.h sfml_lst_setGlobalVolume" setGlobalVolume'_ :: (CFloat -> (IO ())) @@ -106,5 +115,11 @@ foreign import ccall safe "HGamer3D\\Bindings\\SFML\\ClassListener.chs.h sfml_lst_setPosition" setPosition'_ :: (CFloat -> (CFloat -> (CFloat -> (IO ())))) +foreign import ccall safe "HGamer3D\\Bindings\\SFML\\ClassListener.chs.h sfml_lst_getPosition" + getPosition'_ :: ((Vec3Ptr) -> (IO ())) + foreign import ccall safe "HGamer3D\\Bindings\\SFML\\ClassListener.chs.h sfml_lst_setDirection" setDirection'_ :: (CFloat -> (CFloat -> (CFloat -> (IO ())))) + +foreign import ccall safe "HGamer3D\\Bindings\\SFML\\ClassListener.chs.h sfml_lst_getDirection" + getDirection'_ :: ((Vec3Ptr) -> (IO ()))
HGamer3D/Bindings/SFML/ClassMouse.hs view
@@ -50,10 +50,8 @@ import HGamer3D.Bindings.SFML.EnumMouseButton {-# LINE 43 ".\\HGamer3D\\Bindings\\SFML\\ClassMouse.chs" #-} --- | Check if a mouse button is pressed. -isButtonPressed :: EnumMouseButton -- ^ button - Button to check - -> IO (Bool) - -- ^ return value - True if the button is pressed, false otherwise +{- function isButtonPressed -} +isButtonPressed :: EnumMouseButton -> IO (Bool) isButtonPressed a1 = let {a1' = cIntFromEnum a1} in alloca $ \a2' ->
HGamer3D/Bindings/SFML/ClassMouseHG3D.hs view
@@ -48,9 +48,8 @@ import HGamer3D.Bindings.SFML.StructHG3DClass {-# LINE 42 ".\\HGamer3D\\Bindings\\SFML\\ClassMouseHG3D.chs" #-} --- | +{- function getPosition -} getPosition :: IO (Int, Int) - -- ^ x getPosition = alloca $ \a1' -> alloca $ \a2' ->
HGamer3D/Bindings/SFML/ClassMusic.hs view
@@ -48,9 +48,8 @@ import HGamer3D.Bindings.SFML.StructHG3DClass {-# LINE 42 ".\\HGamer3D\\Bindings\\SFML\\ClassMusic.chs" #-} --- | Default constructor. +{- function Music -} new :: IO (HG3DClass) - -- ^ new = alloca $ \a1' -> new'_ a1' >>= \res -> @@ -58,21 +57,16 @@ return (a1'') {-# LINE 47 ".\\HGamer3D\\Bindings\\SFML\\ClassMusic.chs" #-} --- | Destructor. -delete :: HG3DClass -- ^ classpointer - pointer of Class instance which is going to be deleted. - -> IO () - -- ^ +{- function ~Music -} +delete :: HG3DClass -> IO () delete a1 = withHG3DClass a1 $ \a1' -> delete'_ a1' >>= \res -> return () {-# LINE 51 ".\\HGamer3D\\Bindings\\SFML\\ClassMusic.chs" #-} --- | Open a music from an audio file. - Details: This function doesn't start playing the music (call play() -openFromFile :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> String -- ^ filename - -> IO (Bool) - -- ^ +{- function openFromFile -} +openFromFile :: HG3DClass -> String -> IO (Bool) openFromFile a1 a2 = withHG3DClass a1 $ \a1' -> withCString a2 $ \a2' ->
HGamer3D/Bindings/SFML/ClassSound.hs view
@@ -48,9 +48,8 @@ import HGamer3D.Bindings.SFML.StructHG3DClass {-# LINE 42 ".\\HGamer3D\\Bindings\\SFML\\ClassSound.chs" #-} --- | Default constructor. +{- function Sound -} new :: IO (HG3DClass) - -- ^ new = alloca $ \a1' -> new'_ a1' >>= \res -> @@ -58,51 +57,40 @@ return (a1'') {-# LINE 47 ".\\HGamer3D\\Bindings\\SFML\\ClassSound.chs" #-} --- | Destructor. -delete :: HG3DClass -- ^ classpointer - pointer of Class instance which is going to be deleted. - -> IO () - -- ^ +{- function ~Sound -} +delete :: HG3DClass -> IO () delete a1 = withHG3DClass a1 $ \a1' -> delete'_ a1' >>= \res -> return () {-# LINE 51 ".\\HGamer3D\\Bindings\\SFML\\ClassSound.chs" #-} --- | Start or resume playing the sound. - Details: This function starts the stream if it was stopped, resumes it if it was paused, and restarts it from beginning if it was it already playing. This function uses its own thread so that it doesn't block the rest of the program while the sound is played. -play :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO () - -- ^ +{- function play -} +play :: HG3DClass -> IO () play a1 = withHG3DClass a1 $ \a1' -> play'_ a1' >>= \res -> return () {-# LINE 55 ".\\HGamer3D\\Bindings\\SFML\\ClassSound.chs" #-} --- | Pause the sound. - Details: This function pauses the sound if it was playing, otherwise (sound already paused or stopped) it has no effect. -pause :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO () - -- ^ +{- function pause -} +pause :: HG3DClass -> IO () pause a1 = withHG3DClass a1 $ \a1' -> pause'_ a1' >>= \res -> return () {-# LINE 59 ".\\HGamer3D\\Bindings\\SFML\\ClassSound.chs" #-} --- | Stop playing the sound. - Details: This function stops the sound if it was playing or paused, and does nothing if it was already stopped. It also resets the playing position (unlike pause() -stop :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO () - -- ^ +{- function stop -} +stop :: HG3DClass -> IO () stop a1 = withHG3DClass a1 $ \a1' -> stop'_ a1' >>= \res -> return () {-# LINE 63 ".\\HGamer3D\\Bindings\\SFML\\ClassSound.chs" #-} --- | Set the source buffer containing the audio data to play. - Details: It is important to note that the sound buffer is not copied, thus the sf::SoundBuffer -setBuffer :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> HG3DClass -- ^ buffer - -> IO () - -- ^ +{- function setBuffer -} +setBuffer :: HG3DClass -> HG3DClass -> IO () setBuffer a1 a2 = withHG3DClass a1 $ \a1' -> withHG3DClass a2 $ \a2' -> @@ -110,11 +98,8 @@ return () {-# LINE 68 ".\\HGamer3D\\Bindings\\SFML\\ClassSound.chs" #-} --- | Set whether or not the sound should loop after reaching the end. - Details: If set, the sound will restart from beginning after reaching the end and so on, until it is stopped or setLoop(false) is called. The default looping state for sound is false. -setLoop :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> Bool -- ^ loop - -> IO () - -- ^ +{- function setLoop -} +setLoop :: HG3DClass -> Bool -> IO () setLoop a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = fromBool a2} in @@ -122,10 +107,8 @@ return () {-# LINE 73 ".\\HGamer3D\\Bindings\\SFML\\ClassSound.chs" #-} --- | Tell whether or not the sound is in loop mode. - Details: setLoop -getLoop :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO (Bool) - -- ^ return value - True if the sound is looping, false otherwise +{- function getLoop -} +getLoop :: HG3DClass -> IO (Bool) getLoop a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> @@ -134,10 +117,8 @@ return (a2'') {-# LINE 78 ".\\HGamer3D\\Bindings\\SFML\\ClassSound.chs" #-} --- | Reset the internal buffer of the sound. - Details: This function is for internal use only, you don't have to use it. It is called by the sf::SoundBuffer -resetBuffer :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO () - -- ^ +{- function resetBuffer -} +resetBuffer :: HG3DClass -> IO () resetBuffer a1 = withHG3DClass a1 $ \a1' -> resetBuffer'_ a1' >>= \res ->
HGamer3D/Bindings/SFML/ClassSoundBuffer.hs view
@@ -48,9 +48,8 @@ import HGamer3D.Bindings.SFML.StructHG3DClass {-# LINE 42 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundBuffer.chs" #-} --- | Default constructor. +{- function SoundBuffer -} new :: IO (HG3DClass) - -- ^ new = alloca $ \a1' -> new'_ a1' >>= \res -> @@ -58,21 +57,16 @@ return (a1'') {-# LINE 47 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundBuffer.chs" #-} --- | Destructor. -delete :: HG3DClass -- ^ classpointer - pointer of Class instance which is going to be deleted. - -> IO () - -- ^ +{- function ~SoundBuffer -} +delete :: HG3DClass -> IO () delete a1 = withHG3DClass a1 $ \a1' -> delete'_ a1' >>= \res -> return () {-# LINE 51 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundBuffer.chs" #-} --- | Load the sound buffer from a file. - Details: Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. -loadFromFile :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> String -- ^ filename - -> IO (Bool) - -- ^ +{- function loadFromFile -} +loadFromFile :: HG3DClass -> String -> IO (Bool) loadFromFile a1 a2 = withHG3DClass a1 $ \a1' -> withCString a2 $ \a2' -> @@ -82,11 +76,8 @@ return (a3'') {-# LINE 57 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundBuffer.chs" #-} --- | Save the sound buffer to an audio file. - Details: Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. -saveToFile :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> String -- ^ filename - -> IO (Bool) - -- ^ +{- function saveToFile -} +saveToFile :: HG3DClass -> String -> IO (Bool) saveToFile a1 a2 = withHG3DClass a1 $ \a1' -> withCString a2 $ \a2' -> @@ -96,10 +87,8 @@ return (a3'') {-# LINE 63 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundBuffer.chs" #-} --- | Get the sample rate of the sound. - Details: The sample rate is the number of samples played per second. The higher, the better the quality (for example, 44100 samples/s is CD quality). -getSampleRate :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO (Int) - -- ^ +{- function getSampleRate -} +getSampleRate :: HG3DClass -> IO (Int) getSampleRate a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> @@ -108,10 +97,8 @@ return (a2'') {-# LINE 68 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundBuffer.chs" #-} --- | Get the number of channels used by the sound. - Details: If the sound is mono then the number of channels will be 1, 2 for stereo, etc. -getChannelCount :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO (Int) - -- ^ +{- function getChannelCount -} +getChannelCount :: HG3DClass -> IO (Int) getChannelCount a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' ->
HGamer3D/Bindings/SFML/ClassSoundSource.hs view
@@ -47,48 +47,37 @@ {-# LINE 41 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} import HGamer3D.Bindings.SFML.StructHG3DClass {-# LINE 42 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} +import HGamer3D.Bindings.SFML.StructVec3 +{-# LINE 43 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} --- | Destructor. -delete :: HG3DClass -- ^ classpointer - pointer of Class instance which is going to be deleted. - -> IO () - -- ^ +{- function ~SoundSource -} +delete :: HG3DClass -> IO () delete a1 = withHG3DClass a1 $ \a1' -> delete'_ a1' >>= \res -> return () -{-# LINE 47 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} +{-# LINE 48 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} --- | Set the pitch of the sound. - Details: The pitch represents the perceived fundamental frequency of a sound; thus you can make a sound more acute or grave by changing its pitch. A side effect of changing the pitch is to modify the playing speed of the sound as well. The default value for the pitch is 1. -setPitch :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> Float -- ^ pitch - -> IO () - -- ^ +{- function setPitch -} +setPitch :: HG3DClass -> Float -> IO () setPitch a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = realToFrac a2} in setPitch'_ a1' a2' >>= \res -> return () -{-# LINE 52 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} +{-# LINE 53 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} --- | Set the volume of the sound. - Details: The volume is a value between 0 (mute) and 100 (full volume). The default value for the volume is 100. -setVolume :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> Float -- ^ volume - -> IO () - -- ^ +{- function setVolume -} +setVolume :: HG3DClass -> Float -> IO () setVolume a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = realToFrac a2} in setVolume'_ a1' a2' >>= \res -> return () -{-# LINE 57 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} +{-# LINE 58 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} --- | Set the 3D position of the sound in the audio scene. - Details: Only sounds with one channel (mono sounds) can be spatialized. The default position of a sound is (0, 0, 0). -setPosition :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> Float -- ^ x - -> Float -- ^ y - -> Float -- ^ z - -> IO () - -- ^ +{- function setPosition -} +setPosition :: HG3DClass -> Float -> Float -> Float -> IO () setPosition a1 a2 a3 a4 = withHG3DClass a1 $ \a1' -> let {a2' = realToFrac a2} in @@ -96,104 +85,94 @@ let {a4' = realToFrac a4} in setPosition'_ a1' a2' a3' a4' >>= \res -> return () -{-# LINE 64 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} +{-# LINE 65 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} --- | Make the sound's position relative to the listener or absolute. - Details: Making a sound relative to the listener will ensure that it will always be played the same way regardless the position of the listener. This can be useful for non-spatialized sounds, sounds that are produced by the listener, or sounds attached to it. The default value is false (position is absolute). -setRelativeToListener :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> Bool -- ^ relative - -> IO () - -- ^ +{- function setRelativeToListener -} +setRelativeToListener :: HG3DClass -> Bool -> IO () setRelativeToListener a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = fromBool a2} in setRelativeToListener'_ a1' a2' >>= \res -> return () -{-# LINE 69 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} +{-# LINE 70 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} --- | Set the minimum distance of the sound. - Details: The "minimum distance" of a sound is the maximum distance at which it is heard at its maximum volume. Further than the minimum distance, it will start to fade out according to its attenuation factor. A value of 0 ("inside the head ---of the listener") is an invalid value and is forbidden. The default value of the minimum distance is 1. -setMinDistance :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> Float -- ^ distance - -> IO () - -- ^ +{- function setMinDistance -} +setMinDistance :: HG3DClass -> Float -> IO () setMinDistance a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = realToFrac a2} in setMinDistance'_ a1' a2' >>= \res -> return () -{-# LINE 74 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} +{-# LINE 75 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} --- | Set the attenuation factor of the sound. - Details: The attenuation is a multiplicative factor which makes the sound more or less loud according to its distance from the listener. An attenuation of 0 will produce a non-attenuated sound, i.e. its volume will always be the same whether it is heard from near or from far. On the other hand, an attenuation value such as 100 will make the sound fade out very quickly as it gets further from the listener. The default value of the attenuation is 1. -setAttenuation :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> Float -- ^ attenuation - -> IO () - -- ^ +{- function setAttenuation -} +setAttenuation :: HG3DClass -> Float -> IO () setAttenuation a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = realToFrac a2} in setAttenuation'_ a1' a2' >>= \res -> return () -{-# LINE 79 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} +{-# LINE 80 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} --- | Get the pitch of the sound. - Details: setPitch -getPitch :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO (Float) - -- ^ return value - Pitch of the sound +{- function getPitch -} +getPitch :: HG3DClass -> IO (Float) getPitch a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> getPitch'_ a1' a2' >>= \res -> peekFloatConv a2'>>= \a2'' -> return (a2'') -{-# LINE 84 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} +{-# LINE 85 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} --- | Get the volume of the sound. - Details: setVolume -getVolume :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO (Float) - -- ^ return value - Volume of the sound, in the range [0, 100] +{- function getVolume -} +getVolume :: HG3DClass -> IO (Float) getVolume a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> getVolume'_ a1' a2' >>= \res -> peekFloatConv a2'>>= \a2'' -> return (a2'') -{-# LINE 89 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} +{-# LINE 90 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} --- | Tell whether the sound's position is relative to the listener or is absolute. - Details: setRelativeToListener -isRelativeToListener :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO (Bool) - -- ^ return value - True if the position is relative, false if it's absolute +{- function getPosition -} +getPosition :: HG3DClass -> IO (Vec3) +getPosition a1 = + withHG3DClass a1 $ \a1' -> + alloca $ \a2' -> + getPosition'_ a1' a2' >>= \res -> + peekVec3 a2'>>= \a2'' -> + return (a2'') +{-# LINE 95 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} + +{- function isRelativeToListener -} +isRelativeToListener :: HG3DClass -> IO (Bool) isRelativeToListener a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> isRelativeToListener'_ a1' a2' >>= \res -> peekBoolUtil a2'>>= \a2'' -> return (a2'') -{-# LINE 94 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} +{-# LINE 100 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} --- | Get the minimum distance of the sound. - Details: setMinDistancegetAttenuation -getMinDistance :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO (Float) - -- ^ return value - Minimum distance of the sound +{- function getMinDistance -} +getMinDistance :: HG3DClass -> IO (Float) getMinDistance a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> getMinDistance'_ a1' a2' >>= \res -> peekFloatConv a2'>>= \a2'' -> return (a2'') -{-# LINE 99 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} +{-# LINE 105 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} --- | Get the attenuation factor of the sound. - Details: setAttenuationgetMinDistance -getAttenuation :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO (Float) - -- ^ return value - Attenuation factor of the sound +{- function getAttenuation -} +getAttenuation :: HG3DClass -> IO (Float) getAttenuation a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> getAttenuation'_ a1' a2' >>= \res -> peekFloatConv a2'>>= \a2'' -> return (a2'') -{-# LINE 104 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} +{-# LINE 110 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs" #-} foreign import ccall safe "HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs.h sfml_snsr_destruct" @@ -222,6 +201,9 @@ foreign import ccall safe "HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs.h sfml_snsr_getVolume" getVolume'_ :: ((HG3DClassPtr) -> ((Ptr CFloat) -> (IO ()))) + +foreign import ccall safe "HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs.h sfml_snsr_getPosition" + getPosition'_ :: ((HG3DClassPtr) -> ((Vec3Ptr) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\SFML\\ClassSoundSource.chs.h sfml_snsr_isRelativeToListener" isRelativeToListener'_ :: ((HG3DClassPtr) -> ((Ptr CInt) -> (IO ())))
HGamer3D/Bindings/SFML/ClassSoundStream.hs view
@@ -48,50 +48,40 @@ import HGamer3D.Bindings.SFML.StructHG3DClass {-# LINE 42 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundStream.chs" #-} --- | Destructor. -delete :: HG3DClass -- ^ classpointer - pointer of Class instance which is going to be deleted. - -> IO () - -- ^ +{- function ~SoundStream -} +delete :: HG3DClass -> IO () delete a1 = withHG3DClass a1 $ \a1' -> delete'_ a1' >>= \res -> return () {-# LINE 47 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundStream.chs" #-} --- | Start or resume playing the audio stream. - Details: This function starts the stream if it was stopped, resumes it if it was paused, and restarts it from beginning if it was it already playing. This function uses its own thread so that it doesn't block the rest of the program while the stream is played. -play :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO () - -- ^ +{- function play -} +play :: HG3DClass -> IO () play a1 = withHG3DClass a1 $ \a1' -> play'_ a1' >>= \res -> return () {-# LINE 51 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundStream.chs" #-} --- | Pause the audio stream. - Details: This function pauses the stream if it was playing, otherwise (stream already paused or stopped) it has no effect. -pause :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO () - -- ^ +{- function pause -} +pause :: HG3DClass -> IO () pause a1 = withHG3DClass a1 $ \a1' -> pause'_ a1' >>= \res -> return () {-# LINE 55 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundStream.chs" #-} --- | Stop playing the audio stream. - Details: This function stops the stream if it was playing or paused, and does nothing if it was already stopped. It also resets the playing position (unlike pause() -stop :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO () - -- ^ +{- function stop -} +stop :: HG3DClass -> IO () stop a1 = withHG3DClass a1 $ \a1' -> stop'_ a1' >>= \res -> return () {-# LINE 59 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundStream.chs" #-} --- | Return the number of channels of the stream. - Details: 1 channel means a mono sound, 2 means stereo, etc. -getChannelCount :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO (Int) - -- ^ +{- function getChannelCount -} +getChannelCount :: HG3DClass -> IO (Int) getChannelCount a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> @@ -100,10 +90,8 @@ return (a2'') {-# LINE 64 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundStream.chs" #-} --- | Get the stream sample rate of the stream. - Details: The sample rate is the number of audio samples played per second. The higher, the better the quality. -getSampleRate :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO (Int) - -- ^ +{- function getSampleRate -} +getSampleRate :: HG3DClass -> IO (Int) getSampleRate a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> @@ -112,11 +100,8 @@ return (a2'') {-# LINE 69 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundStream.chs" #-} --- | Set whether or not the stream should loop after reaching the end. - Details: If set, the stream will restart from beginning after reaching the end and so on, until it is stopped or setLoop(false) is called. The default looping state for streams is false. -setLoop :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> Bool -- ^ loop - -> IO () - -- ^ +{- function setLoop -} +setLoop :: HG3DClass -> Bool -> IO () setLoop a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = fromBool a2} in @@ -124,10 +109,8 @@ return () {-# LINE 74 ".\\HGamer3D\\Bindings\\SFML\\ClassSoundStream.chs" #-} --- | Tell whether or not the stream is in loop mode. - Details: setLoop -getLoop :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. - -> IO (Bool) - -- ^ return value - True if the stream is looping, false otherwise +{- function getLoop -} +getLoop :: HG3DClass -> IO (Bool) getLoop a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' ->
HGamer3D/Bindings/SFML/EnumJoystickAxis.hs view
@@ -42,21 +42,12 @@ import HGamer3D.Data.Angle -data EnumJoystickAxis = - -- | The X axis. - JoystickAxisX - -- | The Y axis. - | JoystickAxisY - -- | The Z axis. - | JoystickAxisZ - -- | The R axis. - | JoystickAxisR - -- | The U axis. - | JoystickAxisU - -- | The V axis. - | JoystickAxisV - -- | The X axis of the point-of-view hat. - | JoystickAxisPovX - -- | The Y axis of the point-of-view hat. - | JoystickAxisPovY +data EnumJoystickAxis = JoystickAxisX + | JoystickAxisY + | JoystickAxisZ + | JoystickAxisR + | JoystickAxisU + | JoystickAxisV + | JoystickAxisPovX + | JoystickAxisPovY deriving (Enum,Eq)
HGamer3D/Bindings/SFML/EnumKey.hs view
@@ -42,212 +42,106 @@ import HGamer3D.Data.Angle -data EnumKey = - -- | The A key. - KeyA - -- | The B key. - | KeyB - -- | The C key. - | KeyC - -- | The D key. - | KeyD - -- | The E key. - | KeyE - -- | The F key. - | KeyF - -- | The G key. - | KeyG - -- | The H key. - | KeyH - -- | The I key. - | KeyI - -- | The J key. - | KeyJ - -- | The K key. - | KeyK - -- | The L key. - | KeyL - -- | The M key. - | KeyM - -- | The N key. - | KeyN - -- | The O key. - | KeyO - -- | The P key. - | KeyP - -- | The Q key. - | KeyQ - -- | The R key. - | KeyR - -- | The S key. - | KeyS - -- | The T key. - | KeyT - -- | The U key. - | KeyU - -- | The V key. - | KeyV - -- | The W key. - | KeyW - -- | The X key. - | KeyX - -- | The Y key. - | KeyY - -- | The Z key. - | KeyZ - -- | The 0 key. - | KeyNum0 - -- | The 1 key. - | KeyNum1 - -- | The 2 key. - | KeyNum2 - -- | The 3 key. - | KeyNum3 - -- | The 4 key. - | KeyNum4 - -- | The 5 key. - | KeyNum5 - -- | The 6 key. - | KeyNum6 - -- | The 7 key. - | KeyNum7 - -- | The 8 key. - | KeyNum8 - -- | The 9 key. - | KeyNum9 - -- | The Escape key. - | KeyEscape - -- | The left Control key. - | KeyLControl - -- | The left Shift key. - | KeyLShift - -- | The left Alt key. - | KeyLAlt - -- | The left OS specific key: window (Windows and Linux), apple (MacOS X), ... - | KeyLSystem - -- | The right Control key. - | KeyRControl - -- | The right Shift key. - | KeyRShift - -- | The right Alt key. - | KeyRAlt - -- | The right OS specific key: window (Windows and Linux), apple (MacOS X), ... - | KeyRSystem - -- | The Menu key. - | KeyMenu - -- | The [ key. - | KeyLBracket - -- | The ] key. - | KeyRBracket - -- | The ; key. - | KeySemiColon - -- | The , key. - | KeyComma - -- | The . key. - | KeyPeriod - -- | The ' key. - | KeyQuote - -- | The / key. - | KeySlash - -- | The \ key. - | KeyBackSlash - -- | The ~ key. - | KeyTilde - -- | The = key. - | KeyEqual - -- | The - key. - | KeyDash - -- | The Space key. - | KeySpace - -- | The Return key. - | KeyReturn - -- | The Backspace key. - | KeyBack - -- | The Tabulation key. - | KeyTab - -- | The Page up key. - | KeyPageUp - -- | The Page down key. - | KeyPageDown - -- | The End key. - | KeyEnd - -- | The Home key. - | KeyHome - -- | The Insert key. - | KeyInsert - -- | The Delete key. - | KeyDelete - -- | --- - | KeyAdd - -- | --- - | KeySubtract - -- | --- - | KeyMultiply - -- | / - | KeyDivide - -- | Left arrow. - | KeyLeft - -- | Right arrow. - | KeyRight - -- | Up arrow. - | KeyUp - -- | Down arrow. - | KeyDown - -- | The numpad 0 key. - | KeyNumpad0 - -- | The numpad 1 key. - | KeyNumpad1 - -- | The numpad 2 key. - | KeyNumpad2 - -- | The numpad 3 key. - | KeyNumpad3 - -- | The numpad 4 key. - | KeyNumpad4 - -- | The numpad 5 key. - | KeyNumpad5 - -- | The numpad 6 key. - | KeyNumpad6 - -- | The numpad 7 key. - | KeyNumpad7 - -- | The numpad 8 key. - | KeyNumpad8 - -- | The numpad 9 key. - | KeyNumpad9 - -- | The F1 key. - | KeyF1 - -- | The F2 key. - | KeyF2 - -- | The F3 key. - | KeyF3 - -- | The F4 key. - | KeyF4 - -- | The F5 key. - | KeyF5 - -- | The F6 key. - | KeyF6 - -- | The F7 key. - | KeyF7 - -- | The F8 key. - | KeyF8 - -- | The F8 key. - | KeyF9 - -- | The F10 key. - | KeyF10 - -- | The F11 key. - | KeyF11 - -- | The F12 key. - | KeyF12 - -- | The F13 key. - | KeyF13 - -- | The F14 key. - | KeyF14 - -- | The F15 key. - | KeyF15 - -- | The Pause key. - | KeyPause - -- | Keep last - | KeyKeyCount +data EnumKey = KeyA + | KeyB + | KeyC + | KeyD + | KeyE + | KeyF + | KeyG + | KeyH + | KeyI + | KeyJ + | KeyK + | KeyL + | KeyM + | KeyN + | KeyO + | KeyP + | KeyQ + | KeyR + | KeyS + | KeyT + | KeyU + | KeyV + | KeyW + | KeyX + | KeyY + | KeyZ + | KeyNum0 + | KeyNum1 + | KeyNum2 + | KeyNum3 + | KeyNum4 + | KeyNum5 + | KeyNum6 + | KeyNum7 + | KeyNum8 + | KeyNum9 + | KeyEscape + | KeyLControl + | KeyLShift + | KeyLAlt + | KeyLSystem + | KeyRControl + | KeyRShift + | KeyRAlt + | KeyRSystem + | KeyMenu + | KeyLBracket + | KeyRBracket + | KeySemiColon + | KeyComma + | KeyPeriod + | KeyQuote + | KeySlash + | KeyBackSlash + | KeyTilde + | KeyEqual + | KeyDash + | KeySpace + | KeyReturn + | KeyBack + | KeyTab + | KeyPageUp + | KeyPageDown + | KeyEnd + | KeyHome + | KeyInsert + | KeyDelete + | KeyAdd + | KeySubtract + | KeyMultiply + | KeyDivide + | KeyLeft + | KeyRight + | KeyUp + | KeyDown + | KeyNumpad0 + | KeyNumpad1 + | KeyNumpad2 + | KeyNumpad3 + | KeyNumpad4 + | KeyNumpad5 + | KeyNumpad6 + | KeyNumpad7 + | KeyNumpad8 + | KeyNumpad9 + | KeyF1 + | KeyF2 + | KeyF3 + | KeyF4 + | KeyF5 + | KeyF6 + | KeyF7 + | KeyF8 + | KeyF9 + | KeyF10 + | KeyF11 + | KeyF12 + | KeyF13 + | KeyF14 + | KeyF15 + | KeyPause + | KeyKeyCount deriving (Enum,Eq)
HGamer3D/Bindings/SFML/EnumMouseButton.hs view
@@ -42,17 +42,10 @@ import HGamer3D.Data.Angle -data EnumMouseButton = - -- | The left mouse button. - MouseButtonLeft - -- | The right mouse button. - | MouseButtonRight - -- | The middle (wheel) mouse button. - | MouseButtonMiddle - -- | The first extra mouse button. - | MouseButtonXButton1 - -- | The second extra mouse button. - | MouseButtonXButton2 - -- | Keep last - | MouseButtonButtonCount +data EnumMouseButton = MouseButtonLeft + | MouseButtonRight + | MouseButtonMiddle + | MouseButtonXButton1 + | MouseButtonXButton2 + | MouseButtonButtonCount deriving (Enum,Eq)
HGamer3D/Bindings/SFML/EnumSoundSourceStatus.hs view
@@ -42,11 +42,7 @@ import HGamer3D.Data.Angle -data EnumSoundSourceStatus = - -- | Sound - SoundSourceStatusStopped - -- | Sound - | SoundSourceStatusPaused - -- | Sound - | SoundSourceStatusPlaying +data EnumSoundSourceStatus = SoundSourceStatusStopped + | SoundSourceStatusPaused + | SoundSourceStatusPlaying deriving (Enum,Eq)
+ HGamer3D/Bindings/SFML/StructVec3.hs view
@@ -0,0 +1,78 @@+-- GENERATED by C->Haskell Compiler, version 0.16.3 Crystal Seed, 24 Jan 2009 (Haskell) +-- Edit the ORIGNAL .chs file instead! + + +{-# LINE 1 ".\\HGamer3D\\Bindings\\SFML\\StructVec3.chs" #-}{-# LANGUAGE ForeignFunctionInterface #-} +{-# LANGUAGE TypeSynonymInstances #-} + +-- This source file is part of HGamer3D +-- (A project to enable 3D game development in Haskell) +-- For the latest info, see http://www.althainz.de/HGamer3D.html +-- + +-- (c) 2011, 2012 Peter Althainz +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + + +-- StructVec3.chs + +-- + +module HGamer3D.Bindings.SFML.StructVec3 where + +import Foreign +import Foreign.Ptr +import Foreign.C + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + + + +import Data.Bits +import HGamer3D.Data.Vector + +newtype Vector3f = Vector3f Vec3 + +instance Storable Vector3f where + alignment _ = alignment (undefined :: CDouble) + sizeOf _ = 12 +{-# LINE 50 ".\\HGamer3D\\Bindings\\SFML\\StructVec3.chs" #-} + peek p = do + x <- (\ptr -> do {peekByteOff ptr 0 ::IO CFloat}) p + y <- (\ptr -> do {peekByteOff ptr 4 ::IO CFloat}) p + z <- (\ptr -> do {peekByteOff ptr 8 ::IO CFloat}) p + let v = Vector3f (Vec3 (realToFrac x) (realToFrac y) (realToFrac z)) + return v + poke p (Vector3f (Vec3 x y z)) = do + (\ptr val -> do {pokeByteOff ptr 0 (val::CFloat)}) p (realToFrac x) + (\ptr val -> do {pokeByteOff ptr 4 (val::CFloat)}) p (realToFrac y) + (\ptr val -> do {pokeByteOff ptr 8 (val::CFloat)}) p (realToFrac z) + +type Vector3fPtr = Ptr (Vector3f) + +type Vec3Ptr = Ptr (Vec3) +{-# LINE 64 ".\\HGamer3D\\Bindings\\SFML\\StructVec3.chs" #-} + +withVec3 :: Vec3 -> (Vec3Ptr -> IO b) -> IO b +withVec3 v f = with v' f' where + v' = Vector3f v + f' p = f (castPtr p) +peekVec3 p = do + (Vector3f v3) <- peek ((castPtr p)::Vector3fPtr) + return v3 +
include/ClassListener.h view
@@ -26,6 +26,7 @@ #define _DEFINED_HG3D_ClassListener #include "ClassPtr.h" +#include "StructVec3.h" // Change the global volume of all the sounds and musics. @@ -37,7 +38,13 @@ // Set the position of the listener in the scene. void sfml_lst_setPosition(float x_c, float y_c, float z_c); +// Get the current position of the listener in the scene. +void sfml_lst_getPosition(struct vector3f_struct * result_c); + // Set the orientation of the listener in the scene. void sfml_lst_setDirection(float x_c, float y_c, float z_c); + +// Get the current orientation of the listener in the scene. +void sfml_lst_getDirection(struct vector3f_struct * result_c); #endif
include/ClassSoundSource.h view
@@ -26,6 +26,7 @@ #define _DEFINED_HG3D_ClassSoundSource #include "ClassPtr.h" +#include "StructVec3.h" // Destructor. @@ -54,6 +55,9 @@ // Get the volume of the sound. void sfml_snsr_getVolume(struct hg3dclass_struct * thisclass_c, float * result_c); + +// Get the 3D position of the sound in the audio scene. +void sfml_snsr_getPosition(struct hg3dclass_struct * thisclass_c, struct vector3f_struct * result_c); // Tell whether the sound's position is relative to the listener or is absolute. void sfml_snsr_isRelativeToListener(struct hg3dclass_struct * thisclass_c, int * result_c);
include/SFMLDllDefines.h view
@@ -16,10 +16,10 @@ // SFMLDllDefines.h -#ifndef _HGamer3DSFML019_DLLDEFINES_H_ -#define _HGamer3DSFML019_DLLDEFINES_H_ +#ifndef _HGamer3DSFML020_DLLDEFINES_H_ +#define _HGamer3DSFML020_DLLDEFINES_H_ -/* Cmake will define HGamer3DSFML019_EXPORTS on Windows when it +/* Cmake will define HGamer3DSFML020_EXPORTS on Windows when it configures to build a shared library. If you are going to use another build system on windows or create the visual studio projects by hand you need to define MyLibrary_EXPORTS when @@ -29,13 +29,13 @@ // We are using the Visual Studio Compiler and building Shared libraries #if (defined (_WIN32)) && !(defined (__GNUC__)) - #if defined(HGamer3DSFML019_EXPORTS) + #if defined(HGamer3DSFML020_EXPORTS) #define SFML_LIB_EXPORT __declspec(dllexport) #else #define SFML_LIB_EXPORT __declspec(dllimport) - #endif /* HGamer3DSFML019_EXPORTS */ + #endif /* HGamer3DSFML020_EXPORTS */ #else /* defined (_WIN32) */ #define SFML_LIB_EXPORT #endif -#endif /* _HGamer3DSFML019_DLLDEFINES_H_ */ +#endif /* _HGamer3DSFML020_DLLDEFINES_H_ */
+ include/StructVec3.h view
@@ -0,0 +1,36 @@+// This source file is part of HGamer3D +// (A project to enable 3D game development in Haskell) +// For the latest info, see http://www.althainz.de/HGamer3D.html +// +// (c) 2011, 2012 Peter Althainz +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// StructVec3.h + +// + +#include "wchar.h" + + +#ifndef _INC_STRUCT_VECTOR3F +#define _INC_STRUCT_VECTOR3F + +typedef struct vector3f_struct { + float x; + float y; + float z; +} vector3f_struct; + +#endif