HGamer3D-SDL2-Binding 0.3.3 → 0.4.0
raw patch · 9 files changed
+275/−22 lines, 9 filesdep ~HGamer3D-Data
Dependency ranges changed: HGamer3D-Data
Files
- HGamer3D-SDL2-Binding.cabal +6/−6
- HGamer3D/Bindings/SDL2/EnumSDLLogCategory.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLPacketLayout.chs +41/−0
- HGamer3D/Bindings/SDL2/EnumSDLPixelFormat.chs +41/−0
- HGamer3D/Bindings/SDL2/StructSDLEvent.chs +11/−10
- include/EnumSDLLogCategory.h +51/−0
- include/EnumSDLPacketLayout.h +38/−0
- include/EnumSDLPixelFormat.h +40/−0
- include/SDL2DllDefines.h +6/−6
HGamer3D-SDL2-Binding.cabal view
@@ -1,5 +1,5 @@ Name: HGamer3D-SDL2-Binding -Version: 0.3.3 +Version: 0.4.0 Synopsis: SDL2 Binding for HGamer3D Description: HGamer3D is a game engine for developing 3D games in the programming @@ -18,12 +18,12 @@ Cabal-Version: >=1.4 Homepage: http://www.hgamer3d.org Category: Game Engine -Extra-source-files: Setup.hs, include/HeaderSDLEvents.h, include/EnumSDLRendererFlags.h, include/StructHG3DClass.h, include/EnumSDLLogPriority.h, include/EnumSDLWindowShapeMode.h, include/HG3DUtilities.h, include/StructSDLEvent.h, include/HeaderSDL.h, include/EnumSDLMessageBoxColorType.h, include/EnumSDLThreadPriority.h, include/sdlevent_struct.h, include/HeaderSDLVideo.h, include/EnumSDLBlendMode.h, include/EnumSDLEventType.h, include/EnumSDLKeycode.h, include/EnumSDLHintPriority.h, include/EnumSDLGLAttr.h, include/EnumSDLWindowEventID.h, include/EnumSDLTextureAccess.h, include/EnumSDLRendererFlip.h, include/EnumSDLMessageBoxFlags.h, include/SDL2DllDefines.h, include/EnumSDLPowerState.h, include/EnumSDLSystemCursor.h, include/EnumSDLGameControllerButton.h, include/EnumSDLTextureModulate.h, include/HeaderSDLKeyboard.h, include/EnumSDLKeymod.h, include/EnumSDLGameControllerAxis.h, include/EnumSDLScancode.h, include/EnumSDLGLProfile.h, include/EnumSDLWindowFlags.h, include/EnumSDLGlContextFlag.h, include/EnumSDLSysWMType.h, include/ClassPtr.h, include/ClassHG3DUtilities.h, include/hg3dstruct.h, include/EnumSDLMessageBoxButtonFlags.h, include/EnumSDLGameControllerBindType.h, include/HeaderSDLMouse.h +Extra-source-files: Setup.hs, include/StructHG3DClass.h, include/HeaderSDL.h, include/EnumSDLSystemCursor.h, include/hg3dstruct.h, include/EnumSDLMessageBoxFlags.h, include/HeaderSDLMouse.h, include/EnumSDLWindowShapeMode.h, include/EnumSDLWindowFlags.h, include/EnumSDLScancode.h, include/EnumSDLGLAttr.h, include/EnumSDLGameControllerAxis.h, include/EnumSDLBlendMode.h, include/EnumSDLMessageBoxColorType.h, include/EnumSDLLogPriority.h, include/EnumSDLGlContextFlag.h, include/EnumSDLPixelFormat.h, include/EnumSDLGLProfile.h, include/EnumSDLTextureAccess.h, include/EnumSDLTextureModulate.h, include/HeaderSDLEvents.h, include/EnumSDLRendererFlags.h, include/ClassHG3DUtilities.h, include/EnumSDLPowerState.h, include/EnumSDLWindowEventID.h, include/EnumSDLKeymod.h, include/ClassPtr.h, include/EnumSDLLogCategory.h, include/EnumSDLRendererFlip.h, include/SDL2DllDefines.h, include/EnumSDLThreadPriority.h, include/EnumSDLPacketLayout.h, include/EnumSDLMessageBoxButtonFlags.h, include/EnumSDLGameControllerButton.h, include/HeaderSDLKeyboard.h, include/HeaderSDLVideo.h, include/sdlevent_struct.h, include/EnumSDLEventType.h, include/EnumSDLGameControllerBindType.h, include/EnumSDLHintPriority.h, include/EnumSDLKeycode.h, include/EnumSDLSysWMType.h, include/StructSDLEvent.h, include/HG3DUtilities.h Library - Build-Depends: base >= 3 && < 5, utf8-string, bytestring, HGamer3D-Data >= 0.3.0 + Build-Depends: base >= 3 && < 5, utf8-string, bytestring, HGamer3D-Data >= 0.4.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 + Exposed-modules: HGamer3D.Bindings.SDL2.Utils, HGamer3D.Bindings.SDL2.StructHG3DClass, HGamer3D.Bindings.SDL2.ClassPtr, HGamer3D.Bindings.SDL2.EnumSDLMessageBoxButtonFlags, HGamer3D.Bindings.SDL2.EnumSDLGLProfile, HGamer3D.Bindings.SDL2.EnumSDLRendererFlags, HGamer3D.Bindings.SDL2.EnumSDLScancode, HGamer3D.Bindings.SDL2.EnumSDLWindowEventID, HGamer3D.Bindings.SDL2.EnumSDLThreadPriority, HGamer3D.Bindings.SDL2.EnumSDLSystemCursor, HGamer3D.Bindings.SDL2.EnumSDLGameControllerAxis, HGamer3D.Bindings.SDL2.EnumSDLMessageBoxFlags, HGamer3D.Bindings.SDL2.EnumSDLWindowFlags, HGamer3D.Bindings.SDL2.EnumSDLGameControllerButton, HGamer3D.Bindings.SDL2.EnumSDLKeymod, HGamer3D.Bindings.SDL2.EnumSDLHintPriority, HGamer3D.Bindings.SDL2.EnumSDLLogCategory, HGamer3D.Bindings.SDL2.EnumSDLRendererFlip, HGamer3D.Bindings.SDL2.EnumSDLTextureModulate, HGamer3D.Bindings.SDL2.EnumSDLPacketLayout, HGamer3D.Bindings.SDL2.EnumSDLEventType, HGamer3D.Bindings.SDL2.EnumSDLTextureAccess, HGamer3D.Bindings.SDL2.EnumSDLLogPriority, HGamer3D.Bindings.SDL2.EnumSDLGameControllerBindType, HGamer3D.Bindings.SDL2.EnumSDLWindowShapeMode, HGamer3D.Bindings.SDL2.EnumSDLBlendMode, HGamer3D.Bindings.SDL2.EnumSDLPixelFormat, HGamer3D.Bindings.SDL2.EnumSDLGLAttr, HGamer3D.Bindings.SDL2.EnumSDLSysWMType, HGamer3D.Bindings.SDL2.EnumSDLGlContextFlag, HGamer3D.Bindings.SDL2.EnumSDLMessageBoxColorType, HGamer3D.Bindings.SDL2.EnumSDLPowerState, HGamer3D.Bindings.SDL2.StructSDLEvent, HGamer3D.Bindings.SDL2.ClassHG3DUtilities, HGamer3D.Bindings.SDL2.HeaderSDLMouse, HGamer3D.Bindings.SDL2.HeaderSDLEvents, HGamer3D.Bindings.SDL2.HeaderSDLVideo, HGamer3D.Bindings.SDL2.HeaderSDL, HGamer3D.Bindings.SDL2.HeaderSDLKeyboard Other-modules: ghc-options: @@ -33,6 +33,6 @@ Build-tools: build-depends: if os(windows) - extra-libraries: hg3dsdl2033 + extra-libraries: hg3dsdl2040 else - extra-libraries: hg3dsdl2033,SDL2-2.0,X11 + extra-libraries: hg3dsdl2040,SDL2-2.0,X11
+ HGamer3D/Bindings/SDL2/EnumSDLLogCategory.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. +-- + + +-- EnumSDLLogCategory.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLLogCategory 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 "EnumSDLLogCategory.h" +{#enum EnumSDLLogCategory {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLPacketLayout.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. +-- + + +-- EnumSDLPacketLayout.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLPacketLayout 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 "EnumSDLPacketLayout.h" +{#enum EnumSDLPacketLayout {} deriving (Eq)#}
+ HGamer3D/Bindings/SDL2/EnumSDLPixelFormat.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. +-- + + +-- EnumSDLPixelFormat.chs + +-- + +module HGamer3D.Bindings.SDL2.EnumSDLPixelFormat 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 "EnumSDLPixelFormat.h" +{#enum EnumSDLPixelFormat {} deriving (Eq)#}
HGamer3D/Bindings/SDL2/StructSDLEvent.chs view
@@ -40,6 +40,7 @@ #include "StructSDLEvent.h" import HGamer3D.Data+import HGamer3D.Data.Window import HGamer3D.Bindings.SDL2.EnumSDLEventType import HGamer3D.Bindings.SDL2.EnumSDLKeymod@@ -73,15 +74,15 @@ 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 |+data SDLEvent = EvtKeyUp GameTime Window EnumSDLScancode Keycode Keymod |+ EvtKeyDown GameTime Window EnumSDLScancode Keycode Keymod |+ EvtText GameTime Window String | + EvtQuit GameTime |+ EvtWindow GameTime Window EnumSDLWindowEventID Int Int |+ EvtMouseButtonDown GameTime Window MouseID SDLButton Int Int |+ EvtMouseButtonUp GameTime Window MouseID SDLButton Int Int |+ EvtMouseMotion GameTime Window MouseID Int Int Int Int | + EvtCommon GameTime EnumSDLEventType | EvtNotValid instance Storable SDLEvent where@@ -93,7 +94,7 @@ 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)+ let t = ((fromIntegral . (* 1000000) . toInteger) time) :: GameTime case (evttyp) of SDL_QUIT -> return $ EvtQuit t
+ include/EnumSDLLogCategory.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.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. +// + +// EnumSDLLogCategory.h + +// + +#include "wchar.h" +#ifndef _DEFINED_HG3D_EnumSDLLogCategory+#define _DEFINED_HG3D_EnumSDLLogCategory+ + +enum EnumSDLLogCategory+{+ SDL_LOG_CATEGORY_APPLICATION, // + SDL_LOG_CATEGORY_ERROR, // + SDL_LOG_CATEGORY_ASSERT, // + SDL_LOG_CATEGORY_SYSTEM, // + SDL_LOG_CATEGORY_AUDIO, // + SDL_LOG_CATEGORY_VIDEO, // + SDL_LOG_CATEGORY_RENDER, // + SDL_LOG_CATEGORY_INPUT, // + SDL_LOG_CATEGORY_TEST, // + SDL_LOG_CATEGORY_RESERVED1, // + SDL_LOG_CATEGORY_RESERVED2, // + SDL_LOG_CATEGORY_RESERVED3, // + SDL_LOG_CATEGORY_RESERVED4, // + SDL_LOG_CATEGORY_RESERVED5, // + SDL_LOG_CATEGORY_RESERVED6, // + SDL_LOG_CATEGORY_RESERVED7, // + SDL_LOG_CATEGORY_RESERVED8, // + SDL_LOG_CATEGORY_RESERVED9, // + SDL_LOG_CATEGORY_RESERVED10, // + SDL_LOG_CATEGORY_CUSTOM // +};+#endif
+ include/EnumSDLPacketLayout.h view
@@ -0,0 +1,38 @@+// 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. +// + +// EnumSDLPacketLayout.h + +// + +#include "wchar.h" +#ifndef _DEFINED_HG3D_EnumSDLPacketLayout+#define _DEFINED_HG3D_EnumSDLPacketLayout+ + +enum EnumSDLPacketLayout+{+ SDL_ARRAYORDER_NONE, // + SDL_ARRAYORDER_RGB, // + SDL_ARRAYORDER_RGBA, // + SDL_ARRAYORDER_ARGB, // + SDL_ARRAYORDER_BGR, // + SDL_ARRAYORDER_BGRA, // + SDL_ARRAYORDER_ABGR // +};+#endif
+ include/EnumSDLPixelFormat.h view
@@ -0,0 +1,40 @@+// 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. +// + +// EnumSDLPixelFormat.h + +// + +#include "wchar.h" +#ifndef _DEFINED_HG3D_EnumSDLPixelFormat+#define _DEFINED_HG3D_EnumSDLPixelFormat+ + +enum EnumSDLPixelFormat+{+ SDL_PACKEDLAYOUT_NONE, // + SDL_PACKEDLAYOUT_332, // + SDL_PACKEDLAYOUT_4444, // + SDL_PACKEDLAYOUT_1555, // + SDL_PACKEDLAYOUT_5551, // + SDL_PACKEDLAYOUT_565, // + SDL_PACKEDLAYOUT_8888, // + SDL_PACKEDLAYOUT_2101010, // + SDL_PACKEDLAYOUT_1010102 // +};+#endif
include/SDL2DllDefines.h view
@@ -16,10 +16,10 @@ // SDL2DllDefines.h -#ifndef _HGamer3DSDL2033_DLLDEFINES_H_ -#define _HGamer3DSDL2033_DLLDEFINES_H_ +#ifndef _HGamer3DSDL2040_DLLDEFINES_H_ +#define _HGamer3DSDL2040_DLLDEFINES_H_ -/* Cmake will define HGamer3DSDL2033_EXPORTS on Windows when it +/* Cmake will define HGamer3DSDL2040_EXPORTS on Windows when it configures to build a shared library. If you are going to use another build system on windows or create the visual studio projects by hand you need to define MyLibrary_EXPORTS when @@ -29,13 +29,13 @@ // We are using the Visual Studio Compiler and building Shared libraries #if (defined (_WIN32)) && !(defined (__GNUC__)) - #if defined(HGamer3DSDL2033_EXPORTS) + #if defined(HGamer3DSDL2040_EXPORTS) #define SDL2_LIB_EXPORT __declspec(dllexport) #else #define SDL2_LIB_EXPORT __declspec(dllimport) - #endif /* HGamer3DSDL2033_EXPORTS */ + #endif /* HGamer3DSDL2040_EXPORTS */ #else /* defined (_WIN32) */ #define SDL2_LIB_EXPORT #endif -#endif /* _HGamer3DSDL2033_DLLDEFINES_H_ */ +#endif /* _HGamer3DSDL2040_DLLDEFINES_H_ */