HGamer3D-SFML-Binding (empty) → 0.1.6
raw patch · 38 files changed
+2248/−0 lines, 38 filesdep +HGamer3D-Datadep +basedep +haskell98setup-changed
Dependencies added: HGamer3D-Data, base, haskell98
Files
- C2HS.hs +238/−0
- HGamer3D-SFML-Binding.cabal +39/−0
- HGamer3D/Bindings/SFML/ClassJoystick.chs +82/−0
- HGamer3D/Bindings/SFML/ClassKeyboard.chs +55/−0
- HGamer3D/Bindings/SFML/ClassListener.chs +69/−0
- HGamer3D/Bindings/SFML/ClassMouse.chs +55/−0
- HGamer3D/Bindings/SFML/ClassMouseHG3D.chs +54/−0
- HGamer3D/Bindings/SFML/ClassMusic.chs +63/−0
- HGamer3D/Bindings/SFML/ClassPtr.chs +66/−0
- HGamer3D/Bindings/SFML/ClassSound.chs +88/−0
- HGamer3D/Bindings/SFML/ClassSoundBuffer.chs +79/−0
- HGamer3D/Bindings/SFML/ClassSoundSource.chs +110/−0
- HGamer3D/Bindings/SFML/ClassSoundStream.chs +85/−0
- HGamer3D/Bindings/SFML/EnumJoystickAxis.chs +47/−0
- HGamer3D/Bindings/SFML/EnumKey.chs +47/−0
- HGamer3D/Bindings/SFML/EnumMouseButton.chs +47/−0
- HGamer3D/Bindings/SFML/EnumSoundSourceStatus.chs +47/−0
- HGamer3D/Bindings/SFML/StructHG3DClass.chs +55/−0
- HGamer3D/Bindings/SFML/Utils.chs +85/−0
- LICENSE +13/−0
- Setup.hs +22/−0
- include/ClassJoystick.h +46/−0
- include/ClassKeyboard.h +31/−0
- include/ClassListener.h +39/−0
- include/ClassMouse.h +31/−0
- include/ClassMouseHG3D.h +30/−0
- include/ClassMusic.h +36/−0
- include/ClassPtr.h +69/−0
- include/ClassSound.h +55/−0
- include/ClassSoundBuffer.h +45/−0
- include/ClassSoundSource.h +63/−0
- include/ClassSoundStream.h +51/−0
- include/EnumJoystickAxis.h +37/−0
- include/EnumKey.h +131/−0
- include/EnumMouseButton.h +35/−0
- include/EnumSoundSourceStatus.h +32/−0
- include/SFMLDllDefines.h +41/−0
- include/StructHG3DClass.h +30/−0
+ C2HS.hs view
@@ -0,0 +1,238 @@+-- C->Haskell Compiler: Marshalling library +-- +-- Copyright (c) [1999...2005] Manuel M T Chakravarty +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- 1. Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- 3. The name of the author may not be used to endorse or promote products +-- derived from this software without specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +-- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +-- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +-- NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-- +--- Description --------------------------------------------------------------- +-- +-- Language: Haskell 98 +-- +-- This module provides the marshaling routines for Haskell files produced by +-- C->Haskell for binding to C library interfaces. It exports all of the +-- low-level FFI (language-independent plus the C-specific parts) together +-- with the C->HS-specific higher-level marshalling routines. +-- + +module C2HS ( + + -- * Re-export the language-independent component of the FFI + module Foreign, + + -- * Re-export the C language component of the FFI + module Foreign.C, + + -- * Composite marshalling functions + withCStringLenIntConv, peekCStringLenIntConv, withIntConv, withFloatConv, + peekIntConv, peekFloatConv, withBool, peekBool, withEnum, peekEnum, + + -- * Conditional results using 'Maybe' + nothingIf, nothingIfNull, + + -- * Bit masks + combineBitMasks, containsBitMask, extractBitMasks, + + -- * Conversion between C and Haskell types + cIntConv, cFloatConv, cToBool, cFromBool, cToEnum, cFromEnum +) where + + +import Foreign +import Foreign.C + +import Monad (liftM) + + +-- Composite marshalling functions +-- ------------------------------- + +-- Strings with explicit length +-- +withCStringLenIntConv :: Num n => String -> ((CString, n) -> IO a) -> IO a +withCStringLenIntConv s f = withCStringLen s $ \(p, n) -> f (p, fromIntegral n) + +peekCStringLenIntConv :: Integral n => (CString, n) -> IO String +peekCStringLenIntConv (s, n) = peekCStringLen (s, fromIntegral n) + +-- Marshalling of numerals +-- + +withIntConv :: (Storable b, Integral a, Integral b) + => a -> (Ptr b -> IO c) -> IO c +withIntConv = with . fromIntegral + +withFloatConv :: (Storable b, RealFloat a, RealFloat b) + => a -> (Ptr b -> IO c) -> IO c +withFloatConv = with . realToFrac + +peekIntConv :: (Storable a, Integral a, Integral b) + => Ptr a -> IO b +peekIntConv = liftM fromIntegral . peek + +peekFloatConv :: (Storable a, RealFloat a, RealFloat b) + => Ptr a -> IO b +peekFloatConv = liftM realToFrac . peek + + +-- Everything else below is deprecated. +-- These functions are not used by code generated by c2hs. + +{-# DEPRECATED withBool "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-} +{-# DEPRECATED peekBool "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-} +{-# DEPRECATED withEnum "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-} +{-# DEPRECATED peekEnum "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-} +{-# DEPRECATED nothingIf "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-} +{-# DEPRECATED nothingIfNull "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-} +{-# DEPRECATED combineBitMasks "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-} +{-# DEPRECATED containsBitMask "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-} +{-# DEPRECATED extractBitMasks "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-} +{-# DEPRECATED cIntConv "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-} +{-# DEPRECATED cFloatConv "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-} +{-# DEPRECATED cFromBool "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-} +{-# DEPRECATED cToBool "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-} +{-# DEPRECATED cToEnum "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-} +{-# DEPRECATED cFromEnum "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-} + + +-- Passing Booleans by reference +-- + +withBool :: (Integral a, Storable a) => Bool -> (Ptr a -> IO b) -> IO b +withBool = with . fromBool + +peekBool :: (Integral a, Storable a) => Ptr a -> IO Bool +peekBool = liftM toBool . peek + + +-- Passing enums by reference +-- + +withEnum :: (Enum a, Integral b, Storable b) => a -> (Ptr b -> IO c) -> IO c +withEnum = with . cFromEnum + +peekEnum :: (Enum a, Integral b, Storable b) => Ptr b -> IO a +peekEnum = liftM cToEnum . peek + + +-- Storing of 'Maybe' values +-- ------------------------- + +--TODO: kill off this orphan instance! + +instance Storable a => Storable (Maybe a) where + sizeOf _ = sizeOf (undefined :: Ptr ()) + alignment _ = alignment (undefined :: Ptr ()) + + peek p = do + ptr <- peek (castPtr p) + if ptr == nullPtr + then return Nothing + else liftM Just $ peek ptr + + poke p v = do + ptr <- case v of + Nothing -> return nullPtr + Just v' -> new v' + poke (castPtr p) ptr + + +-- Conditional results using 'Maybe' +-- --------------------------------- + +-- Wrap the result into a 'Maybe' type. +-- +-- * the predicate determines when the result is considered to be non-existing, +-- ie, it is represented by `Nothing' +-- +-- * the second argument allows to map a result wrapped into `Just' to some +-- other domain +-- +nothingIf :: (a -> Bool) -> (a -> b) -> a -> Maybe b +nothingIf p f x = if p x then Nothing else Just $ f x + +-- |Instance for special casing null pointers. +-- +nothingIfNull :: (Ptr a -> b) -> Ptr a -> Maybe b +nothingIfNull = nothingIf (== nullPtr) + + +-- Support for bit masks +-- --------------------- + +-- Given a list of enumeration values that represent bit masks, combine these +-- masks using bitwise disjunction. +-- +combineBitMasks :: (Enum a, Bits b) => [a] -> b +combineBitMasks = foldl (.|.) 0 . map (fromIntegral . fromEnum) + +-- Tests whether the given bit mask is contained in the given bit pattern +-- (i.e., all bits set in the mask are also set in the pattern). +-- +containsBitMask :: (Bits a, Enum b) => a -> b -> Bool +bits `containsBitMask` bm = let bm' = fromIntegral . fromEnum $ bm + in + bm' .&. bits == bm' + +-- |Given a bit pattern, yield all bit masks that it contains. +-- +-- * This does *not* attempt to compute a minimal set of bit masks that when +-- combined yield the bit pattern, instead all contained bit masks are +-- produced. +-- +extractBitMasks :: (Bits a, Enum b, Bounded b) => a -> [b] +extractBitMasks bits = + [bm | bm <- [minBound..maxBound], bits `containsBitMask` bm] + + +-- Conversion routines +-- ------------------- + +-- |Integral conversion +-- +cIntConv :: (Integral a, Integral b) => a -> b +cIntConv = fromIntegral + +-- |Floating conversion +-- +cFloatConv :: (RealFloat a, RealFloat b) => a -> b +cFloatConv = realToFrac + +-- |Obtain C value from Haskell 'Bool'. +-- +cFromBool :: Num a => Bool -> a +cFromBool = fromBool + +-- |Obtain Haskell 'Bool' from C value. +-- +cToBool :: Num a => a -> Bool +cToBool = toBool + +-- |Convert a C enumeration to Haskell. +-- +cToEnum :: (Integral i, Enum e) => i -> e +cToEnum = toEnum . fromIntegral + +-- |Convert a Haskell enumeration to C. +-- +cFromEnum :: (Enum e, Integral i) => e -> i +cFromEnum = fromIntegral . fromEnum
+ HGamer3D-SFML-Binding.cabal view
@@ -0,0 +1,39 @@+Name: HGamer3D-SFML-Binding +Version: 0.1.6 +Synopsis: Library to enable 3D game development for Haskell - SFML Bindings +Description: + Library, to enable 3D game development for Haskell, + based on bindings to 3D Graphics, Audio and GUI libraries. + + This is the SFML Bindings module, which provides Audio and + Input System (Joystick, Mouse, Keyboard) functionality. + + Platform: Windows only + License: Apache License, Version 2.0 + Install: see http://www.althainz.de/HGamer3D/Download-and-Installation.html + + + +License: OtherLicense +License-file: LICENSE +Author: Peter Althainz +Maintainer: althainz@googlemail.com +Build-Type: Simple +Cabal-Version: >=1.2 +Homepage: http://www.althainz.de/HGamer3D.html +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 + +Library + Build-Depends: base >= 3 && < 5, HGamer3D-Data == 0.1.5 + + Exposed-modules: HGamer3D.Bindings.SFML.ClassPtr, HGamer3D.Bindings.SFML.StructHG3DClass, HGamer3D.Bindings.SFML.Utils, 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, HGamer3D.Bindings.SFML.EnumJoystickAxis, HGamer3D.Bindings.SFML.EnumKey, HGamer3D.Bindings.SFML.EnumMouseButton, HGamer3D.Bindings.SFML.EnumSoundSourceStatus + Other-modules: C2HS + + ghc-options: + cc-options: -Wno-attributes + hs-source-dirs: . + Include-dirs: include + Build-tools: + build-depends: haskell98 + extra-libraries: HGamer3DSFML016
+ HGamer3D/Bindings/SFML/ClassJoystick.chs view
@@ -0,0 +1,82 @@+{-# 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. +-- + + +-- ClassJoystick.chs + +-- + +module HGamer3D.Bindings.SFML.ClassJoystick where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + +{# import HGamer3D.Bindings.SFML.Utils #} +{# import HGamer3D.Bindings.SFML.ClassPtr #} +{# import HGamer3D.Bindings.SFML.StructHG3DClass #} +import HGamer3D.Bindings.SFML.EnumJoystickAxis + +#include "ClassJoystick.h" +{- function isConnected -} +{#fun sfml_jst_isConnected as isConnected +{ fromIntegral `Int' , + alloca- `Bool' peekBoolUtil*} -> `()' #} + +{- function getButtonCount -} +{#fun sfml_jst_getButtonCount as getButtonCount +{ fromIntegral `Int' , + alloca- `Int' peekIntConv*} -> `()' #} + +{- function hasAxis -} +{#fun sfml_jst_hasAxis as hasAxis +{ fromIntegral `Int' , + cIntFromEnum `EnumJoystickAxis' , + alloca- `Bool' peekBoolUtil*} -> `()' #} + +{- function isButtonPressed -} +{#fun sfml_jst_isButtonPressed as isButtonPressed +{ fromIntegral `Int' , + fromIntegral `Int' , + alloca- `Bool' peekBoolUtil*} -> `()' #} + +{- function getAxisPosition -} +{#fun sfml_jst_getAxisPosition as getAxisPosition +{ fromIntegral `Int' , + cIntFromEnum `EnumJoystickAxis' , + alloca- `Float' peekFloatConv*} -> `()' #} + +{- function update -} +{#fun sfml_jst_update as update +{ } -> `()' #} +
+ HGamer3D/Bindings/SFML/ClassKeyboard.chs view
@@ -0,0 +1,55 @@+{-# 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. +-- + + +-- ClassKeyboard.chs + +-- + +module HGamer3D.Bindings.SFML.ClassKeyboard where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + +{# import HGamer3D.Bindings.SFML.Utils #} +{# import HGamer3D.Bindings.SFML.ClassPtr #} +{# import HGamer3D.Bindings.SFML.StructHG3DClass #} +import HGamer3D.Bindings.SFML.EnumKey + +#include "ClassKeyboard.h" +{- function isKeyPressed -} +{#fun sfml_kbd_isKeyPressed as isKeyPressed +{ cIntFromEnum `EnumKey' , + alloca- `Bool' peekBoolUtil*} -> `()' #} +
+ HGamer3D/Bindings/SFML/ClassListener.chs view
@@ -0,0 +1,69 @@+{-# 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. +-- + + +-- ClassListener.chs + +-- + +module HGamer3D.Bindings.SFML.ClassListener where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + +{# import HGamer3D.Bindings.SFML.Utils #} +{# import HGamer3D.Bindings.SFML.ClassPtr #} +{# import HGamer3D.Bindings.SFML.StructHG3DClass #} + +#include "ClassListener.h" +{- function setGlobalVolume -} +{#fun sfml_lst_setGlobalVolume as setGlobalVolume +{ realToFrac `Float' } -> `()' #} + +{- function getGlobalVolume -} +{#fun sfml_lst_getGlobalVolume as getGlobalVolume +{ alloca- `Float' peekFloatConv*} -> `()' #} + +{- function setPosition -} +{#fun sfml_lst_setPosition as setPosition +{ realToFrac `Float' , + realToFrac `Float' , + realToFrac `Float' } -> `()' #} + +{- function setDirection -} +{#fun sfml_lst_setDirection as setDirection +{ realToFrac `Float' , + realToFrac `Float' , + realToFrac `Float' } -> `()' #} +
+ HGamer3D/Bindings/SFML/ClassMouse.chs view
@@ -0,0 +1,55 @@+{-# 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. +-- + + +-- ClassMouse.chs + +-- + +module HGamer3D.Bindings.SFML.ClassMouse where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + +{# import HGamer3D.Bindings.SFML.Utils #} +{# import HGamer3D.Bindings.SFML.ClassPtr #} +{# import HGamer3D.Bindings.SFML.StructHG3DClass #} +import HGamer3D.Bindings.SFML.EnumMouseButton + +#include "ClassMouse.h" +{- function isButtonPressed -} +{#fun sfml_mse_isButtonPressed as isButtonPressed +{ cIntFromEnum `EnumMouseButton' , + alloca- `Bool' peekBoolUtil*} -> `()' #} +
+ HGamer3D/Bindings/SFML/ClassMouseHG3D.chs view
@@ -0,0 +1,54 @@+{-# 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. +-- + + +-- ClassMouseHG3D.chs + +-- + +module HGamer3D.Bindings.SFML.ClassMouseHG3D where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + +{# import HGamer3D.Bindings.SFML.Utils #} +{# import HGamer3D.Bindings.SFML.ClassPtr #} +{# import HGamer3D.Bindings.SFML.StructHG3DClass #} + +#include "ClassMouseHG3D.h" +{- function getPosition -} +{#fun sfml_mshg_getPosition as getPosition +{ alloca- `Int' peekIntConv*, + alloca- `Int' peekIntConv*} -> `()' #} +
+ HGamer3D/Bindings/SFML/ClassMusic.chs view
@@ -0,0 +1,63 @@+{-# 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. +-- + + +-- ClassMusic.chs + +-- + +module HGamer3D.Bindings.SFML.ClassMusic where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + +{# import HGamer3D.Bindings.SFML.Utils #} +{# import HGamer3D.Bindings.SFML.ClassPtr #} +{# import HGamer3D.Bindings.SFML.StructHG3DClass #} + +#include "ClassMusic.h" +{- function Music -} +{#fun sfml_msc_construct as new +{ alloca- `HG3DClass' peek*} -> `()' #} + +{- function ~Music -} +{#fun sfml_msc_destruct as delete +{ withHG3DClass* `HG3DClass' } -> `()' #} + +{- function openFromFile -} +{#fun sfml_msc_openFromFile as openFromFile +{ withHG3DClass* `HG3DClass' , + withCString* `String' , + alloca- `Bool' peekBoolUtil*} -> `()' #} +
+ HGamer3D/Bindings/SFML/ClassPtr.chs view
@@ -0,0 +1,66 @@+{-# 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. +-- + + +-- ClassPtr.chs + +-- Class Ptr Utilities + +module HGamer3D.Bindings.SFML.ClassPtr where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + + +#include "ClassPtr.h" +{- class ClassMouseHG3D -} +{#pointer *ClassMouseHG3D as ClassMouseHG3D#} +{- class ClassJoystick -} +{#pointer *ClassJoystick as ClassJoystick#} +{- class ClassKeyboard -} +{#pointer *ClassKeyboard as ClassKeyboard#} +{- class ClassListener -} +{#pointer *ClassListener as ClassListener#} +{- class ClassMouse -} +{#pointer *ClassMouse as ClassMouse#} +{- class ClassMusic -} +{#pointer *ClassMusic as ClassMusic#} +{- class ClassSound -} +{#pointer *ClassSound as ClassSound#} +{- class ClassSoundBuffer -} +{#pointer *ClassSoundBuffer as ClassSoundBuffer#} +{- class ClassSoundSource -} +{#pointer *ClassSoundSource as ClassSoundSource#} +{- class ClassSoundStream -} +{#pointer *ClassSoundStream as ClassSoundStream#}
+ HGamer3D/Bindings/SFML/ClassSound.chs view
@@ -0,0 +1,88 @@+{-# 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. +-- + + +-- ClassSound.chs + +-- + +module HGamer3D.Bindings.SFML.ClassSound where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + +{# import HGamer3D.Bindings.SFML.Utils #} +{# import HGamer3D.Bindings.SFML.ClassPtr #} +{# import HGamer3D.Bindings.SFML.StructHG3DClass #} + +#include "ClassSound.h" +{- function Sound -} +{#fun sfml_snd_construct as new +{ alloca- `HG3DClass' peek*} -> `()' #} + +{- function ~Sound -} +{#fun sfml_snd_destruct as delete +{ withHG3DClass* `HG3DClass' } -> `()' #} + +{- function play -} +{#fun sfml_snd_play as play +{ withHG3DClass* `HG3DClass' } -> `()' #} + +{- function pause -} +{#fun sfml_snd_pause as pause +{ withHG3DClass* `HG3DClass' } -> `()' #} + +{- function stop -} +{#fun sfml_snd_stop as stop +{ withHG3DClass* `HG3DClass' } -> `()' #} + +{- function setBuffer -} +{#fun sfml_snd_setBuffer as setBuffer +{ withHG3DClass* `HG3DClass' , + withHG3DClass* `HG3DClass' } -> `()' #} + +{- function setLoop -} +{#fun sfml_snd_setLoop as setLoop +{ withHG3DClass* `HG3DClass' , + fromBool `Bool' } -> `()' #} + +{- function getLoop -} +{#fun sfml_snd_getLoop as getLoop +{ withHG3DClass* `HG3DClass' , + alloca- `Bool' peekBoolUtil*} -> `()' #} + +{- function resetBuffer -} +{#fun sfml_snd_resetBuffer as resetBuffer +{ withHG3DClass* `HG3DClass' } -> `()' #} +
+ HGamer3D/Bindings/SFML/ClassSoundBuffer.chs view
@@ -0,0 +1,79 @@+{-# 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. +-- + + +-- ClassSoundBuffer.chs + +-- + +module HGamer3D.Bindings.SFML.ClassSoundBuffer where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + +{# import HGamer3D.Bindings.SFML.Utils #} +{# import HGamer3D.Bindings.SFML.ClassPtr #} +{# import HGamer3D.Bindings.SFML.StructHG3DClass #} + +#include "ClassSoundBuffer.h" +{- function SoundBuffer -} +{#fun sfml_snbf_construct as new +{ alloca- `HG3DClass' peek*} -> `()' #} + +{- function ~SoundBuffer -} +{#fun sfml_snbf_destruct as delete +{ withHG3DClass* `HG3DClass' } -> `()' #} + +{- function loadFromFile -} +{#fun sfml_snbf_loadFromFile as loadFromFile +{ withHG3DClass* `HG3DClass' , + withCString* `String' , + alloca- `Bool' peekBoolUtil*} -> `()' #} + +{- function saveToFile -} +{#fun sfml_snbf_saveToFile as saveToFile +{ withHG3DClass* `HG3DClass' , + withCString* `String' , + alloca- `Bool' peekBoolUtil*} -> `()' #} + +{- function getSampleRate -} +{#fun sfml_snbf_getSampleRate as getSampleRate +{ withHG3DClass* `HG3DClass' , + alloca- `Int' peekIntConv*} -> `()' #} + +{- function getChannelCount -} +{#fun sfml_snbf_getChannelCount as getChannelCount +{ withHG3DClass* `HG3DClass' , + alloca- `Int' peekIntConv*} -> `()' #} +
+ HGamer3D/Bindings/SFML/ClassSoundSource.chs view
@@ -0,0 +1,110 @@+{-# 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. +-- + + +-- ClassSoundSource.chs + +-- + +module HGamer3D.Bindings.SFML.ClassSoundSource where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + +{# import HGamer3D.Bindings.SFML.Utils #} +{# import HGamer3D.Bindings.SFML.ClassPtr #} +{# import HGamer3D.Bindings.SFML.StructHG3DClass #} + +#include "ClassSoundSource.h" +{- function ~SoundSource -} +{#fun sfml_snsr_destruct as delete +{ withHG3DClass* `HG3DClass' } -> `()' #} + +{- function setPitch -} +{#fun sfml_snsr_setPitch as setPitch +{ withHG3DClass* `HG3DClass' , + realToFrac `Float' } -> `()' #} + +{- function setVolume -} +{#fun sfml_snsr_setVolume as setVolume +{ withHG3DClass* `HG3DClass' , + realToFrac `Float' } -> `()' #} + +{- function setPosition -} +{#fun sfml_snsr_setPosition as setPosition +{ withHG3DClass* `HG3DClass' , + realToFrac `Float' , + realToFrac `Float' , + realToFrac `Float' } -> `()' #} + +{- function setRelativeToListener -} +{#fun sfml_snsr_setRelativeToListener as setRelativeToListener +{ withHG3DClass* `HG3DClass' , + fromBool `Bool' } -> `()' #} + +{- function setMinDistance -} +{#fun sfml_snsr_setMinDistance as setMinDistance +{ withHG3DClass* `HG3DClass' , + realToFrac `Float' } -> `()' #} + +{- function setAttenuation -} +{#fun sfml_snsr_setAttenuation as setAttenuation +{ withHG3DClass* `HG3DClass' , + realToFrac `Float' } -> `()' #} + +{- function getPitch -} +{#fun sfml_snsr_getPitch as getPitch +{ withHG3DClass* `HG3DClass' , + alloca- `Float' peekFloatConv*} -> `()' #} + +{- function getVolume -} +{#fun sfml_snsr_getVolume as getVolume +{ withHG3DClass* `HG3DClass' , + alloca- `Float' peekFloatConv*} -> `()' #} + +{- function isRelativeToListener -} +{#fun sfml_snsr_isRelativeToListener as isRelativeToListener +{ withHG3DClass* `HG3DClass' , + alloca- `Bool' peekBoolUtil*} -> `()' #} + +{- function getMinDistance -} +{#fun sfml_snsr_getMinDistance as getMinDistance +{ withHG3DClass* `HG3DClass' , + alloca- `Float' peekFloatConv*} -> `()' #} + +{- function getAttenuation -} +{#fun sfml_snsr_getAttenuation as getAttenuation +{ withHG3DClass* `HG3DClass' , + alloca- `Float' peekFloatConv*} -> `()' #} +
+ HGamer3D/Bindings/SFML/ClassSoundStream.chs view
@@ -0,0 +1,85 @@+{-# 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. +-- + + +-- ClassSoundStream.chs + +-- + +module HGamer3D.Bindings.SFML.ClassSoundStream where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + +{# import HGamer3D.Bindings.SFML.Utils #} +{# import HGamer3D.Bindings.SFML.ClassPtr #} +{# import HGamer3D.Bindings.SFML.StructHG3DClass #} + +#include "ClassSoundStream.h" +{- function ~SoundStream -} +{#fun sfml_snst_destruct as delete +{ withHG3DClass* `HG3DClass' } -> `()' #} + +{- function play -} +{#fun sfml_snst_play as play +{ withHG3DClass* `HG3DClass' } -> `()' #} + +{- function pause -} +{#fun sfml_snst_pause as pause +{ withHG3DClass* `HG3DClass' } -> `()' #} + +{- function stop -} +{#fun sfml_snst_stop as stop +{ withHG3DClass* `HG3DClass' } -> `()' #} + +{- function getChannelCount -} +{#fun sfml_snst_getChannelCount as getChannelCount +{ withHG3DClass* `HG3DClass' , + alloca- `Int' peekIntConv*} -> `()' #} + +{- function getSampleRate -} +{#fun sfml_snst_getSampleRate as getSampleRate +{ withHG3DClass* `HG3DClass' , + alloca- `Int' peekIntConv*} -> `()' #} + +{- function setLoop -} +{#fun sfml_snst_setLoop as setLoop +{ withHG3DClass* `HG3DClass' , + fromBool `Bool' } -> `()' #} + +{- function getLoop -} +{#fun sfml_snst_getLoop as getLoop +{ withHG3DClass* `HG3DClass' , + alloca- `Bool' peekBoolUtil*} -> `()' #} +
+ HGamer3D/Bindings/SFML/EnumJoystickAxis.chs view
@@ -0,0 +1,47 @@+{-# 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. +-- + + +-- EnumJoystickAxis.chs + +-- + +module HGamer3D.Bindings.SFML.EnumJoystickAxis where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + + +#include "EnumJoystickAxis.h" +{#enum EnumJoystickAxis {} deriving (Eq)#}
+ HGamer3D/Bindings/SFML/EnumKey.chs view
@@ -0,0 +1,47 @@+{-# 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. +-- + + +-- EnumKey.chs + +-- + +module HGamer3D.Bindings.SFML.EnumKey where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + + +#include "EnumKey.h" +{#enum EnumKey {} deriving (Eq)#}
+ HGamer3D/Bindings/SFML/EnumMouseButton.chs view
@@ -0,0 +1,47 @@+{-# 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. +-- + + +-- EnumMouseButton.chs + +-- + +module HGamer3D.Bindings.SFML.EnumMouseButton where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + + +#include "EnumMouseButton.h" +{#enum EnumMouseButton {} deriving (Eq)#}
+ HGamer3D/Bindings/SFML/EnumSoundSourceStatus.chs view
@@ -0,0 +1,47 @@+{-# 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. +-- + + +-- EnumSoundSourceStatus.chs + +-- + +module HGamer3D.Bindings.SFML.EnumSoundSourceStatus where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + + +#include "EnumSoundSourceStatus.h" +{#enum EnumSoundSourceStatus {} deriving (Eq)#}
+ HGamer3D/Bindings/SFML/StructHG3DClass.chs view
@@ -0,0 +1,55 @@+{-# 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. +-- + + +-- StructHG3DClass.chs + +-- + +module HGamer3D.Bindings.SFML.StructHG3DClass where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + + +#include "StructHG3DClass.h" + +import Data.Bits +import HGamer3D.Data.HG3DClass + + +{#pointer *hg3dclass_struct as HG3DClassPtr -> HG3DClass #} + +withHG3DClass :: HG3DClass -> (HG3DClassPtr -> IO b) -> IO b +withHG3DClass = with
+ HGamer3D/Bindings/SFML/Utils.chs view
@@ -0,0 +1,85 @@+{-# 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. +-- + + +-- Utils.hs + +-- Marshalling Utilities + +module HGamer3D.Bindings.SFML.Utils where + +import C2HS +import Foreign +import Foreign.Ptr +import Foreign.C +import Monad (liftM, liftM2) + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector2 +import HGamer3D.Data.Vector3 +import HGamer3D.Data.Vector4 +import HGamer3D.Data.Quaternion +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + + +#include "StructHG3DClass.h" +-- String Conversion functions +-- + +withCUString b f = withCWString b (f . castPtr) +peekCUString = peekCWString . castPtr +alloc64k = allocaBytes (1024 * 64) + +-- c2hs replacements of utility functions, to get rid of annoying c2hs +-- deprecated messages + +-- Passing Enums + +cIntFromEnum :: Enum a => a -> CInt +cIntFromEnum = cIntConv . fromEnum + +cIntToEnum :: Enum a => CInt -> a +cIntToEnum = toEnum . cIntConv + + +-- Passing Booleans by reference +-- + +withBoolUtil :: (Integral a, Storable a) => Bool -> (Ptr a -> IO b) -> IO b +withBoolUtil = with . fromBool + +peekBoolUtil :: (Integral a, Storable a) => Ptr a -> IO Bool +peekBoolUtil = liftM toBool . peek + + +-- Passing enums by reference +-- + +withEnumUtil :: (Enum a, Integral b, Storable b) => a -> (Ptr b -> IO c) -> IO c +withEnumUtil = with . cFromEnum + +peekEnumUtil :: (Enum a, Integral b, Storable b) => Ptr b -> IO a +peekEnumUtil = liftM cToEnum . peek + +
+ LICENSE view
@@ -0,0 +1,13 @@+(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.
+ Setup.hs view
@@ -0,0 +1,22 @@+-- 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. +-- +-- Setup.hs + +import Distribution.Simple +main = defaultMain
+ include/ClassJoystick.h view
@@ -0,0 +1,46 @@+// 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. +// + +// ClassJoystick.h + +// + +#include "wchar.h" +#include "ClassPtr.h" +#include "EnumJoystickAxis.h" + + +// Check if a joystick is connected. +void sfml_jst_isConnected(unsigned int joystick_c, int * result_c); + +// Return the number of buttons supported by a joystick. +void sfml_jst_getButtonCount(unsigned int joystick_c, unsigned int * result_c); + +// Check if a joystick supports a given axis. +void sfml_jst_hasAxis(unsigned int joystick_c, enum EnumJoystickAxis axis_c, int * result_c); + +// Check if a joystick button is pressed. +void sfml_jst_isButtonPressed(unsigned int joystick_c, unsigned int button_c, int * result_c); + +// Get the current position of a joystick axis. +void sfml_jst_getAxisPosition(unsigned int joystick_c, enum EnumJoystickAxis axis_c, float * result_c); + +// Update the states of all joysticks. +void sfml_jst_update(); +
+ include/ClassKeyboard.h view
@@ -0,0 +1,31 @@+// 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. +// + +// ClassKeyboard.h + +// + +#include "wchar.h" +#include "ClassPtr.h" +#include "EnumKey.h" + + +// Check if a key is pressed. +void sfml_kbd_isKeyPressed(enum EnumKey key_c, int * result_c); +
+ include/ClassListener.h view
@@ -0,0 +1,39 @@+// 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. +// + +// ClassListener.h + +// + +#include "wchar.h" +#include "ClassPtr.h" + + +// Change the global volume of all the sounds and musics. +void sfml_lst_setGlobalVolume(float volume_c); + +// Get the current value of the global volume. +void sfml_lst_getGlobalVolume(float * result_c); + +// Set the position of the listener in the scene. +void sfml_lst_setPosition(float x_c, float y_c, float z_c); + +// Set the orientation of the listener in the scene. +void sfml_lst_setDirection(float x_c, float y_c, float z_c); +
+ include/ClassMouse.h view
@@ -0,0 +1,31 @@+// 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. +// + +// ClassMouse.h + +// + +#include "wchar.h" +#include "ClassPtr.h" +#include "EnumMouseButton.h" + + +// Check if a mouse button is pressed. +void sfml_mse_isButtonPressed(enum EnumMouseButton button_c, int * result_c); +
+ include/ClassMouseHG3D.h view
@@ -0,0 +1,30 @@+// 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. +// + +// ClassMouseHG3D.h + +// + +#include "wchar.h" +#include "ClassPtr.h" + + +// +void sfml_mshg_getPosition(int * x_c, int * y_c); +
+ include/ClassMusic.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. +// + +// ClassMusic.h + +// + +#include "wchar.h" +#include "ClassPtr.h" + + +// Default constructor. +void sfml_msc_construct(struct hg3dclass_struct * result_c); + +// Destructor. +void sfml_msc_destruct(struct hg3dclass_struct * thisclass_c); + +// Open a music from an audio file. +void sfml_msc_openFromFile(struct hg3dclass_struct * thisclass_c, char * filename_c, int * result_c); +
+ include/ClassPtr.h view
@@ -0,0 +1,69 @@+// 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. +// + +// ClassPtr.h + +// Here are the methods defined, which do the class pointer +// marshalling and the casting of subclasses to higher classes + +#include "wchar.h" + + +#ifndef CLASSPTR_INCLUDE_H +#define CLASSPTR_INCLUDE_H + +typedef struct hg3dclass_struct { + void *ptr; + void *fptr; +} hg3dclass_struct; + +void *getHG3DClassPtr(hg3dclass_struct inSt, const char* className); + + +typedef void ClassMouseHG3D; +hg3dclass_struct getHG3DClass_MouseHG3D(void *ptrIn); + +typedef void ClassJoystick; +hg3dclass_struct getHG3DClass_Joystick(void *ptrIn); + +typedef void ClassKeyboard; +hg3dclass_struct getHG3DClass_Keyboard(void *ptrIn); + +typedef void ClassListener; +hg3dclass_struct getHG3DClass_Listener(void *ptrIn); + +typedef void ClassMouse; +hg3dclass_struct getHG3DClass_Mouse(void *ptrIn); + +typedef void ClassMusic; +hg3dclass_struct getHG3DClass_Music(void *ptrIn); + +typedef void ClassSound; +hg3dclass_struct getHG3DClass_Sound(void *ptrIn); + +typedef void ClassSoundBuffer; +hg3dclass_struct getHG3DClass_SoundBuffer(void *ptrIn); + +typedef void ClassSoundSource; +hg3dclass_struct getHG3DClass_SoundSource(void *ptrIn); + +typedef void ClassSoundStream; +hg3dclass_struct getHG3DClass_SoundStream(void *ptrIn); + +#endif
+ include/ClassSound.h view
@@ -0,0 +1,55 @@+// 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. +// + +// ClassSound.h + +// + +#include "wchar.h" +#include "ClassPtr.h" +#include "ClassSoundBuffer.h" + + +// Default constructor. +void sfml_snd_construct(struct hg3dclass_struct * result_c); + +// Destructor. +void sfml_snd_destruct(struct hg3dclass_struct * thisclass_c); + +// Start or resume playing the sound. +void sfml_snd_play(struct hg3dclass_struct * thisclass_c); + +// Pause the sound. +void sfml_snd_pause(struct hg3dclass_struct * thisclass_c); + +// Stop playing the sound. +void sfml_snd_stop(struct hg3dclass_struct * thisclass_c); + +// Set the source buffer containing the audio data to play. +void sfml_snd_setBuffer(struct hg3dclass_struct * thisclass_c, struct hg3dclass_struct * buffer_c); + +// Set whether or not the sound should loop after reaching the end. +void sfml_snd_setLoop(struct hg3dclass_struct * thisclass_c, int loop_c); + +// Tell whether or not the sound is in loop mode. +void sfml_snd_getLoop(struct hg3dclass_struct * thisclass_c, int * result_c); + +// Reset the internal buffer of the sound. +void sfml_snd_resetBuffer(struct hg3dclass_struct * thisclass_c); +
+ include/ClassSoundBuffer.h view
@@ -0,0 +1,45 @@+// 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. +// + +// ClassSoundBuffer.h + +// + +#include "wchar.h" +#include "ClassPtr.h" + + +// Default constructor. +void sfml_snbf_construct(struct hg3dclass_struct * result_c); + +// Destructor. +void sfml_snbf_destruct(struct hg3dclass_struct * thisclass_c); + +// Load the sound buffer from a file. +void sfml_snbf_loadFromFile(struct hg3dclass_struct * thisclass_c, char * filename_c, int * result_c); + +// Save the sound buffer to an audio file. +void sfml_snbf_saveToFile(struct hg3dclass_struct * thisclass_c, char * filename_c, int * result_c); + +// Get the sample rate of the sound. +void sfml_snbf_getSampleRate(struct hg3dclass_struct * thisclass_c, unsigned int * result_c); + +// Get the number of channels used by the sound. +void sfml_snbf_getChannelCount(struct hg3dclass_struct * thisclass_c, unsigned int * result_c); +
+ include/ClassSoundSource.h view
@@ -0,0 +1,63 @@+// 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. +// + +// ClassSoundSource.h + +// + +#include "wchar.h" +#include "ClassPtr.h" + + +// Destructor. +void sfml_snsr_destruct(struct hg3dclass_struct * thisclass_c); + +// Set the pitch of the sound. +void sfml_snsr_setPitch(struct hg3dclass_struct * thisclass_c, float pitch_c); + +// Set the volume of the sound. +void sfml_snsr_setVolume(struct hg3dclass_struct * thisclass_c, float volume_c); + +// Set the 3D position of the sound in the audio scene. +void sfml_snsr_setPosition(struct hg3dclass_struct * thisclass_c, float x_c, float y_c, float z_c); + +// Make the sound's position relative to the listener or absolute. +void sfml_snsr_setRelativeToListener(struct hg3dclass_struct * thisclass_c, int relative_c); + +// Set the minimum distance of the sound. +void sfml_snsr_setMinDistance(struct hg3dclass_struct * thisclass_c, float distance_c); + +// Set the attenuation factor of the sound. +void sfml_snsr_setAttenuation(struct hg3dclass_struct * thisclass_c, float attenuation_c); + +// Get the pitch of the sound. +void sfml_snsr_getPitch(struct hg3dclass_struct * thisclass_c, float * result_c); + +// Get the volume of the sound. +void sfml_snsr_getVolume(struct hg3dclass_struct * thisclass_c, float * 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); + +// Get the minimum distance of the sound. +void sfml_snsr_getMinDistance(struct hg3dclass_struct * thisclass_c, float * result_c); + +// Get the attenuation factor of the sound. +void sfml_snsr_getAttenuation(struct hg3dclass_struct * thisclass_c, float * result_c); +
+ include/ClassSoundStream.h view
@@ -0,0 +1,51 @@+// 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. +// + +// ClassSoundStream.h + +// + +#include "wchar.h" +#include "ClassPtr.h" + + +// Destructor. +void sfml_snst_destruct(struct hg3dclass_struct * thisclass_c); + +// Start or resume playing the audio stream. +void sfml_snst_play(struct hg3dclass_struct * thisclass_c); + +// Pause the audio stream. +void sfml_snst_pause(struct hg3dclass_struct * thisclass_c); + +// Stop playing the audio stream. +void sfml_snst_stop(struct hg3dclass_struct * thisclass_c); + +// Return the number of channels of the stream. +void sfml_snst_getChannelCount(struct hg3dclass_struct * thisclass_c, unsigned int * result_c); + +// Get the stream sample rate of the stream. +void sfml_snst_getSampleRate(struct hg3dclass_struct * thisclass_c, unsigned int * result_c); + +// Set whether or not the stream should loop after reaching the end. +void sfml_snst_setLoop(struct hg3dclass_struct * thisclass_c, int loop_c); + +// Tell whether or not the stream is in loop mode. +void sfml_snst_getLoop(struct hg3dclass_struct * thisclass_c, int * result_c); +
+ include/EnumJoystickAxis.h view
@@ -0,0 +1,37 @@+// 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. +// + +// EnumJoystickAxis.h + +// + +#include "wchar.h" + + +enum EnumJoystickAxis +{ + JoystickAxisX, // The X axis. + JoystickAxisY, // The Y axis. + JoystickAxisZ, // The Z axis. + JoystickAxisR, // The R axis. + JoystickAxisU, // The U axis. + JoystickAxisV, // The V axis. + JoystickAxisPovX, // The X axis of the point-of-view hat. + JoystickAxisPovY // The Y axis of the point-of-view hat. +};
+ include/EnumKey.h view
@@ -0,0 +1,131 @@+// 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. +// + +// EnumKey.h + +// + +#include "wchar.h" + + +enum EnumKey +{ + KeyA, // The A key. + KeyB, // The B key. + KeyC, // The C key. + KeyD, // The D key. + KeyE, // The E key. + KeyF, // The F key. + KeyG, // The G key. + KeyH, // The H key. + KeyI, // The I key. + KeyJ, // The J key. + KeyK, // The K key. + KeyL, // The L key. + KeyM, // The M key. + KeyN, // The N key. + KeyO, // The O key. + KeyP, // The P key. + KeyQ, // The Q key. + KeyR, // The R key. + KeyS, // The S key. + KeyT, // The T key. + KeyU, // The U key. + KeyV, // The V key. + KeyW, // The W key. + KeyX, // The X key. + KeyY, // The Y key. + KeyZ, // The Z key. + KeyNum0, // The 0 key. + KeyNum1, // The 1 key. + KeyNum2, // The 2 key. + KeyNum3, // The 3 key. + KeyNum4, // The 4 key. + KeyNum5, // The 5 key. + KeyNum6, // The 6 key. + KeyNum7, // The 7 key. + KeyNum8, // The 8 key. + KeyNum9, // The 9 key. + KeyEscape, // The Escape key. + KeyLControl, // The left Control key. + KeyLShift, // The left Shift key. + KeyLAlt, // The left Alt key. + KeyLSystem, // The left OS specific key: window (Windows and Linux), apple (MacOS X), ... + KeyRControl, // The right Control key. + KeyRShift, // The right Shift key. + KeyRAlt, // The right Alt key. + KeyRSystem, // The right OS specific key: window (Windows and Linux), apple (MacOS X), ... + KeyMenu, // The Menu 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 - key. + KeySpace, // The Space key. + KeyReturn, // The Return key. + KeyBack, // The Backspace key. + KeyTab, // The Tabulation key. + KeyPageUp, // The Page up key. + KeyPageDown, // The Page down key. + KeyEnd, // The End key. + KeyHome, // The Home key. + KeyInsert, // The Insert key. + KeyDelete, // The Delete key. + KeyAdd, // + KeySubtract, // + KeyMultiply, // + KeyDivide, // / + KeyLeft, // Left arrow. + KeyRight, // Right arrow. + KeyUp, // Up arrow. + KeyDown, // Down arrow. + KeyNumpad0, // The numpad 0 key. + KeyNumpad1, // The numpad 1 key. + KeyNumpad2, // The numpad 2 key. + KeyNumpad3, // The numpad 3 key. + KeyNumpad4, // The numpad 4 key. + KeyNumpad5, // The numpad 5 key. + KeyNumpad6, // The numpad 6 key. + KeyNumpad7, // The numpad 7 key. + KeyNumpad8, // The numpad 8 key. + KeyNumpad9, // The numpad 9 key. + KeyF1, // The F1 key. + KeyF2, // The F2 key. + KeyF3, // The F3 key. + KeyF4, // The F4 key. + KeyF5, // The F5 key. + KeyF6, // The F6 key. + KeyF7, // The F7 key. + KeyF8, // The F8 key. + KeyF9, // The F8 key. + KeyF10, // The F10 key. + KeyF11, // The F11 key. + KeyF12, // The F12 key. + KeyF13, // The F13 key. + KeyF14, // The F14 key. + KeyF15, // The F15 key. + KeyPause, // The Pause key. + KeyKeyCount // Keep last -- the total number of keyboard keys. +};
+ include/EnumMouseButton.h view
@@ -0,0 +1,35 @@+// 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. +// + +// EnumMouseButton.h + +// + +#include "wchar.h" + + +enum EnumMouseButton +{ + MouseButtonLeft, // The left mouse button. + MouseButtonRight, // The right mouse button. + MouseButtonMiddle, // The middle (wheel) mouse button. + MouseButtonXButton1, // The first extra mouse button. + MouseButtonXButton2, // The second extra mouse button. + MouseButtonButtonCount // Keep last -- the total number of mouse buttons. +};
+ include/EnumSoundSourceStatus.h view
@@ -0,0 +1,32 @@+// 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. +// + +// EnumSoundSourceStatus.h + +// + +#include "wchar.h" + + +enum EnumSoundSourceStatus +{ + SoundSourceStatusStopped, // Sound + SoundSourceStatusPaused, // Sound + SoundSourceStatusPlaying // Sound +};
+ include/SFMLDllDefines.h view
@@ -0,0 +1,41 @@+// (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. +// + + +// SFMLDllDefines.h + +#ifndef _HGamer3DSFML016_DLLDEFINES_H_ +#define _HGamer3DSFML016_DLLDEFINES_H_ + +/* Cmake will define HGamer3DSFML016_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 +building a DLL on windows. +*/ + +// We are using the Visual Studio Compiler and building Shared libraries + +#if (defined (_WIN32)) && !(defined (__GNUC__)) + #if defined(HGamer3DSFML016_EXPORTS) + #define SFML_LIB_EXPORT __declspec(dllexport) + #else + #define SFML_LIB_EXPORT __declspec(dllimport) + #endif /* HGamer3DSFML016_EXPORTS */ +#else /* defined (_WIN32) */ + #define SFML_LIB_EXPORT +#endif + +#endif /* _HGamer3DSFML016_DLLDEFINES_H_ */
+ include/StructHG3DClass.h view
@@ -0,0 +1,30 @@+// 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. +// + +// StructHG3DClass.h + +// + +#include "wchar.h" + + +typedef struct hg3dclass_struct { + void *ptr; + void *fptr; +} hg3dclass_struct;