HGamer3D-SDL2-Binding (empty) → 0.3.0
raw patch · 41 files changed
+2078/−0 lines, 41 filesdep +HGamer3D-Datadep +basedep +bytestringsetup-changed
Dependencies added: HGamer3D-Data, base, bytestring, utf8-string
Files
- HGamer3D-SDL2-Binding.cabal +38/−0
- HGamer3D/Bindings/SDL2/ClassHG3DUtilities.chs +48/−0
- HGamer3D/Bindings/SDL2/ClassPtr.chs +45/−0
- HGamer3D/Bindings/SDL2/EnumSDLBlendMode.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLEventType.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLGLAttr.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLGLProfile.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLGameControllerAxis.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLGameControllerBindType.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLGameControllerButton.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLGlContextFlag.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLHintPriority.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLKeymod.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLLogPriority.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLMessageBoxButtonFlags.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLMessageBoxColorType.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLMessageBoxFlags.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLPowerState.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLRendererFlags.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLRendererFlip.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLScancode.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLSysWMType.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLSystemCursor.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLTextureAccess.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLTextureModulate.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLThreadPriority.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLWindowEventID.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLWindowFlags.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLWindowShapeMode.chs +41/−0
- HGamer3D/Bindings/SDL2/HeaderSDL.chs +66/−0
- HGamer3D/Bindings/SDL2/HeaderSDLEvents.chs +83/−0
- HGamer3D/Bindings/SDL2/HeaderSDLKeyboard.chs +55/−0
- HGamer3D/Bindings/SDL2/HeaderSDLMouse.chs +70/−0
- HGamer3D/Bindings/SDL2/HeaderSDLVideo.chs +230/−0
- HGamer3D/Bindings/SDL2/StructHG3DClass.chs +52/−0
- HGamer3D/Bindings/SDL2/StructSDLEvent.chs +152/−0
- HGamer3D/Bindings/SDL2/Utils.chs +132/−0
- LICENSE +13/−0
- Setup.hs +21/−0
- include/hg3dstruct.h +4/−0
- include/sdlevent_struct.h +3/−0
+ HGamer3D-SDL2-Binding.cabal view
@@ -0,0 +1,38 @@+Name: HGamer3D-SDL2-Binding +Version: 0.3.0 +Synopsis: SDL2 Binding for HGamer3D +Description: + HGamer3D is a game engine for developing 3D games in the programming + language Haskell. This package provides the SDL2 binding. + HGamer3D-SDL2-Binding is available on Windows and Linux. + This binding does not claim to have full coverage of SDL2 + functionality, but only to support what is needed for the+ HGamer3D-WinEvent package.+ + +License: OtherLicense +License-file: LICENSE +Author: Peter Althainz +Maintainer: althainz@gmail.com +Build-Type: Simple +Cabal-Version: >=1.4 +Homepage: http://www.hgamer3d.org +Category: Game Engine +Extra-source-files: Setup.hs, include/sdlevent_struct.h, include/hg3dstruct.h + +Library + Build-Depends: base >= 3 && < 5, utf8-string, bytestring, HGamer3D-Data >= 0.3.0 + + Exposed-modules: HGamer3D.Bindings.SDL2.Utils, HGamer3D.Bindings.SDL2.StructHG3DClass, HGamer3D.Bindings.SDL2.ClassPtr, HGamer3D.Bindings.SDL2.EnumSDLSysWMType, HGamer3D.Bindings.SDL2.EnumSDLMessageBoxFlags, HGamer3D.Bindings.SDL2.EnumSDLWindowFlags, HGamer3D.Bindings.SDL2.EnumSDLTextureModulate, HGamer3D.Bindings.SDL2.EnumSDLGLProfile, HGamer3D.Bindings.SDL2.EnumSDLLogPriority, HGamer3D.Bindings.SDL2.EnumSDLPowerState, HGamer3D.Bindings.SDL2.EnumSDLGlContextFlag, HGamer3D.Bindings.SDL2.EnumSDLGameControllerButton, HGamer3D.Bindings.SDL2.EnumSDLScancode, HGamer3D.Bindings.SDL2.EnumSDLBlendMode, HGamer3D.Bindings.SDL2.EnumSDLKeymod, HGamer3D.Bindings.SDL2.EnumSDLWindowEventID, HGamer3D.Bindings.SDL2.EnumSDLGLAttr, HGamer3D.Bindings.SDL2.EnumSDLWindowShapeMode, HGamer3D.Bindings.SDL2.EnumSDLMessageBoxColorType, HGamer3D.Bindings.SDL2.EnumSDLHintPriority, HGamer3D.Bindings.SDL2.EnumSDLRendererFlags, HGamer3D.Bindings.SDL2.EnumSDLSystemCursor, HGamer3D.Bindings.SDL2.EnumSDLEventType, HGamer3D.Bindings.SDL2.EnumSDLMessageBoxButtonFlags, HGamer3D.Bindings.SDL2.EnumSDLGameControllerAxis, HGamer3D.Bindings.SDL2.EnumSDLThreadPriority, HGamer3D.Bindings.SDL2.EnumSDLGameControllerBindType, HGamer3D.Bindings.SDL2.EnumSDLTextureAccess, HGamer3D.Bindings.SDL2.EnumSDLRendererFlip, HGamer3D.Bindings.SDL2.StructSDLEvent, HGamer3D.Bindings.SDL2.HeaderSDLEvents, HGamer3D.Bindings.SDL2.HeaderSDL, HGamer3D.Bindings.SDL2.HeaderSDLVideo, HGamer3D.Bindings.SDL2.HeaderSDLKeyboard, HGamer3D.Bindings.SDL2.HeaderSDLMouse, HGamer3D.Bindings.SDL2.ClassHG3DUtilities + Other-modules: + + ghc-options: + cc-options: -Wno-attributes + hs-source-dirs: . + Include-dirs: include + Build-tools: + build-depends: + if os(windows) + extra-libraries: hg3dsdl2030 + else + extra-libraries: hg3dsdl2030,:libSDL2-2.0.so.1,X11
+ HGamer3D/Bindings/SDL2/ClassHG3DUtilities.chs view
@@ -0,0 +1,48 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- ClassHG3DUtilities.chs + +-- + +module HGamer3D.Bindings.SDL2.ClassHG3DUtilities 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 HGamer3D.Bindings.SDL2.Utils #}+{# import HGamer3D.Bindings.SDL2.ClassPtr #}+{# import HGamer3D.Bindings.SDL2.StructHG3DClass #}+ +#include "ClassHG3DUtilities.h" +{- function createWindowFromHandle -}+{#fun sdl2_hg3dutl_createWindowFromHandle as createWindowFromHandle +{ fromIntegral `Int' ,+ alloca- `Ptr SDLWindow' peekSDLWindowPtr*} -> `()' #}+
+ HGamer3D/Bindings/SDL2/ClassPtr.chs view
@@ -0,0 +1,45 @@+{-# LANGUAGE EmptyDataDecls #-}+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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.SDL2.ClassPtr 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 HGamer3D.Bindings.SDL2.Utils #}+ +#include "ClassPtr.h" +data SDLWindow+peekSDLWindowPtr :: Ptr (Ptr () ) -> IO (Ptr SDLWindow)+peekSDLWindowPtr inp = do { ptr <- peek inp; return $ castPtr ptr }
+ HGamer3D/Bindings/SDL2/EnumSDLBlendMode.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLBlendMode.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLBlendMode 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 + + +#include "EnumSDLBlendMode.h" +{#enum EnumSDLBlendMode {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLEventType.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLEventType.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLEventType 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 + + +#include "EnumSDLEventType.h" +{#enum EnumSDLEventType {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLGLAttr.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLGLAttr.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLGLAttr 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 + + +#include "EnumSDLGLAttr.h" +{#enum EnumSDLGLAttr {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLGLProfile.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLGLProfile.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLGLProfile 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 + + +#include "EnumSDLGLProfile.h" +{#enum EnumSDLGLProfile {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLGameControllerAxis.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLGameControllerAxis.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLGameControllerAxis 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 + + +#include "EnumSDLGameControllerAxis.h" +{#enum EnumSDLGameControllerAxis {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLGameControllerBindType.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLGameControllerBindType.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLGameControllerBindType 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 + + +#include "EnumSDLGameControllerBindType.h" +{#enum EnumSDLGameControllerBindType {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLGameControllerButton.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLGameControllerButton.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLGameControllerButton 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 + + +#include "EnumSDLGameControllerButton.h" +{#enum EnumSDLGameControllerButton {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLGlContextFlag.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLGlContextFlag.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLGlContextFlag 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 + + +#include "EnumSDLGlContextFlag.h" +{#enum EnumSDLGlContextFlag {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLHintPriority.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLHintPriority.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLHintPriority 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 + + +#include "EnumSDLHintPriority.h" +{#enum EnumSDLHintPriority {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLKeymod.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLKeymod.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLKeymod 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 + + +#include "EnumSDLKeymod.h" +{#enum EnumSDLKeymod {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLLogPriority.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLLogPriority.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLLogPriority 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 + + +#include "EnumSDLLogPriority.h" +{#enum EnumSDLLogPriority {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLMessageBoxButtonFlags.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLMessageBoxButtonFlags.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLMessageBoxButtonFlags 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 + + +#include "EnumSDLMessageBoxButtonFlags.h" +{#enum EnumSDLMessageBoxButtonFlags {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLMessageBoxColorType.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLMessageBoxColorType.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLMessageBoxColorType 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 + + +#include "EnumSDLMessageBoxColorType.h" +{#enum EnumSDLMessageBoxColorType {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLMessageBoxFlags.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLMessageBoxFlags.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLMessageBoxFlags 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 + + +#include "EnumSDLMessageBoxFlags.h" +{#enum EnumSDLMessageBoxFlags {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLPowerState.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLPowerState.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLPowerState 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 + + +#include "EnumSDLPowerState.h" +{#enum EnumSDLPowerState {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLRendererFlags.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLRendererFlags.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLRendererFlags 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 + + +#include "EnumSDLRendererFlags.h" +{#enum EnumSDLRendererFlags {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLRendererFlip.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLRendererFlip.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLRendererFlip 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 + + +#include "EnumSDLRendererFlip.h" +{#enum EnumSDLRendererFlip {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLScancode.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLScancode.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLScancode 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 + + +#include "EnumSDLScancode.h" +{#enum EnumSDLScancode {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLSysWMType.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLSysWMType.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLSysWMType 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 + + +#include "EnumSDLSysWMType.h" +{#enum EnumSDLSysWMType {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLSystemCursor.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLSystemCursor.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLSystemCursor 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 + + +#include "EnumSDLSystemCursor.h" +{#enum EnumSDLSystemCursor {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLTextureAccess.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLTextureAccess.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLTextureAccess 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 + + +#include "EnumSDLTextureAccess.h" +{#enum EnumSDLTextureAccess {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLTextureModulate.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLTextureModulate.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLTextureModulate 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 + + +#include "EnumSDLTextureModulate.h" +{#enum EnumSDLTextureModulate {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLThreadPriority.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLThreadPriority.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLThreadPriority 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 + + +#include "EnumSDLThreadPriority.h" +{#enum EnumSDLThreadPriority {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLWindowEventID.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLWindowEventID.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLWindowEventID 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 + + +#include "EnumSDLWindowEventID.h" +{#enum EnumSDLWindowEventID {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLWindowFlags.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLWindowFlags.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLWindowFlags 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 + + +#include "EnumSDLWindowFlags.h" +{#enum EnumSDLWindowFlags {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLWindowShapeMode.chs view
@@ -0,0 +1,41 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- EnumSDLWindowShapeMode.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLWindowShapeMode 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 + + +#include "EnumSDLWindowShapeMode.h" +{#enum EnumSDLWindowShapeMode {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/HeaderSDL.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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- HeaderSDL.chs + +-- + +module HGamer3D.Bindings.SDL2.HeaderSDL 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 HGamer3D.Bindings.SDL2.Utils #}+{# import HGamer3D.Bindings.SDL2.ClassPtr #}+{# import HGamer3D.Bindings.SDL2.StructHG3DClass #}+ +#include "HeaderSDL.h" +{- function sdl_Init -}+{#fun fsdl_sdl_Init as sdlInit +{ fromIntegral `Int' ,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_InitSubSystem -}+{#fun fsdl_sdl_InitSubSystem as sdlInitSubSystem +{ fromIntegral `Int' ,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_QuitSubSystem -}+{#fun fsdl_sdl_QuitSubSystem as sdlQuitSubSystem +{ fromIntegral `Int' } -> `()' #}++{- function sdl_WasInit -}+{#fun fsdl_sdl_WasInit as sdlWasInit +{ fromIntegral `Int' ,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_Quit -}+{#fun fsdl_sdl_Quit as sdlQuit +{ } -> `()' #}+
+ HGamer3D/Bindings/SDL2/HeaderSDLEvents.chs view
@@ -0,0 +1,83 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- HeaderSDLEvents.chs + +-- + +module HGamer3D.Bindings.SDL2.HeaderSDLEvents 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 HGamer3D.Bindings.SDL2.Utils #}+{# import HGamer3D.Bindings.SDL2.ClassPtr #}+{# import HGamer3D.Bindings.SDL2.StructHG3DClass #}+{# import HGamer3D.Bindings.SDL2.StructSDLEvent #}+ +#include "HeaderSDLEvents.h" +{- function sdl_PumpEvents -}+{#fun sdlevts_sdl_PumpEvents as sdlPumpEvents +{ } -> `()' #}++{- function sdl_FlushEvent -}+{#fun sdlevts_sdl_FlushEvent as sdlFlushEvent +{ fromIntegral `Int' } -> `()' #}++{- function sdl_FlushEvents -}+{#fun sdlevts_sdl_FlushEvents as sdlFlushEvents +{ fromIntegral `Int' ,+ fromIntegral `Int' } -> `()' #}++{- function sdl_PollEvent -}+{#fun sdlevts_sdl_PollEvent as sdlPollEvent +{ alloca- `SDLEvent' peekSDLEvent*,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_WaitEvent -}+{#fun sdlevts_sdl_WaitEvent as sdlWaitEvent +{ alloca- `SDLEvent' peekSDLEvent*,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_WaitEventTimeout -}+{#fun sdlevts_sdl_WaitEventTimeout as sdlWaitEventTimeout +{ alloca- `SDLEvent' peekSDLEvent*,+ fromIntegral `Int' ,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_PushEvent -}+{#fun sdlevts_sdl_PushEvent as sdlPushEvent +{ alloca- `SDLEvent' peekSDLEvent*,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_RegisterEvents -}+{#fun sdlevts_sdl_RegisterEvents as sdlRegisterEvents +{ fromIntegral `Int' ,+ alloca- `Int' peekIntConv*} -> `()' #}+
+ HGamer3D/Bindings/SDL2/HeaderSDLKeyboard.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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- HeaderSDLKeyboard.chs + +-- + +module HGamer3D.Bindings.SDL2.HeaderSDLKeyboard 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 HGamer3D.Bindings.SDL2.Utils #}+{# import HGamer3D.Bindings.SDL2.ClassPtr #}+{# import HGamer3D.Bindings.SDL2.StructHG3DClass #}+ +#include "HeaderSDLKeyboard.h" +{- function sdl_GetKeyboardFocus -}+{#fun skbd_sdl_GetKeyboardFocus as sdlGetKeyboardFocus +{ alloca- `Ptr SDLWindow' peekSDLWindowPtr*} -> `()' #}++{- function sdl_StartTextInput -}+{#fun skbd_sdl_StartTextInput as sdlStartTextInput +{ } -> `()' #}++{- function sdl_StopTextInput -}+{#fun skbd_sdl_StopTextInput as sdlStopTextInput +{ } -> `()' #}+
+ HGamer3D/Bindings/SDL2/HeaderSDLMouse.chs view
@@ -0,0 +1,70 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- HeaderSDLMouse.chs + +-- + +module HGamer3D.Bindings.SDL2.HeaderSDLMouse 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 HGamer3D.Bindings.SDL2.Utils #}+{# import HGamer3D.Bindings.SDL2.ClassPtr #}+{# import HGamer3D.Bindings.SDL2.StructHG3DClass #}+ +#include "HeaderSDLMouse.h" +{- function sdl_GetMouseFocus -}+{#fun sdlms_sdl_GetMouseFocus as sdlGetMouseFocus +{ alloca- `Ptr SDLWindow' peekSDLWindowPtr*} -> `()' #}++{- function sdl_GetMouseState -}+{#fun sdlms_sdl_GetMouseState as sdlGetMouseState +{ alloca- `Int' peekIntConv*,+ alloca- `Int' peekIntConv*,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_GetRelativeMouseState -}+{#fun sdlms_sdl_GetRelativeMouseState as sdlGetRelativeMouseState +{ alloca- `Int' peekIntConv*,+ alloca- `Int' peekIntConv*,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_WarpMouseInWindow -}+{#fun sdlms_sdl_WarpMouseInWindow as sdlWarpMouseInWindow +{ castPtr `Ptr SDLWindow' ,+ fromIntegral `Int' ,+ fromIntegral `Int' } -> `()' #}++{- function sdl_ShowCursor -}+{#fun sdlms_sdl_ShowCursor as sdlShowCursor +{ fromIntegral `Int' ,+ alloca- `Int' peekIntConv*} -> `()' #}+
+ HGamer3D/Bindings/SDL2/HeaderSDLVideo.chs view
@@ -0,0 +1,230 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- HeaderSDLVideo.chs + +-- + +module HGamer3D.Bindings.SDL2.HeaderSDLVideo 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 HGamer3D.Bindings.SDL2.Utils #}+{# import HGamer3D.Bindings.SDL2.ClassPtr #}+{# import HGamer3D.Bindings.SDL2.StructHG3DClass #}+ +#include "HeaderSDLVideo.h" +{- function sdl_GetNumVideoDrivers -}+{#fun fsdlvid_sdl_GetNumVideoDrivers as sdlGetNumVideoDrivers +{ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_GetVideoDriver -}+{#fun fsdlvid_sdl_GetVideoDriver as sdlGetVideoDriver +{ fromIntegral `Int' ,+ alloc64k- `String' peekCString*} -> `()' #}++{- function sdl_VideoInit -}+{#fun fsdlvid_sdl_VideoInit as sdlVideoInit +{ withCString* `String' ,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_VideoQuit -}+{#fun fsdlvid_sdl_VideoQuit as sdlVideoQuit +{ } -> `()' #}++{- function sdl_GetCurrentVideoDriver -}+{#fun fsdlvid_sdl_GetCurrentVideoDriver as sdlGetCurrentVideoDriver +{ alloc64k- `String' peekCString*} -> `()' #}++{- function sdl_GetNumVideoDisplays -}+{#fun fsdlvid_sdl_GetNumVideoDisplays as sdlGetNumVideoDisplays +{ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_GetDisplayName -}+{#fun fsdlvid_sdl_GetDisplayName as sdlGetDisplayName +{ fromIntegral `Int' ,+ alloc64k- `String' peekCString*} -> `()' #}++{- function sdl_GetNumDisplayModes -}+{#fun fsdlvid_sdl_GetNumDisplayModes as sdlGetNumDisplayModes +{ fromIntegral `Int' ,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_GetWindowDisplayIndex -}+{#fun fsdlvid_sdl_GetWindowDisplayIndex as sdlGetWindowDisplayIndex +{ castPtr `Ptr SDLWindow' ,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_GetWindowPixelFormat -}+{#fun fsdlvid_sdl_GetWindowPixelFormat as sdlGetWindowPixelFormat +{ castPtr `Ptr SDLWindow' ,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_CreateWindow -}+{#fun fsdlvid_sdl_CreateWindow as sdlCreateWindow +{ withCString* `String' ,+ fromIntegral `Int' ,+ fromIntegral `Int' ,+ fromIntegral `Int' ,+ fromIntegral `Int' ,+ fromIntegral `Int' ,+ alloca- `Ptr SDLWindow' peekSDLWindowPtr*} -> `()' #}++{- function sdl_GetWindowID -}+{#fun fsdlvid_sdl_GetWindowID as sdlGetWindowID +{ castPtr `Ptr SDLWindow' ,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_GetWindowFromID -}+{#fun fsdlvid_sdl_GetWindowFromID as sdlGetWindowFromID +{ fromIntegral `Int' ,+ alloca- `Ptr SDLWindow' peekSDLWindowPtr*} -> `()' #}++{- function sdl_GetWindowFlags -}+{#fun fsdlvid_sdl_GetWindowFlags as sdlGetWindowFlags +{ castPtr `Ptr SDLWindow' ,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_SetWindowTitle -}+{#fun fsdlvid_sdl_SetWindowTitle as sdlSetWindowTitle +{ castPtr `Ptr SDLWindow' ,+ withCString* `String' } -> `()' #}++{- function sdl_GetWindowTitle -}+{#fun fsdlvid_sdl_GetWindowTitle as sdlGetWindowTitle +{ castPtr `Ptr SDLWindow' ,+ alloc64k- `String' peekCString*} -> `()' #}++{- function sdl_SetWindowPosition -}+{#fun fsdlvid_sdl_SetWindowPosition as sdlSetWindowPosition +{ castPtr `Ptr SDLWindow' ,+ fromIntegral `Int' ,+ fromIntegral `Int' } -> `()' #}++{- function sdl_GetWindowPosition -}+{#fun fsdlvid_sdl_GetWindowPosition as sdlGetWindowPosition +{ castPtr `Ptr SDLWindow' ,+ alloca- `Int' peekIntConv*,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_SetWindowSize -}+{#fun fsdlvid_sdl_SetWindowSize as sdlSetWindowSize +{ castPtr `Ptr SDLWindow' ,+ fromIntegral `Int' ,+ fromIntegral `Int' } -> `()' #}++{- function sdl_GetWindowSize -}+{#fun fsdlvid_sdl_GetWindowSize as sdlGetWindowSize +{ castPtr `Ptr SDLWindow' ,+ alloca- `Int' peekIntConv*,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_SetWindowMinimumSize -}+{#fun fsdlvid_sdl_SetWindowMinimumSize as sdlSetWindowMinimumSize +{ castPtr `Ptr SDLWindow' ,+ fromIntegral `Int' ,+ fromIntegral `Int' } -> `()' #}++{- function sdl_GetWindowMinimumSize -}+{#fun fsdlvid_sdl_GetWindowMinimumSize as sdlGetWindowMinimumSize +{ castPtr `Ptr SDLWindow' ,+ alloca- `Int' peekIntConv*,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_SetWindowMaximumSize -}+{#fun fsdlvid_sdl_SetWindowMaximumSize as sdlSetWindowMaximumSize +{ castPtr `Ptr SDLWindow' ,+ fromIntegral `Int' ,+ fromIntegral `Int' } -> `()' #}++{- function sdl_GetWindowMaximumSize -}+{#fun fsdlvid_sdl_GetWindowMaximumSize as sdlGetWindowMaximumSize +{ castPtr `Ptr SDLWindow' ,+ alloca- `Int' peekIntConv*,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_ShowWindow -}+{#fun fsdlvid_sdl_ShowWindow as sdlShowWindow +{ castPtr `Ptr SDLWindow' } -> `()' #}++{- function sdl_HideWindow -}+{#fun fsdlvid_sdl_HideWindow as sdlHideWindow +{ castPtr `Ptr SDLWindow' } -> `()' #}++{- function sdl_RaiseWindow -}+{#fun fsdlvid_sdl_RaiseWindow as sdlRaiseWindow +{ castPtr `Ptr SDLWindow' } -> `()' #}++{- function sdl_MaximizeWindow -}+{#fun fsdlvid_sdl_MaximizeWindow as sdlMaximizeWindow +{ castPtr `Ptr SDLWindow' } -> `()' #}++{- function sdl_MinimizeWindow -}+{#fun fsdlvid_sdl_MinimizeWindow as sdlMinimizeWindow +{ castPtr `Ptr SDLWindow' } -> `()' #}++{- function sdl_RestoreWindow -}+{#fun fsdlvid_sdl_RestoreWindow as sdlRestoreWindow +{ castPtr `Ptr SDLWindow' } -> `()' #}++{- function sdl_SetWindowFullscreen -}+{#fun fsdlvid_sdl_SetWindowFullscreen as sdlSetWindowFullscreen +{ castPtr `Ptr SDLWindow' ,+ fromIntegral `Int' ,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_UpdateWindowSurface -}+{#fun fsdlvid_sdl_UpdateWindowSurface as sdlUpdateWindowSurface +{ castPtr `Ptr SDLWindow' ,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_SetWindowBrightness -}+{#fun fsdlvid_sdl_SetWindowBrightness as sdlSetWindowBrightness +{ castPtr `Ptr SDLWindow' ,+ realToFrac `Float' ,+ alloca- `Int' peekIntConv*} -> `()' #}++{- function sdl_GetWindowBrightness -}+{#fun fsdlvid_sdl_GetWindowBrightness as sdlGetWindowBrightness +{ castPtr `Ptr SDLWindow' ,+ alloca- `Float' peekFloatConv*} -> `()' #}++{- function sdl_DestroyWindow -}+{#fun fsdlvid_sdl_DestroyWindow as sdlDestroyWindow +{ castPtr `Ptr SDLWindow' } -> `()' #}++{- function sdl_EnableScreenSaver -}+{#fun fsdlvid_sdl_EnableScreenSaver as sdlEnableScreenSaver +{ } -> `()' #}++{- function sdl_DisableScreenSaver -}+{#fun fsdlvid_sdl_DisableScreenSaver as sdlDisableScreenSaver +{ } -> `()' #}+
+ HGamer3D/Bindings/SDL2/StructHG3DClass.chs view
@@ -0,0 +1,52 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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.SDL2.StructHG3DClass 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 + + +#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++peekHG3DClass :: HG3DClassPtr -> IO HG3DClass+peekHG3DClass = peek+
+ HGamer3D/Bindings/SDL2/StructSDLEvent.chs view
@@ -0,0 +1,152 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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. +-- + + +-- StructSDLEvent.chs + +-- + +module HGamer3D.Bindings.SDL2.StructSDLEvent 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 + + +#include "StructSDLEvent.h" ++import HGamer3D.Data++import HGamer3D.Bindings.SDL2.EnumSDLEventType+import HGamer3D.Bindings.SDL2.EnumSDLKeymod+import HGamer3D.Bindings.SDL2.EnumSDLScancode+import HGamer3D.Bindings.SDL2.EnumSDLWindowEventID++import Control.Monad+import Control.Applicative+import Control.Exception++import qualified Data.ByteString.Char8 as BSC8+import qualified Data.String.UTF8 as UTF8++import Foreign.Storable+import Foreign.C.Types+import Foreign.Ptr++type Keycode = Word32+type Keymod = Word16++type MouseID = Int++data SDLButton = SDLButtonLeft | SDLButtonRight | SDLButtonMiddle | SDLButtonX1 | SDLButtonX2 | SDLButtonNumber Int deriving (Eq, Show)++_getButton :: Word8 -> SDLButton+_getButton w = case w of+ 1 -> SDLButtonLeft+ 2 -> SDLButtonMiddle+ 3 -> SDLButtonRight+ 4 -> SDLButtonX1+ 5 -> SDLButtonX2+ _ -> SDLButtonNumber ((fromIntegral . toInteger) w)++data SDLEvent = EvtKeyUp TimeMS Window EnumSDLScancode Keycode Keymod |+ EvtKeyDown TimeMS Window EnumSDLScancode Keycode Keymod |+ EvtText TimeMS Window String | + EvtQuit TimeMS |+ EvtWindow TimeMS Window EnumSDLWindowEventID Int Int |+ EvtMouseButtonDown TimeMS Window MouseID SDLButton Int Int |+ EvtMouseButtonUp TimeMS Window MouseID SDLButton Int Int |+ EvtMouseMotion TimeMS Window MouseID Int Int Int Int | + EvtCommon TimeMS EnumSDLEventType |+ EvtNotValid++instance Storable SDLEvent where+ sizeOf _ = 56+ alignment _ = 4+ + peek p = do+ typ <- (peekByteOff p 0 :: IO CUInt)+ time <- (peekByteOff p 4 :: IO CUInt)+ Control.Exception.catch (do+ let evttyp = (toEnum . fromIntegral . toInteger) typ -- this first throws exception if enum not ok !+ let t = TimeMS ((fromIntegral . toInteger) time)++ case (evttyp) of+ SDL_QUIT -> return $ EvtQuit t+ SDL_KEYDOWN -> EvtKeyDown <$> return t+ <*> fmap (Window . fromIntegral . toInteger) (peekByteOff p 8 :: IO CUInt)+ <*> fmap (toEnum . fromIntegral . toInteger) (peekByteOff p 16 :: IO CUInt)+ <*> fmap (toEnum . fromIntegral . toInteger) (peekByteOff p 20 :: IO Keycode)+ <*> fmap (toEnum . fromIntegral . toInteger) (peekByteOff p 24 :: IO Keymod)+ SDL_KEYUP -> EvtKeyUp <$> return t+ <*> fmap (Window . fromIntegral . toInteger) (peekByteOff p 8 :: IO CUInt)+ <*> fmap (toEnum . fromIntegral . toInteger) (peekByteOff p 16 :: IO CUInt)+ <*> fmap (toEnum . fromIntegral . toInteger) (peekByteOff p 20 :: IO Keycode)+ <*> fmap (toEnum . fromIntegral . toInteger) (peekByteOff p 24 :: IO Keymod)+ SDL_WINDOWEVENT -> EvtWindow <$> return t+ <*> fmap (Window . fromIntegral . toInteger) (peekByteOff p 8 :: IO CUInt)+ <*> fmap (toEnum . fromIntegral . toInteger) (peekByteOff p 12 :: IO Word8)+ <*> fmap (fromIntegral . toInteger) (peekByteOff p 16 :: IO CInt)+ <*> fmap (fromIntegral . toInteger) (peekByteOff p 20 :: IO CInt)+ SDL_TEXTINPUT -> EvtText <$> return t+ <*> fmap (Window . fromIntegral . toInteger) (peekByteOff p 8 :: IO CUInt)+ -- this text conversion is neccessary, the C-String of the event contains a UTF8-encoding+ -- with BSC8.pack the string is converted to ByteString without additional UTF8-encoding+ -- the remaining decoding, creates a normal (Unicode) Haskell string from that+ <*> fmap (UTF8.toString . UTF8.fromRep . BSC8.pack) (peekCAString (castPtr (plusPtr p 12)) )+ SDL_MOUSEBUTTONDOWN -> EvtMouseButtonDown <$> return t+ <*> fmap (Window . fromIntegral . toInteger) (peekByteOff p 8 :: IO CUInt)+ <*> fmap (fromIntegral . toInteger) (peekByteOff p 12 :: IO CUInt )+ <*> fmap _getButton (peekByteOff p 16 :: IO Word8)+ <*> fmap (fromIntegral . toInteger) (peekByteOff p 20 :: IO CInt)+ <*> fmap (fromIntegral . toInteger) (peekByteOff p 24 :: IO CInt)+ SDL_MOUSEBUTTONUP -> EvtMouseButtonUp <$> return t+ <*> fmap (Window . fromIntegral . toInteger) (peekByteOff p 8 :: IO CUInt)+ <*> fmap (fromIntegral . toInteger) (peekByteOff p 12 :: IO CUInt )+ <*> fmap _getButton (peekByteOff p 16 :: IO Word8)+ <*> fmap (fromIntegral . toInteger) (peekByteOff p 20 :: IO CInt)+ <*> fmap (fromIntegral . toInteger) (peekByteOff p 24 :: IO CInt)+ SDL_MOUSEMOTION -> EvtMouseMotion <$> return t+ <*> fmap (Window . fromIntegral . toInteger) (peekByteOff p 8 :: IO CUInt)+ <*> fmap (fromIntegral . toInteger) (peekByteOff p 12 :: IO CUInt )+ <*> fmap (fromIntegral . toInteger) (peekByteOff p 20 :: IO CInt)+ <*> fmap (fromIntegral . toInteger) (peekByteOff p 24 :: IO CInt)+ <*> fmap (fromIntegral . toInteger) (peekByteOff p 28 :: IO CInt)+ <*> fmap (fromIntegral . toInteger) (peekByteOff p 32 :: IO CInt)+ _ -> return $ EvtCommon t evttyp+ ) ((\e -> return EvtNotValid) ::(SomeException -> IO SDLEvent))++ poke p evt = error "poke of SDLEvent not implemented"+ +{#pointer *sdlevent_struct as SDLEventPtr -> SDLEvent #}++withSDLEvent :: SDLEvent -> (SDLEventPtr -> IO b) -> IO b+withSDLEvent = with++peekSDLEvent :: SDLEventPtr -> IO SDLEvent+peekSDLEvent = peek+
+ HGamer3D/Bindings/SDL2/Utils.chs view
@@ -0,0 +1,132 @@+{-# 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.hgamer3d.org . +-- + +-- (c) 2011-2014 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.SDL2.Utils 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 + + +#include "StructHG3DClass.h" ++import Control.Monad (liftM)++-- 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+++-- 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++-- Conversion routines+-- -------------------++-- |Integral conversion+--+cIntConv :: (Integral a, Integral b) => a -> b+cIntConv = fromIntegral++-- |Floating conversion+--+cFloatConv :: (RealFloat a, RealFloat b) => a -> b+cFloatConv = realToFrac++-- |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+
+ LICENSE view
@@ -0,0 +1,13 @@+(c) 2011-2014 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,21 @@+-- This source file is part of HGamer3D, a project to enable 3D game development +-- in Haskell. For the latest info, see http://www.hgamer3d.org . +-- +-- (c) 2011-2014 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/hg3dstruct.h view
@@ -0,0 +1,4 @@+typedef struct hg3dclass_struct {+ void *ptr;+ void *fptr;+} hg3dclass_struct;
+ include/sdlevent_struct.h view
@@ -0,0 +1,3 @@+typedef struct sdlevent_struct { + unsigned int sdl_event_data[14]; +} sdlevent_struct;