packages feed

HGamer3D 0.6.2 → 0.7.0

raw patch · 51 files changed

+2422/−3155 lines, 51 filesdep +fresco-bindingdep ~cerealdep ~clockdep ~messagepacksetup-changed

Dependencies added: fresco-binding

Dependency ranges changed: cereal, clock, messagepack

Files

HGamer3D.cabal view
@@ -1,36 +1,32 @@-Name:                HGamer3D
-Version:             0.6.2
-Synopsis:            Toolset for the Haskell Game Programmer
-Description:         
-	HGamer3D is a toolset for developing 3D games in the programming 
-	language Haskell. 
-
-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 
- 
-Library
-  Build-Depends:     base >= 3 && < 5, containers, bytestring, text, filepath, directory, vect >=0.4 && <0.5, messagepack >=0.4 && <0.5, clock >=0.5 && <0.6, cereal >=0.4 && < 0.5
-
-  Exposed-modules:   HGamer3D.Binding.CFunctions, HGamer3D.Binding.Helper, HGamer3D.Binding, HGamer3D.Data.Angle, HGamer3D.Data.Colour, HGamer3D.Data.LMH, HGamer3D.Data.GameTime, HGamer3D.Data.Geometry2D, HGamer3D.Data.Transform3D, HGamer3D.Data.TypeSynonyms, HGamer3D.Data.Vector, HGamer3D.Data.Window, HGamer3D.Data.PlayCmd, HGamer3D.Data, HGamer3D.Util.FileLocation, HGamer3D.Util.UniqueName, HGamer3D.Util, HGamer3D.ECS.Entity, HGamer3D.Data.Component, HGamer3D.ECS.System, HGamer3D.ECS, HGamer3D.Graphics3D.Camera, HGamer3D.Graphics3D.Graphics3DCommand, HGamer3D.Graphics3D.Geometry, HGamer3D.Graphics3D.Graphics3DConfig, HGamer3D.Graphics3D.Light, HGamer3D.Graphics3D.Material, HGamer3D.Graphics3D.Window, HGamer3D.Input.Mouse, HGamer3D.Input.Keyboard, HGamer3D.Input.Joystick, HGamer3D.Input.InputEventHandler, HGamer3D.Input, HGamer3D.Graphics3D.SystemGraphics3D, HGamer3D.Graphics3D, HGamer3D.GUI.Button, HGamer3D.GUI.EditText, HGamer3D.GUI.DropDownList, HGamer3D.GUI.Slider, HGamer3D.GUI.Text, HGamer3D.GUI.CheckBox, HGamer3D.GUI, HGamer3D.Audio.SoundSource, HGamer3D.Audio.SoundListener, HGamer3D.Audio.Volume, HGamer3D.Audio, HGamer3D
-
-  Other-modules:     
-
-  c-sources:         
-  
-  ghc-options:       
-  cc-options:        -Wno-attributes 
-  hs-source-dirs:    .
-  Include-dirs:      .
-  build-depends:
-  if os(windows)
-     extra-libraries:   hgamer3d062
-  else
-     extra-libraries:   hgamer3d062, Urho3D
-     
+Name:                HGamer3D+Version:             0.7.0+Synopsis:            Toolset for the Haskell Game Programmer+Description:         +	HGamer3D is a toolset for developing 3D games in the programming +	language Haskell. ++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 + +Library+  Build-Depends:     base >= 3 && < 5, containers, bytestring, text, filepath, directory, vect >=0.4 && <0.5, messagepack >=0.5 && <0.6, clock >=0.6 && <0.7, cereal >=0.5 && < 0.6, fresco-binding >= 0.1.0 && < 0.2.0++  Exposed-modules:   HGamer3D.Data.Angle, HGamer3D.Data.Colour, HGamer3D.Data.LMH, HGamer3D.Data.GameTime, HGamer3D.Data.Geometry2D, HGamer3D.Data.Transform3D, HGamer3D.Data.TypeSynonyms, HGamer3D.Data.Vector, HGamer3D.Data.Window, HGamer3D.Data.PlayCmd, HGamer3D.Data, HGamer3D.Util.FileLocation, HGamer3D.Util.UniqueName, HGamer3D.Util.Variable, HGamer3D.Util, HGamer3D.Graphics3D.Camera, HGamer3D.Graphics3D.Graphics3DCommand, HGamer3D.Graphics3D.Geometry, HGamer3D.Graphics3D.Graphics3DConfig, HGamer3D.Graphics3D.Light, HGamer3D.Graphics3D.Material, HGamer3D.Graphics3D.Window, HGamer3D.Input.Mouse, HGamer3D.Input.Keyboard, HGamer3D.Input.Joystick, HGamer3D.Input.InputEventHandler, HGamer3D.Input, HGamer3D.Graphics3D, HGamer3D.GUI.Button, HGamer3D.GUI.EditText, HGamer3D.GUI.DropDownList, HGamer3D.GUI.Slider, HGamer3D.GUI.Text, HGamer3D.GUI.CheckBox, HGamer3D.GUI, HGamer3D.Audio.SoundSource, HGamer3D.Audio.SoundListener, HGamer3D.Audio.Volume, HGamer3D.Audio, HGamer3D++  Other-modules:     ++  c-sources:         +  +  ghc-options:       +  cc-options:        -Wno-attributes +  hs-source-dirs:    .+  Include-dirs:      .+  build-depends:+     
HGamer3D.hs view
@@ -1,43 +1,120 @@--- 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 - 2015 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.
--- 
--- HGamer3D
--- 
-
--- | Main module, to include API
-module HGamer3D
-
-(
-	module HGamer3D.Data,
-	module HGamer3D.Util,
-	module HGamer3D.ECS,
-	module HGamer3D.Graphics3D,
-	module HGamer3D.Input,
-    module HGamer3D.GUI,
-    module HGamer3D.Audio
-)
-
-where
-
-import HGamer3D.Data
-import HGamer3D.Util
-import HGamer3D.ECS
-import HGamer3D.Graphics3D
-import HGamer3D.Input
-import HGamer3D.GUI
-import HGamer3D.Audio
+-- 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 - 2015 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.+-- +-- HGamer3D+-- ++-- | Main module, to include API+module HGamer3D++(+	module Fresco,+	module HGamer3D.Data,+	module HGamer3D.Util,+	module HGamer3D.Graphics3D,+	module HGamer3D.Input,+    module HGamer3D.GUI,+    module HGamer3D.Audio,++    configureHG3D,+    stepHG3D,+    loopHG3D,+    registerCallback,+    isExitHG3D,+    exitHG3D,++    HG3D,+)++where++import Fresco+import HGamer3D.Data+import HGamer3D.Util+import HGamer3D.Graphics3D+import HGamer3D.Input+import HGamer3D.GUI+import HGamer3D.Audio++import Control.Concurrent+import Control.Monad+import Control.Concurrent.MVar+import Data.IORef++-- run loop++type HG3D = (Entity, CallbackSystem, Var Bool)++configureHG3D = do++	cbsRef <- newEmptyMVar++	-- create graphics system+	eG3D <- newE [+	    ctGraphics3DConfig #: standardGraphics3DConfig,+	    ctGraphics3DCommand #: NoCmd+	    ]++	eih <- newE [+	    ctInputEventHandler #: DefaultEventHandler,+	    ctExitRequestedEvent #: ExitRequestedEvent+	    ]++	varExit <- makeVar False++	-- create callback loop+	forkIO $ do+	    cbs <- createCBS+	    registerCallback (eG3D, cbs, varExit) eih ctExitRequestedEvent (\_ -> writeVar varExit True >> return ())+	    putMVar cbsRef cbs+	    forever (stepCBS cbs)++	cbs <- takeMVar cbsRef++	return (eG3D, cbs, varExit)++stepHG3D (eG3D, cbs, varExit) = do+    setC eG3D ctGraphics3DCommand Step++isExitHG3D (eG3D, cbs, varExit) = do+	ise <- readVar varExit+	return ise++resetExitHG3D (eG3D, cbs, varExit) = writeVar varExit False++loopHG3D hg3d loopSleepTime checkExit = do+	stepHG3D hg3d+	sleepFor loopSleepTime+	ise <- do+		ise' <- isExitHG3D hg3d+		if ise' then do+			resetExitHG3D hg3d+			checkExit+			else+				return False+	if not ise then do+		loopHG3D hg3d loopSleepTime checkExit+		return ()+		else+			return ()++exitHG3D (eG3D, cvs, varExit) = do+	writeVar varExit True >> return ()++registerCallback (eG3D, cbs, varExit) e ct f = do+	registerReceiverCBS cbs e ct f
HGamer3D/Audio.hs view
@@ -1,29 +1,29 @@-{-
-    Sound and Music
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Audio.hs
--}
-
-
--- | Audio for HGamer3D 
-module HGamer3D.Audio
-
-(
-    module HGamer3D.Audio.SoundSource
-    , module HGamer3D.Audio.SoundListener
-    , module HGamer3D.Audio.Volume
-)
-
-where
-
-import HGamer3D.Audio.SoundSource
-import HGamer3D.Audio.SoundListener
-import HGamer3D.Audio.Volume
-
-
+{-+    Sound and Music+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Audio.hs+-}+++-- | Audio for HGamer3D +module HGamer3D.Audio++(+    module HGamer3D.Audio.SoundSource+    , module HGamer3D.Audio.SoundListener+    , module HGamer3D.Audio.Volume+)++where++import HGamer3D.Audio.SoundSource+import HGamer3D.Audio.SoundListener+import HGamer3D.Audio.Volume++
HGamer3D/Audio/SoundListener.hs view
@@ -1,30 +1,31 @@-{-
-	Audio: Listener for sound, specifies mainyl the position for 3D sound
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Audio/SoundListener.hs
--}
-
--- | Sound Listener
-module HGamer3D.Audio.SoundListener
-(
-    ctSoundListener
-)
-
-where
-
-import Data.MessagePack
-import Debug.Trace
-import Data.Text
-
-import HGamer3D.Data
-
-ctSoundListener :: ComponentType ()
-ctSoundListener = ComponentType 0x7aacf4ee5bd2f958
-  
-
+{-+	Audio: Listener for sound, specifies mainyl the position for 3D sound+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Audio/SoundListener.hs+-}++-- | Sound Listener+module HGamer3D.Audio.SoundListener+(+    ctSoundListener+)++where++import Fresco+import Data.MessagePack+import Debug.Trace+import Data.Text++import HGamer3D.Data++ctSoundListener :: ComponentType ()+ctSoundListener = ComponentType 0x7aacf4ee5bd2f958+  +
HGamer3D/Audio/SoundSource.hs view
@@ -1,44 +1,45 @@-{-
-	Sound Source
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Audio/SoundSource.hs
--}
-
--- | Module providing a Sound Source
-module HGamer3D.Audio.SoundSource
-(
-    SoundSource (..),
-    ctSoundSource
-)
-
-where
-
-import Data.MessagePack
-import Debug.Trace
-import Data.Text
-
-import HGamer3D.Data
-
-data SoundSource = Sound Text Float Bool Text -- resource, Volume, loop, volume group
-                   | Sound3D Text Float Bool Text
-                   | Music Text Float Bool Text
-                   deriving (Eq, Show)
-                   
-instance ComponentClass SoundSource where
-    toObj (Sound snd vol l g) = ObjectArray [ObjectInt 0, toObj snd, ObjectFloat vol, ObjectBool l, toObj g]
-    toObj (Sound3D snd vol l g) = ObjectArray [ObjectInt 1, toObj snd, ObjectFloat vol, ObjectBool l, toObj g]
-    toObj (Music snd vol l g) = ObjectArray [ObjectInt 2, toObj snd, ObjectFloat vol, ObjectBool l, toObj g]
-    fromObj (ObjectArray [ObjectInt 0, snd_o, ObjectFloat vol, ObjectBool l, g_o]) = Sound (fromObj snd_o) vol l (fromObj g_o)
-    fromObj (ObjectArray [ObjectInt 1, snd_o, ObjectFloat vol, ObjectBool l, g_o]) = Sound3D (fromObj snd_o) vol l (fromObj g_o)
-    fromObj (ObjectArray [ObjectInt 2, snd_o, ObjectFloat vol, ObjectBool l, g_o]) = Music (fromObj snd_o) vol l (fromObj g_o)
-
-ctSoundSource :: ComponentType SoundSource
-ctSoundSource = ComponentType 0xafcef7aa41d88c0d
-  
-
+{-+	Sound Source+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Audio/SoundSource.hs+-}++-- | Module providing a Sound Source+module HGamer3D.Audio.SoundSource+(+    SoundSource (..),+    ctSoundSource+)++where++import Fresco+import Data.MessagePack+import Debug.Trace+import Data.Text++import HGamer3D.Data++data SoundSource = Sound Text Float Bool Text -- resource, Volume, loop, volume group+                   | Sound3D Text Float Bool Text+                   | Music Text Float Bool Text+                   deriving (Eq, Show)+                   +instance ComponentClass SoundSource where+    toObj (Sound snd vol l g) = ObjectArray [ObjectInt 0, toObj snd, ObjectFloat vol, ObjectBool l, toObj g]+    toObj (Sound3D snd vol l g) = ObjectArray [ObjectInt 1, toObj snd, ObjectFloat vol, ObjectBool l, toObj g]+    toObj (Music snd vol l g) = ObjectArray [ObjectInt 2, toObj snd, ObjectFloat vol, ObjectBool l, toObj g]+    fromObj (ObjectArray [ObjectInt 0, snd_o, ObjectFloat vol, ObjectBool l, g_o]) = Sound (fromObj snd_o) vol l (fromObj g_o)+    fromObj (ObjectArray [ObjectInt 1, snd_o, ObjectFloat vol, ObjectBool l, g_o]) = Sound3D (fromObj snd_o) vol l (fromObj g_o)+    fromObj (ObjectArray [ObjectInt 2, snd_o, ObjectFloat vol, ObjectBool l, g_o]) = Music (fromObj snd_o) vol l (fromObj g_o)++ctSoundSource :: ComponentType SoundSource+ctSoundSource = ComponentType 0xafcef7aa41d88c0d+  +
HGamer3D/Audio/Volume.hs view
@@ -1,37 +1,38 @@-{-
-	Audio: Master Volume for different categories
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Audio/Volume.hs
--}
-
--- | Module providing the Mouse functionality and settings
-module HGamer3D.Audio.Volume
-(
-    Volume (..),
-    ctVolume
-)
-
-where
-
-import Data.MessagePack
-import Debug.Trace
-import Data.Text
-
-import HGamer3D.Data
-
-data Volume = Volume Text Float deriving (Eq, Show)
-
-instance ComponentClass Volume where
-    toObj (Volume cat vol) = ObjectArray [toObj cat, ObjectFloat vol]
-    fromObj (ObjectArray [cat_o, ObjectFloat vol]) = Volume (fromObj cat_o) vol
-
-ctVolume :: ComponentType Volume
-ctVolume = ComponentType 0x659d20e6e65f85fe
-  
-
+{-+	Audio: Master Volume for different categories+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Audio/Volume.hs+-}++-- | Module providing the Mouse functionality and settings+module HGamer3D.Audio.Volume+(+    Volume (..),+    ctVolume+)++where++import Fresco+import Data.MessagePack+import Debug.Trace+import Data.Text++import HGamer3D.Data++data Volume = Volume Text Float deriving (Eq, Show)++instance ComponentClass Volume where+    toObj (Volume cat vol) = ObjectArray [toObj cat, ObjectFloat vol]+    fromObj (ObjectArray [cat_o, ObjectFloat vol]) = Volume (fromObj cat_o) vol++ctVolume :: ComponentType Volume+ctVolume = ComponentType 0x659d20e6e65f85fe+  +
− HGamer3D/Binding.hs
@@ -1,34 +0,0 @@--- 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 - 2015 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.
--- 
--- HGamer3D/Binding.hs
--- 
-
--- | Binding utility functions for HGamer3D 
-module HGamer3D.Binding
-
-(
-	module HGamer3D.Binding.CFunctions,
-	module HGamer3D.Binding.Helper
-)
-
-where
-
-import HGamer3D.Binding.CFunctions
-import HGamer3D.Binding.Helper
-
− HGamer3D/Binding/CFunctions.hs
@@ -1,121 +0,0 @@--- GENERATED by C->Haskell Compiler, version 0.25.2 Snowboundest, 31 Oct 2014 (Haskell)
--- Edit the ORIGNAL .chs file instead!
-
-
-{-# LINE 1 "CFunctions.chs" #-}
--- 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) 2015 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.
--- 
--- HGamer3D/Binding/CFunctions.hs
--- 
-
-{-# LANGUAGE ForeignFunctionInterface #-}
-
-
-
--- | C-function interface towards the urho3d dll
-module HGamer3D.Binding.CFunctions where
-
-import Foreign
-import Foreign.C
-import Data.Word
-import Data.ByteString
-import Data.ByteString.Unsafe
-
-type CStringCLen i = (CString, i)
-
-unsafeUseAsCStringLen' :: (Integral i) => ByteString -> (CStringCLen i -> IO a) -> IO a
-unsafeUseAsCStringLen' str fn =
-  unsafeUseAsCStringLen str (\(ptr, len) -> fn (ptr, fromIntegral len))
-
-createItem :: (Word64) -> (ByteString) -> IO ((Int), (Ptr ()))
-createItem a1 a2 =
-  let {a1' = fromIntegral a1} in 
-  unsafeUseAsCStringLen' a2 $ \(a2'1, a2'2) -> 
-  alloca $ \a3' -> 
-  createItem'_ a1' a2'1  a2'2 a3' >>= \res ->
-  let {res' = fromIntegral res} in
-  peek  a3'>>= \a3'' -> 
-  return (res', a3'')
-
-{-# LINE 47 "CFunctions.chs" #-}
-
-
-destroyItem :: (Word64) -> (Ptr ()) -> IO ((Int))
-destroyItem a1 a2 =
-  let {a1' = fromIntegral a1} in 
-  let {a2' = id a2} in 
-  destroyItem'_ a1' a2' >>= \res ->
-  let {res' = fromIntegral res} in
-  return (res')
-
-{-# LINE 54 "CFunctions.chs" #-}
-
-
-getMessageSender :: (Word64) -> (Word64) -> IO ((Int), (FunPtr (Ptr () -> Ptr CChar -> CInt -> IO CInt)))
-getMessageSender a1 a2 =
-  let {a1' = fromIntegral a1} in 
-  let {a2' = fromIntegral a2} in 
-  alloca $ \a3' -> 
-  getMessageSender'_ a1' a2' a3' >>= \res ->
-  let {res' = fromIntegral res} in
-  peek  a3'>>= \a3'' -> 
-  return (res', a3'')
-
-{-# LINE 62 "CFunctions.chs" #-}
-
-
-registerMessageReceiver :: (Word64) -> (Word64) -> (Ptr ()) -> (FunPtr (Ptr () -> Ptr CChar -> CInt -> IO CInt)) -> IO ((Int))
-registerMessageReceiver a1 a2 a3 a4 =
-  let {a1' = fromIntegral a1} in 
-  let {a2' = fromIntegral a2} in 
-  let {a3' = id a3} in 
-  let {a4' = id a4} in 
-  registerMessageReceiver'_ a1' a2' a3' a4' >>= \res ->
-  let {res' = fromIntegral res} in
-  return (res')
-
-{-# LINE 71 "CFunctions.chs" #-}
-
-
-errorMessage :: (Int) -> IO ((String))
-errorMessage a1 =
-  let {a1' = fromIntegral a1} in 
-  errorMessage'_ a1' >>= \res ->
-  peekCString res >>= \res' ->
-  return (res')
-
-{-# LINE 77 "CFunctions.chs" #-}
-
-		     
-
-
-foreign import ccall safe "CFunctions.chs.h hg3durho3d0_create_item"
-  createItem'_ :: (CULLong -> ((Ptr CChar) -> (CInt -> ((Ptr (Ptr ())) -> (IO CInt)))))
-
-foreign import ccall safe "CFunctions.chs.h hg3durho3d0_destroy_item"
-  destroyItem'_ :: (CULLong -> ((Ptr ()) -> (IO CInt)))
-
-foreign import ccall safe "CFunctions.chs.h hg3durho3d0_get_msg_sender"
-  getMessageSender'_ :: (CULLong -> (CULLong -> ((Ptr (FunPtr ((Ptr ()) -> ((Ptr CChar) -> (CInt -> (IO CInt)))))) -> (IO CInt))))
-
-foreign import ccall safe "CFunctions.chs.h hg3durho3d0_register_msg_receiver"
-  registerMessageReceiver'_ :: (CULLong -> (CULLong -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> ((Ptr CChar) -> (CInt -> (IO CInt))))) -> (IO CInt)))))
-
-foreign import ccall safe "CFunctions.chs.h hg3durho3d0_error_message"
-  errorMessage'_ :: (CInt -> (IO (Ptr CChar)))
− HGamer3D/Binding/Helper.hs
@@ -1,75 +0,0 @@--- 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 - 2015 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.
-
--- HGamer3D/Binding/Helper.hs
-
-{-# LANGUAGE ForeignFunctionInterface #-}
-
--- | Helper functions for binding ffi, encoding, decoding via messagepack
-module HGamer3D.Binding.Helper
-
-where
-
-import Data.ByteString
-import Data.ByteString.Unsafe
-import qualified Data.ByteString.Lazy as BL
-import Data.MessagePack
-import Data.Either
-import Data.Maybe
-import Data.Serialize
-
-import Foreign
-import Foreign.C
-import Foreign.Ptr
-
-import HGamer3D.Binding.CFunctions
-import HGamer3D.Data.Component
-
-toMsg :: ComponentClass o => o -> ByteString
-toMsg o = encode (toObj o)
-
-fromMsg :: ComponentClass o => ByteString -> Maybe o
-fromMsg bs = case decode bs of 
-                Right o -> Just $ fromObj o
-                _ -> Nothing
-
--- helper functions
-
-type MsgFunction = Ptr () -> Ptr CChar -> CInt -> IO CInt
-foreign import ccall "dynamic" 
-   mkMsgFun :: FunPtr MsgFunction -> MsgFunction
-foreign import ccall "wrapper"
-   mkMsgFunPtr :: MsgFunction -> IO (FunPtr MsgFunction)
-
-callMsgFunction :: FunPtr MsgFunction -> Ptr () -> ByteString -> IO Int
-callMsgFunction mf p msg = do
-      let f = mkMsgFun mf
-      let dat = msg
-      unsafeUseAsCStringLen' dat $ \(dat'1, dat'2) -> f p dat'1  dat'2 >>= \res -> return (fromIntegral res)
---      unsafeUseAsCStringLen' dat $ \(dat'1, dat'2) -> print "msgfun" >> print dat'1 >> print dat'2 >> f p dat'1  dat'2 >>= \res -> return (fromIntegral res)
-
-type InitFunction = Ptr () -> IO CInt
-foreign import ccall "dynamic" 
-   mkInitFun :: FunPtr InitFunction -> InitFunction
-
-callInitFunction :: FunPtr InitFunction -> Ptr () -> IO Int
-callInitFunction ifp p = do
-    let f = mkInitFun ifp
-    res <- f p
-    return (fromIntegral res)
-
HGamer3D/Data.hs view
@@ -1,61 +1,57 @@--- 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 - 2015 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.
--- 
--- HGamer3D/Data.hs
--- 
-
--- | Common data definitions for HGamer3D 
-module HGamer3D.Data 
-
-(
-	-- * Baisc Datatypes 
-	module HGamer3D.Data.Angle,
-	module HGamer3D.Data.Colour,
-	module HGamer3D.Data.LMH,
-	module HGamer3D.Data.GameTime,
-
-	-- * Geometry Datatypes
-	module HGamer3D.Data.Vector,
-	module HGamer3D.Data.Geometry2D,
-	module HGamer3D.Data.Transform3D,
-	module HGamer3D.Data.TypeSynonyms,
-
-    -- * Misc
-    module HGamer3D.Data.PlayCmd, 
-    
-	-- * Entity Component System, Index Type
-	module HGamer3D.Data.Component,
-
-	-- * Implementation 
-	module HGamer3D.Data.Window
-)
-
-where
-
-import HGamer3D.Data.Angle
-import HGamer3D.Data.Colour
-import HGamer3D.Data.LMH
-import HGamer3D.Data.GameTime
-import HGamer3D.Data.Geometry2D
-import HGamer3D.Data.Transform3D
-import HGamer3D.Data.TypeSynonyms
-import HGamer3D.Data.Vector
-import HGamer3D.Data.Window
-import HGamer3D.Data.Component
-import HGamer3D.Data.PlayCmd
-
+-- 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 - 2015 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.+-- +-- HGamer3D/Data.hs+-- ++-- | Common data definitions for HGamer3D +module HGamer3D.Data ++(+	-- * Baisc Datatypes +	module HGamer3D.Data.Angle,+	module HGamer3D.Data.Colour,+	module HGamer3D.Data.LMH,+	module HGamer3D.Data.GameTime,++	-- * Geometry Datatypes+	module HGamer3D.Data.Vector,+	module HGamer3D.Data.Geometry2D,+	module HGamer3D.Data.Transform3D,+	module HGamer3D.Data.TypeSynonyms,++    -- * Misc+    module HGamer3D.Data.PlayCmd, +    +	-- * Implementation +	module HGamer3D.Data.Window+)++where++import HGamer3D.Data.Angle+import HGamer3D.Data.Colour+import HGamer3D.Data.LMH+import HGamer3D.Data.GameTime+import HGamer3D.Data.Geometry2D+import HGamer3D.Data.Transform3D+import HGamer3D.Data.TypeSynonyms+import HGamer3D.Data.Vector+import HGamer3D.Data.Window+import HGamer3D.Data.PlayCmd+
HGamer3D/Data/Angle.hs view
@@ -1,87 +1,89 @@-{-
-	Datatypes to specify a geometric angle
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2011-2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Data/Angle.hs
--}
-
--- | Angles as Degrees or Radians, based on Float datatype
-module HGamer3D.Data.Angle 
-
-(
-    -- * Data definitions and conversions
-    Angle (..),
-    asRad,
-    asDeg,
-        
-    -- * Mathematical functions
-    addA,
-    subA,
-    mulA,
-    divA,
-    sinA,
-    cosA,
-    tanA,
-    asinA,
-    acosA,
-    atanA,
-)
-
-where
-
-import Data.MessagePack
-import HGamer3D.Data.Component
-
--- | construct an Angle either by giving it in degrees or radians
-data Angle = Rad Float | Deg Float deriving (Eq, Ord, Show)
-
--- | value of an Angle as radiant
-asRad :: Angle -> Float
-asRad (Rad f) = f
-asRad (Deg d) = d/180*pi
-
--- | value of an Angle as degree
-asDeg :: Angle -> Float
-asDeg (Deg f) = f
-asDeg (Rad d) = d/pi*180
-
-
-sinA :: Angle -> Float
-sinA = sin . asRad
-
-cosA :: Angle -> Float
-cosA = cos . asRad
-
-tanA :: Angle -> Float
-tanA = tan . asRad
-
-asinA :: Float -> Angle
-asinA = Rad . asin
-
-acosA :: Float -> Angle
-acosA = Rad . acos
-
-atanA :: Float -> Angle
-atanA = Rad . atan
-
-addA :: Angle -> Angle -> Angle
-addA a b = Rad $ (asRad a) + (asRad b)
-
-subA :: Angle -> Angle -> Angle
-subA a b = Rad $ (asRad a) - (asRad b)
-
-mulA :: Angle -> Float -> Angle
-mulA a b = Rad $ (asRad a) * b
-
-divA :: Angle -> Float -> Angle
-divA a b = Rad $ (asRad a) / b
-
-instance ComponentClass Angle where
-	toObj a = ObjectFloat (asRad a)
-	fromObj (ObjectFloat f) = Rad f 
-
+{-+	Datatypes to specify a geometric angle+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2011-2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Data/Angle.hs+-}++-- | Angles as Degrees or Radians, based on Float datatype+module HGamer3D.Data.Angle ++(+    -- * Data definitions and conversions+    Angle (..),+    asRad,+    asDeg,+        +    -- * Mathematical functions+    addA,+    subA,+    mulA,+    divA,+    sinA,+    cosA,+    tanA,+    asinA,+    acosA,+    atanA,+)++where++import Data.MessagePack+import Fresco++-- | construct an Angle either by giving it in degrees or radians+data Angle = Rad Float | Deg Float deriving (Eq, Ord, Show)++-- | value of an Angle as radiant+asRad :: Angle -> Float+asRad (Rad f) = f+asRad (Deg d) = d/180*pi++-- | value of an Angle as degree+asDeg :: Angle -> Float+asDeg (Deg f) = f+asDeg (Rad d) = d/pi*180+++sinA :: Angle -> Float+sinA = sin . asRad++cosA :: Angle -> Float+cosA = cos . asRad++tanA :: Angle -> Float+tanA = tan . asRad++asinA :: Float -> Angle+asinA = Rad . asin++acosA :: Float -> Angle+acosA = Rad . acos++atanA :: Float -> Angle+atanA = Rad . atan++addA :: Angle -> Angle -> Angle+addA a b = Rad $ (asRad a) + (asRad b)++subA :: Angle -> Angle -> Angle+subA a b = Rad $ (asRad a) - (asRad b)++mulA :: Angle -> Float -> Angle+mulA a b = Rad $ (asRad a) * b++divA :: Angle -> Float -> Angle+divA a b = Rad $ (asRad a) / b++instance ComponentClass Angle where+    toObj (Rad v1) = ObjectArray [ObjectInt 0, ObjectArray [ObjectFloat v1]]+    toObj (Deg v1) = ObjectArray [ObjectInt 1, ObjectArray [ObjectFloat v1]]+    fromObj (ObjectArray [ObjectInt 0, ObjectArray [ObjectFloat v1]]) = Rad v1+    fromObj (ObjectArray [ObjectInt 1, ObjectArray [ObjectFloat v1]]) = Deg v1+
HGamer3D/Data/Colour.hs view
@@ -1,104 +1,113 @@-{-
-	Datatypes to specify a geometric angle
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2011-2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Data/Colour.hs
--}
-    
--- | The Colour type and some standard colours
-module HGamer3D.Data.Colour
-
-(
-    Colour (..),
-    ctColour,
-    white,
-    silver,
-    grey,
-    darkgrey,
-    black,
-    red,
-    maroon,
-    yellow,
-    olive,
-    lime,
-    green,
-    aqua,
-    teal,
-    blue,
-    navy,
-    fuchsia,
-    purple
-)
-
-where
-
-import Data.MessagePack
-import HGamer3D.Data.Component
-
-data Colour = Colour {cRed::Float, cGreen::Float, cBlue::Float, cAlpha::Float} deriving (Eq, Show)
-
-instance ComponentClass Colour where
-    toObj (Colour r g b a) = ObjectArray [ObjectFloat r, ObjectFloat g, ObjectFloat b, ObjectFloat a]
-    fromObj (ObjectArray [ObjectFloat r, ObjectFloat g, ObjectFloat b, ObjectFloat a]) = (Colour r g b a)
-
-ctColour :: ComponentType Colour
-ctColour = ComponentType 0xe202add0521cde41
-
-white :: Colour
-white = Colour 1.0 1.0 1.0 1.0
-
-silver:: Colour
-silver  = Colour 0.75 0.75 0.75 1.0
-
-grey:: Colour
-grey = Colour 0.5 0.5 0.5 1.0
-
-darkgrey :: Colour
-darkgrey = Colour 0.25 0.25 0.25 1.0
-
-black :: Colour
-black = Colour 0.0 0.0 0.0 1.0
-
-red :: Colour
-red = Colour 1.0 0.0 0.0 1.0
-
-maroon :: Colour
-maroon = Colour 0.5 0.0 0.0 1.0
-
-yellow :: Colour
-yellow = Colour 1.0 1.0 0.0 1.0
-
-olive :: Colour
-olive = Colour 0.5 0.5 0.0 1.0
-
-lime :: Colour
-lime = Colour 0.0 1.0 0.0 1.0
-
-green :: Colour
-green = Colour 0.0 0.5 0.0 1.0
-
-aqua :: Colour
-aqua = Colour 0.0 1.0 1.0 1.0
-
-teal :: Colour
-teal = Colour 0.0 0.5 0.5 1.0
-
-blue :: Colour
-blue = Colour 0.0 0.0 1.0 1.0
-
-navy :: Colour
-navy = Colour 0.0 0.0 0.5 1.0
-
-fuchsia :: Colour
-fuchsia = Colour 1.0 0.0 1.0 1.0
-
-purple :: Colour
-purple = Colour 0.5 0.0 0.5 1.0
-
-
-
+{-+	Datatypes to specify a geometric angle+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2011-2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Data/Colour.hs+-}+    +-- | The Colour type and some standard colours+module HGamer3D.Data.Colour++(+    Colour (..),+    ctColour,+    white,+    silver,+    grey,+    darkgrey,+    black,+    red,+    maroon,+    yellow,+    olive,+    lime,+    green,+    aqua,+    teal,+    blue,+    navy,+    fuchsia,+    purple+)++where++import Data.MessagePack+import Fresco++-- generated++data Colour = Colour {+    cRed::Float,+    cGreen::Float,+    cBlue::Float,+    cAlpha::Float+}++instance ComponentClass Colour where+    toObj (Colour v1 v2 v3 v4) = ObjectArray [ObjectFloat v1, ObjectFloat v2, ObjectFloat v3, ObjectFloat v4]+    fromObj (ObjectArray [ObjectFloat v1, ObjectFloat v2, ObjectFloat v3, ObjectFloat v4]) = Colour v1 v2 v3 v4++ctColour :: ComponentType Colour+ctColour = ComponentType 0xe202add0521cde41++-- generated++white :: Colour+white = Colour 1.0 1.0 1.0 1.0++silver:: Colour+silver  = Colour 0.75 0.75 0.75 1.0++grey:: Colour+grey = Colour 0.5 0.5 0.5 1.0++darkgrey :: Colour+darkgrey = Colour 0.25 0.25 0.25 1.0++black :: Colour+black = Colour 0.0 0.0 0.0 1.0++red :: Colour+red = Colour 1.0 0.0 0.0 1.0++maroon :: Colour+maroon = Colour 0.5 0.0 0.0 1.0++yellow :: Colour+yellow = Colour 1.0 1.0 0.0 1.0++olive :: Colour+olive = Colour 0.5 0.5 0.0 1.0++lime :: Colour+lime = Colour 0.0 1.0 0.0 1.0++green :: Colour+green = Colour 0.0 0.5 0.0 1.0++aqua :: Colour+aqua = Colour 0.0 1.0 1.0 1.0++teal :: Colour+teal = Colour 0.0 0.5 0.5 1.0++blue :: Colour+blue = Colour 0.0 0.0 1.0 1.0++navy :: Colour+navy = Colour 0.0 0.0 0.5 1.0++fuchsia :: Colour+fuchsia = Colour 1.0 0.0 1.0 1.0++purple :: Colour+purple = Colour 0.5 0.0 0.5 1.0+++
− HGamer3D/Data/Component.hs
@@ -1,67 +0,0 @@-{-
-	Components are pieces of the handcrafted record system
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Data/Component.hs
--}
-    
-{-# LANGUAGE TypeSynonymInstances #-}
-
--- | Components of the Entity Component System of HGamer3D
-module HGamer3D.Data.Component
-(
-    ComponentType (..),
-    Component,
-    ComponentClass (..)
-)
-where
-
-import Data.Word
-import Data.MessagePack
-import Data.ByteString
-import Data.Text
-import Data.Text.Encoding
-
--- | Components in Entities are indexed by ComponentType
-data ComponentType a = ComponentType Word64 deriving (Eq, Show, Ord)
-
--- | Components are stored as ByteString
-type Component = ByteString
-
--- | ComponentClass is the typeclass of data types, which can be components
-class ComponentClass a where
-  toObj :: a -> Object
-  fromObj :: Object -> a
-
-instance ComponentClass () where
-   toObj () = ObjectNil
-   fromObj ObjectNil = ()
-
-instance ComponentClass Text where
-   toObj text = ObjectString (encodeUtf8 text)
-   fromObj (ObjectString bs) = decodeUtf8 bs 
-
-instance ComponentClass (ComponentType a) where
-   toObj (ComponentType i) = ObjectInt (fromIntegral i)
-   fromObj (ObjectInt i) = ComponentType (fromIntegral i)
-   
-instance ComponentClass Bool where
-    toObj b = ObjectBool b
-    fromObj (ObjectBool b) = b
-    
-instance ComponentClass Int where
-    toObj i = ObjectInt (fromIntegral i)
-    fromObj (ObjectInt i) = fromIntegral i
-    
-instance ComponentClass a => ComponentClass (Maybe a) where
-    toObj Nothing = ObjectArray [ObjectInt 0]
-    toObj (Just v) = ObjectArray [ObjectInt 1, toObj v]
-    fromObj (ObjectArray [ObjectInt 0]) = Nothing
-    fromObj (ObjectArray [ObjectInt 1, v_o]) = Just (fromObj v_o)
-
-
HGamer3D/Data/GameTime.hs view
@@ -1,97 +1,97 @@-{-
-	Time datatypes and functions
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2011-2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Data/GameTime.hs
--}
-    
-
-{-# LANGUAGE TypeSynonymInstances, CPP #-}
-
--- | The time type for HGamer3D
-module HGamer3D.Data.GameTime
-
-(
-  GameTime,
-  
-  -- * functions, to convert time into a value 
-  sec,
-  msec,
-  usec,
-  
-  -- * functions to create a time from a value
-  secT,
-  msecT,
-  usecT,
-  
-  -- * functions, which handle different aspects of time
-  getTime,
-  getThreadCPUTime,
-  getProcessCPUTime,
-  sleepFor
-)
-
-where
-
-import Control.Concurrent
-import qualified System.Clock as C
-
-type GameTime = C.TimeSpec
-
-_toInteger :: C.TimeSpec -> Integer
-_toInteger ts = let
-  s = (fromIntegral (C.sec ts)) :: Integer
-  ns = (fromIntegral (C.nsec ts)) :: Integer
-  in s * 1000000000 + ns
-
-_fromInteger :: Integer -> C.TimeSpec
-_fromInteger i = let
-  s = fromIntegral (i `quot` 1000000000)
-  ns = fromIntegral (i `rem` 1000000000)
-  in C.TimeSpec s ns
-
--- | time to seconds
-sec :: C.TimeSpec -> Int
-sec ts = fromIntegral ((_toInteger ts) `quot` 1000000000)
-
--- | time to milliseconds
-msec :: C.TimeSpec -> Int
-msec ts = fromIntegral ((_toInteger ts) `quot` 1000000)
-
--- | time to microseconds
-usec :: C.TimeSpec -> Int
-usec ts = fromIntegral ((_toInteger ts) `quot` 1000)
-
--- | create time from seconds
-secT :: Int -> C.TimeSpec
-secT i = _fromInteger ((fromIntegral i) * 1000000000)
-
--- | create time from milliseconds
-msecT :: Int -> C.TimeSpec
-msecT i = _fromInteger ((fromIntegral i) * 1000000)
-
--- | create time from microseconds
-usecT :: Int -> C.TimeSpec
-usecT i = _fromInteger ((fromIntegral i) * 1000)
-
--- | get current time
-getTime :: IO GameTime
-getTime = C.getTime C.Realtime
-
--- | get thread time
-getThreadCPUTime :: IO GameTime
-getThreadCPUTime = C.getTime C.ThreadCPUTime
-
--- | get process cpu time
-getProcessCPUTime :: IO GameTime
-getProcessCPUTime = C.getTime C.ProcessCPUTime
-
--- | sleep for time intervall
-sleepFor :: GameTime -> IO ()
-sleepFor gt = threadDelay (usec gt)
-
+{-+	Time datatypes and functions+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2011-2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Data/GameTime.hs+-}+    ++{-# LANGUAGE TypeSynonymInstances, CPP #-}++-- | The time type for HGamer3D+module HGamer3D.Data.GameTime++(+  GameTime,+  +  -- * functions, to convert time into a value +  sec,+  msec,+  usec,+  +  -- * functions to create a time from a value+  secT,+  msecT,+  usecT,+  +  -- * functions, which handle different aspects of time+  getTime,+  getThreadCPUTime,+  getProcessCPUTime,+  sleepFor+)++where++import Control.Concurrent+import qualified System.Clock as C++type GameTime = C.TimeSpec++_toInteger :: C.TimeSpec -> Integer+_toInteger ts = let+  s = (fromIntegral (C.sec ts)) :: Integer+  ns = (fromIntegral (C.nsec ts)) :: Integer+  in s * 1000000000 + ns++_fromInteger :: Integer -> C.TimeSpec+_fromInteger i = let+  s = fromIntegral (i `quot` 1000000000)+  ns = fromIntegral (i `rem` 1000000000)+  in C.TimeSpec s ns++-- | time to seconds+sec :: C.TimeSpec -> Int+sec ts = fromIntegral ((_toInteger ts) `quot` 1000000000)++-- | time to milliseconds+msec :: C.TimeSpec -> Int+msec ts = fromIntegral ((_toInteger ts) `quot` 1000000)++-- | time to microseconds+usec :: C.TimeSpec -> Int+usec ts = fromIntegral ((_toInteger ts) `quot` 1000)++-- | create time from seconds+secT :: Int -> C.TimeSpec+secT i = _fromInteger ((fromIntegral i) * 1000000000)++-- | create time from milliseconds+msecT :: Int -> C.TimeSpec+msecT i = _fromInteger ((fromIntegral i) * 1000000)++-- | create time from microseconds+usecT :: Int -> C.TimeSpec+usecT i = _fromInteger ((fromIntegral i) * 1000)++-- | get current time+getTime :: IO GameTime+getTime = C.getTime C.Realtime++-- | get thread time+getThreadCPUTime :: IO GameTime+getThreadCPUTime = C.getTime C.ThreadCPUTime++-- | get process cpu time+getProcessCPUTime :: IO GameTime+getProcessCPUTime = C.getTime C.ProcessCPUTime++-- | sleep for time intervall+sleepFor :: GameTime -> IO ()+sleepFor gt = threadDelay (usec gt)+
HGamer3D/Data/Geometry2D.hs view
@@ -1,83 +1,83 @@-{-
-	2D Geometry
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2011-2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Data/Geometry2D.hs
--}
-  
-{-# LANGUAGE FlexibleInstances #-}
-
--- | Type definitions for 2D geometry 
-module HGamer3D.Data.Geometry2D
-(
-  -- * Geometry
-  Point (..),
-  Rectangle (..),
-  
-  ctScreenRect,
-  
-  rectFromPoints,
-  pointsFromRect
-  
-) where
-  
-import Data.MessagePack
-import HGamer3D.Data.Component
-
--- | A point has two coordinates an x and y one
-data Num a => Point a = Point {
-  ptX :: a,
-  ptY :: a
-  } deriving (Eq, Show)
-
-instance ComponentClass (Point Float) where
-  toObj (Point a b) = ObjectArray [ObjectFloat a, ObjectFloat b]
-  fromObj (ObjectArray [ObjectFloat a, ObjectFloat b]) = (Point a b)
-                      
-instance ComponentClass (Point Int) where
-  toObj (Point a b) = ObjectArray [ObjectInt (fromIntegral a), ObjectInt (fromIntegral b)]
-  fromObj (ObjectArray [ObjectInt a, ObjectInt b]) = (Point (fromIntegral a) (fromIntegral b))
-                      
--- | A rectangle has an a position as x and y and widht and height
-data Num a => Rectangle a = Rectangle {
-  xpos :: a,
-  ypos :: a,
-  width :: a,
-  height :: a } deriving (Eq, Show)
-
-ctScreenRect :: ComponentType (Rectangle Int)
-ctScreenRect = ComponentType 0x16877957e32da6b1  
-  
-instance ComponentClass (Rectangle Float) where
-  toObj (Rectangle x y w h) = ObjectArray [ObjectFloat x, ObjectFloat y, ObjectFloat w, ObjectFloat h]
-  fromObj (ObjectArray [ObjectFloat x, ObjectFloat y, ObjectFloat w, ObjectFloat h]) = (Rectangle x y w h)
-
-instance ComponentClass (Rectangle Int) where
-  toObj (Rectangle x y w h) = ObjectArray [ObjectInt (fromIntegral x), ObjectInt (fromIntegral y), ObjectInt (fromIntegral w), ObjectInt (fromIntegral h)]
-  fromObj (ObjectArray [ObjectInt x, ObjectInt y, ObjectInt w, ObjectInt h]) = Rectangle (fromIntegral x) (fromIntegral y) (fromIntegral w) (fromIntegral h)
-
-  
-  
--- | derive a rectangle from upper left and lower right points
-rectFromPoints :: Num a => Point a -> Point a -> Rectangle a
-rectFromPoints upperLeft lowerRight = Rectangle rx ry rw rh where
-  rx = ptX upperLeft
-  ry = ptY upperLeft
-  rw = (ptY lowerRight) - rx
-  rh = (ptY lowerRight) - ry
-  
--- | get upper left and lower right point from a rect
-pointsFromRect :: Num a => Rectangle a -> (Point a, Point a)
-pointsFromRect rect = (ul, lr) where
-  rx = xpos rect
-  ry = ypos rect
-  rx' = rx + (width rect)
-  ry' = ry + (height rect)
-  ul = Point rx ry
-  lr = Point rx' ry'
-  
+{-+	2D Geometry+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2011-2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Data/Geometry2D.hs+-}+  +{-# LANGUAGE FlexibleInstances #-}++-- | Type definitions for 2D geometry +module HGamer3D.Data.Geometry2D+(+  -- * Geometry+  Point (..),+  Rectangle (..),+  +  ctScreenRect,+  +  rectFromPoints,+  pointsFromRect+  +) where+  +import Data.MessagePack+import Fresco++-- | A point has two coordinates an x and y one+data Num a => Point a = Point {+  ptX :: a,+  ptY :: a+  } deriving (Eq, Show)++instance ComponentClass (Point Float) where+  toObj (Point a b) = ObjectArray [ObjectFloat a, ObjectFloat b]+  fromObj (ObjectArray [ObjectFloat a, ObjectFloat b]) = (Point a b)+                      +instance ComponentClass (Point Int) where+  toObj (Point a b) = ObjectArray [ObjectInt (fromIntegral a), ObjectInt (fromIntegral b)]+  fromObj (ObjectArray [ObjectInt a, ObjectInt b]) = (Point (fromIntegral a) (fromIntegral b))+                      +-- | A rectangle has an a position as x and y and widht and height+data Num a => Rectangle a = Rectangle {+  xpos :: a,+  ypos :: a,+  width :: a,+  height :: a } deriving (Eq, Show)++ctScreenRect :: ComponentType (Rectangle Int)+ctScreenRect = ComponentType 0x16877957e32da6b1  +  +instance ComponentClass (Rectangle Float) where+  toObj (Rectangle x y w h) = ObjectArray [ObjectFloat x, ObjectFloat y, ObjectFloat w, ObjectFloat h]+  fromObj (ObjectArray [ObjectFloat x, ObjectFloat y, ObjectFloat w, ObjectFloat h]) = (Rectangle x y w h)++instance ComponentClass (Rectangle Int) where+  toObj (Rectangle x y w h) = ObjectArray [ObjectInt (fromIntegral x), ObjectInt (fromIntegral y), ObjectInt (fromIntegral w), ObjectInt (fromIntegral h)]+  fromObj (ObjectArray [ObjectInt x, ObjectInt y, ObjectInt w, ObjectInt h]) = Rectangle (fromIntegral x) (fromIntegral y) (fromIntegral w) (fromIntegral h)++  +  +-- | derive a rectangle from upper left and lower right points+rectFromPoints :: Num a => Point a -> Point a -> Rectangle a+rectFromPoints upperLeft lowerRight = Rectangle rx ry rw rh where+  rx = ptX upperLeft+  ry = ptY upperLeft+  rw = (ptY lowerRight) - rx+  rh = (ptY lowerRight) - ry+  +-- | get upper left and lower right point from a rect+pointsFromRect :: Num a => Rectangle a -> (Point a, Point a)+pointsFromRect rect = (ul, lr) where+  rx = xpos rect+  ry = ypos rect+  rx' = rx + (width rect)+  ry' = ry + (height rect)+  ul = Point rx ry+  lr = Point rx' ry'+  
HGamer3D/Data/LMH.hs view
@@ -1,48 +1,47 @@-{-
-	Low, Medium, High Datatype
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2011-2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Data/LMH.hs
--}
-
--- | Data type to specify a 3 choice volume of anything: Low, Medium, High
-module HGamer3D.Data.LMH
-(
-    ctOnOff,
-    LMH (..),
-    ctLMH
-)
-
-where
-
-import Data.MessagePack
-import HGamer3D.Data.Component
-
-ctOnOff :: ComponentType Bool
-ctOnOff = ComponentType 0x30b235f8b63df8b0
-
-data LMH = Low
-        |  Medium
-        |  High
-        deriving (Eq, Ord, Show)
-
-instance ComponentClass LMH where
-        toObj lmh = case lmh of
-                Low -> ObjectInt 1
-                Medium -> ObjectInt 2
-                High -> ObjectInt 3
-        fromObj (ObjectInt n) = case n of
-                1 -> Low
-                2 -> Medium
-                3 -> High
-
-ctLMH :: ComponentType LMH
-ctLMH = ComponentType 0xd632bb5447a6c93c
-
-
-
+{-+	Low, Medium, High Datatype+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2011-2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Data/LMH.hs+-}++-- | Data type to specify a 3 choice volume of anything: Low, Medium, High+module HGamer3D.Data.LMH+(+    ctOnOff,+    QualityLMH (..),+    ctLMH+)++where++import Data.MessagePack+import Fresco++ctOnOff :: ComponentType Bool+ctOnOff = ComponentType 0x30b235f8b63df8b0++data QualityLMH = Low+    | Medium+    | High+    deriving (Eq, Read, Show)++instance ComponentClass QualityLMH where+    toObj (Low) = ObjectArray [ObjectInt 0, ObjectArray []]+    toObj (Medium) = ObjectArray [ObjectInt 1, ObjectArray []]+    toObj (High) = ObjectArray [ObjectInt 2, ObjectArray []]+    fromObj (ObjectArray [ObjectInt 0, ObjectArray []]) = Low+    fromObj (ObjectArray [ObjectInt 1, ObjectArray []]) = Medium+    fromObj (ObjectArray [ObjectInt 2, ObjectArray []]) = High+++ctLMH :: ComponentType QualityLMH+ctLMH = ComponentType 0xd632bb5447a6c93c+++
HGamer3D/Data/PlayCmd.hs view
@@ -1,40 +1,41 @@-{-
-	The Play Command
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2011-2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Data/PlayCmd.hs
--}
-
--- | Type for a generic play command
-module HGamer3D.Data.PlayCmd
-(
-  PlayCmd (..),
-  ctPlayCmd
-    
-) where
-
-import Data.MessagePack
-import HGamer3D.Data.Component
-
-data PlayCmd = Play
-               | Pause
-               | Stop
-               deriving (Eq, Show)
-
-instance ComponentClass PlayCmd where
-    toObj Play = ObjectInt 1
-    toObj Pause = ObjectInt 2
-    toObj Stop = ObjectInt 3
-    fromObj (ObjectInt 1) = Play
-    fromObj (ObjectInt 2) = Pause
-    fromObj (ObjectInt 3) = Stop
-
-ctPlayCmd :: ComponentType PlayCmd
-ctPlayCmd = ComponentType 0x35f7752020f7f1cd
-
-
+{-+	The Play Command+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2011-2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Data/PlayCmd.hs+-}++-- | Type for a generic play command+module HGamer3D.Data.PlayCmd+(+  PlayCmd (..),+  ctPlayCmd+    +) where++import Data.MessagePack+import Fresco+++data PlayCmd = Play+               | Pause+               | Stop+               deriving (Eq, Show)++instance ComponentClass PlayCmd where+    toObj Play = ObjectInt 1+    toObj Pause = ObjectInt 2+    toObj Stop = ObjectInt 3+    fromObj (ObjectInt 1) = Play+    fromObj (ObjectInt 2) = Pause+    fromObj (ObjectInt 3) = Stop++ctPlayCmd :: ComponentType PlayCmd+ctPlayCmd = ComponentType 0x35f7752020f7f1cd++
HGamer3D/Data/Transform3D.hs view
@@ -1,60 +1,60 @@-{-
-	Transformation of 3D entities by scale, position, ...
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2011-2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Data/Transform3D.hs
--}
-  
--- | Functions for basic 3D transformations
-module HGamer3D.Data.Transform3D
-(
-  translate,
-  scale, 
-  yaw,
-  pitch,
-  roll
-)
-
-where
-
-import HGamer3D.Data.Vector
-import HGamer3D.Data.Angle
-
-type Position = Vec3
-type Orientation = UnitQuaternion
-type Size = Vec3
-
--- | move the position 
-translate :: Position -> Position -> Position
-translate = (&+)
-
--- | scale the size
-scale :: Size -> Vec3 -> Size
-scale  = (&!)
-
--- yaw, roll, pitch functions
--- functions, to rotate on axis, relative to object
-rotRelativeToObjectAxis :: Orientation -> Vec3 -> Float -> Orientation
-rotRelativeToObjectAxis ori axis val = let
-  odir = actU ori axis
-  qrot = rotU odir val
-  nrot = qrot .*. ori
-  in nrot
-	
--- | rotate object on own axis (yaw) by angle
-yaw :: Orientation -> Angle -> Orientation
-yaw ori val = rotRelativeToObjectAxis ori vec3Y (asRad val)
-
--- | rotate object on own axis (roll) by angle
-roll :: Orientation -> Angle -> Orientation
-roll ori val = rotRelativeToObjectAxis ori vec3Z (asRad val)
-
--- | rotate object on own axis (pitch) by angle
-pitch :: Orientation -> Angle -> Orientation
-pitch ori val = rotRelativeToObjectAxis ori vec3X (asRad val)
-
+{-+	Transformation of 3D entities by scale, position, ...+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2011-2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Data/Transform3D.hs+-}+  +-- | Functions for basic 3D transformations+module HGamer3D.Data.Transform3D+(+  translate,+  scale, +  yaw,+  pitch,+  roll+)++where++import HGamer3D.Data.Vector+import HGamer3D.Data.Angle++type Position = Vec3+type Orientation = UnitQuaternion+type Size = Vec3++-- | move the position +translate :: Position -> Position -> Position+translate = (&+)++-- | scale the size+scale :: Size -> Vec3 -> Size+scale  = (&!)++-- yaw, roll, pitch functions+-- functions, to rotate on axis, relative to object+rotRelativeToObjectAxis :: Orientation -> Vec3 -> Float -> Orientation+rotRelativeToObjectAxis ori axis val = let+  odir = actU ori axis+  qrot = rotU odir val+  nrot = qrot .*. ori+  in nrot+	+-- | rotate object on own axis (yaw) by angle+yaw :: Orientation -> Angle -> Orientation+yaw ori val = rotRelativeToObjectAxis ori vec3Y (asRad val)++-- | rotate object on own axis (roll) by angle+roll :: Orientation -> Angle -> Orientation+roll ori val = rotRelativeToObjectAxis ori vec3Z (asRad val)++-- | rotate object on own axis (pitch) by angle+pitch :: Orientation -> Angle -> Orientation+pitch ori val = rotRelativeToObjectAxis ori vec3X (asRad val)+
HGamer3D/Data/TypeSynonyms.hs view
@@ -1,45 +1,45 @@-{-
-	Transformation of 3D entities by scale, position, ...
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2011-2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Data/TypeSynonyms.hs
--}
-
--- | Some common type synonyms
-module HGamer3D.Data.TypeSynonyms
-
-where
-
-import HGamer3D.Data.Component
-import HGamer3D.Data.Vector
-  
--- | Size implemented as a Vec3
-type Scale = Vec3
-
--- | Position implemented as a Vec3
-type Position = Vec3
-
--- | Orientation implemented as a UnitQuaternion
-type Orientation = UnitQuaternion
-
--- properties
-ctPosition :: ComponentType Position
-ctPosition = ComponentType 0x29aacbbb10c84016
-
-ctScale :: ComponentType Scale
-ctScale = ComponentType 0x2f9c124bc8fd41c4
-
--- CH4-3s
-ctOrientation :: ComponentType Orientation
-ctOrientation = ComponentType 0x815eb4d9c7bfaa74
--- CH4-3e
-
-ctVisible :: ComponentType Bool
-ctVisible = ComponentType 0x98e7a78e949e1c6e
-
-
+{-+	Transformation of 3D entities by scale, position, ...+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2011-2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Data/TypeSynonyms.hs+-}++-- | Some common type synonyms+module HGamer3D.Data.TypeSynonyms++where++import Fresco+import HGamer3D.Data.Vector+  +-- | Size implemented as a Vec3+type Scale = Vec3++-- | Position implemented as a Vec3+type Position = Vec3++-- | Orientation implemented as a UnitQuaternion+type Orientation = UnitQuaternion++-- properties+ctPosition :: ComponentType Position+ctPosition = ComponentType 0x29aacbbb10c84016++ctScale :: ComponentType Scale+ctScale = ComponentType 0x2f9c124bc8fd41c4++-- CH4-3s+ctOrientation :: ComponentType Orientation+ctOrientation = ComponentType 0x815eb4d9c7bfaa74+-- CH4-3e++ctVisible :: ComponentType Bool+ctVisible = ComponentType 0x98e7a78e949e1c6e++
HGamer3D/Data/Vector.hs view
@@ -1,77 +1,77 @@-{-
-    Vector library, imported from package Vect 
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2011-2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Data/Vector.hs
--}
-
-{-# LANGUAGE GeneralizedNewtypeDeriving, StandaloneDeriving #-}
-
--- | Vector library for HGamer3D
-module HGamer3D.Data.Vector
-(
-
-    -- * the Vect libray of Balazs Komuves, see: <http://hackage.haskell.org/package/vect>
-
-    module Data.Vect.Float,
-    module Data.Vect.Float.Util.Quaternion,
-
-    -- * some constants
-
-    zeroVec2,
-    unitVec2,
-
-    zeroVec3,
-    unitVec3
-
-)
-
-where
-
-import Data.Vect.Float
-import Data.Vect.Float.Util.Quaternion
-import Data.MessagePack
-import HGamer3D.Data.Component
-
-deriving instance Eq UnitQuaternion
-deriving instance Eq Vec2
-deriving instance Eq Vec3
-deriving instance Eq Vec4
-
-instance ComponentClass Vec2 where
-    toObj (Vec2 x y) = ObjectArray [ObjectFloat x, ObjectFloat y]
-    fromObj (ObjectArray [ObjectFloat x, ObjectFloat y]) = (Vec2 x y)
-
-instance ComponentClass Vec3 where
-    toObj (Vec3 x y z) = ObjectArray [ObjectFloat x, ObjectFloat y, ObjectFloat z]
-    fromObj (ObjectArray [ObjectFloat x, ObjectFloat y, ObjectFloat z]) = (Vec3 x y z)
-
-instance ComponentClass Vec4 where
-    toObj (Vec4 w x y z) = ObjectArray [ObjectFloat w, ObjectFloat x, ObjectFloat y, ObjectFloat z]
-    fromObj (ObjectArray [ObjectFloat w, ObjectFloat x, ObjectFloat y, ObjectFloat z]) = (Vec4 w x y z)
-
-instance ComponentClass Quaternion where
-    toObj (Q v) = toObj v
-    fromObj o = Q (fromObj o)
-
-instance ComponentClass UnitQuaternion where
-    toObj (U v) = toObj v
-    fromObj o = U (fromObj o)
-
--- | the 2d zero vector
-zeroVec2 = Vec2 0.0 0.0
-
--- | the 2d unity vector
-unitVec2 = Vec2 1.0 1.0
-
--- | the 3d Zero vector
-zeroVec3 = Vec3 0.0 0.0 0.0
-
--- | the 3d Unity vector
-unitVec3 = Vec3 1.0 1.0 1.0
-
+{-+    Vector library, imported from package Vect +	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2011-2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Data/Vector.hs+-}++{-# LANGUAGE GeneralizedNewtypeDeriving, StandaloneDeriving #-}++-- | Vector library for HGamer3D+module HGamer3D.Data.Vector+(++    -- * the Vect libray of Balazs Komuves, see: <http://hackage.haskell.org/package/vect>++    module Data.Vect.Float,+    module Data.Vect.Float.Util.Quaternion,++    -- * some constants++    zeroVec2,+    unitVec2,++    zeroVec3,+    unitVec3++)++where++import Data.Vect.Float+import Data.Vect.Float.Util.Quaternion+import Data.MessagePack+import Fresco++deriving instance Eq UnitQuaternion+deriving instance Eq Vec2+deriving instance Eq Vec3+deriving instance Eq Vec4++instance ComponentClass Vec2 where+    toObj (Vec2 x y) = ObjectArray [ObjectFloat x, ObjectFloat y]+    fromObj (ObjectArray [ObjectFloat x, ObjectFloat y]) = (Vec2 x y)++instance ComponentClass Vec3 where+    toObj (Vec3 x y z) = ObjectArray [ObjectFloat x, ObjectFloat y, ObjectFloat z]+    fromObj (ObjectArray [ObjectFloat x, ObjectFloat y, ObjectFloat z]) = (Vec3 x y z)++instance ComponentClass Vec4 where+    toObj (Vec4 w x y z) = ObjectArray [ObjectFloat w, ObjectFloat x, ObjectFloat y, ObjectFloat z]+    fromObj (ObjectArray [ObjectFloat w, ObjectFloat x, ObjectFloat y, ObjectFloat z]) = (Vec4 w x y z)++instance ComponentClass Quaternion where+    toObj (Q v) = toObj v+    fromObj o = Q (fromObj o)++instance ComponentClass UnitQuaternion where+    toObj (U v) = toObj v+    fromObj o = U (fromObj o)++-- | the 2d zero vector+zeroVec2 = Vec2 0.0 0.0++-- | the 2d unity vector+unitVec2 = Vec2 1.0 1.0++-- | the 3d Zero vector+zeroVec3 = Vec3 0.0 0.0 0.0++-- | the 3d Unity vector+unitVec3 = Vec3 1.0 1.0 1.0+
HGamer3D/Data/Window.hs view
@@ -1,31 +1,30 @@-{-
-	The Window Instance Type
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2011-2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Data/Window.hs
--}
-
--- | Type for a system window as its window handle
-module HGamer3D.Data.Window
-(
-  -- * A Window Handle as Int
-  Window (..),
-  ctWindow
-    
-) where
-
-import Data.MessagePack
-import HGamer3D.Data.Component
-
-type Window = Int
-
--- properties
-ctWindow :: ComponentType Window
-ctWindow = ComponentType 0xad5b3c63f7f7dd1b
-
-
+{-+	The Window Instance Type+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2011-2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Data/Window.hs+-}++-- | Type for a system window as its window handle+module HGamer3D.Data.Window+(+  -- * A Window Handle as Int+  Window (..),+  ctWindow+    +) where++import Fresco++type Window = Int++-- properties+ctWindow :: ComponentType Window+ctWindow = ComponentType 0xad5b3c63f7f7dd1b++
− HGamer3D/ECS.hs
@@ -1,34 +0,0 @@--- 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) 2015 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.
--- 
--- HGamer3D/ECS.hs
--- 
-
--- | Entity - Component - System for HGamer3D 
-module HGamer3D.ECS
-
-(
-	module HGamer3D.ECS.Entity,
-	module HGamer3D.ECS.System
-)
-
-where
-
-import HGamer3D.ECS.Entity
-import HGamer3D.ECS.System
-
− HGamer3D/ECS/Entity.hs
@@ -1,181 +0,0 @@--- 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) 2015 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.
-
--- HGamer3D/ECS/Entity
-
-{-# Language ExistentialQuantification #-}
-
--- | Entity of the Entity ComponentType System for HGamer3D
-module HGamer3D.ECS.Entity (
-
--- * EntityData Type
---   Entities are a kind of simplified extensible record system. They are basically a Map from ComponentType (64 bit id) to a data item with 
---   ComponentClass Typeclass. Basic entities are non-mutable but their exists the entity reference.
-
-  EntityData,
-  (#:),
-  (#!),
-  (#),
-
--- * Entity Type
---   The ERef type, which puts an EntityData into
---   an IORef and serves as mutable data structure.
---   In HGamer3D those ERefs are also used as thread-safe communication vehicle towards the C/C++ implementation of multimedia functionality.
-
-  Entity (..),
-  newE,
-  readE,
-  readC,
-  updateC,
-  setC,
-  _setC',
-
--- * Listener
--- Mechanism to register listener on ComponentTypes of ERef
-
-  addListener,
-  clearListeners
-
-)
-where
-
-import Data.Maybe
-import Data.ByteString
---import Data.Dynamic
---import Data.Typeable
-import qualified Data.Map as M
-import Data.IORef
-
-import Control.Concurrent
-import Control.Applicative
-
-import Foreign
-import Foreign.C
-
-import HGamer3D.Binding
-import HGamer3D.Data 
-
--- | EntityData, a simple non-mutable record type, implemented as Map
-type EntityData = M.Map Word64 Component
-
--- | pair builder for nice construction syntax, allows [ ct #: val, ...] syntax
-(#:) :: ComponentClass a => ComponentType a -> a -> (Word64, Component)
-(ComponentType c) #: val = (c, toMsg val)
-
--- | Builder for entities, allows newE = entity [ct #: val, ...] syntax
-entityData :: [(Word64, Component)] -> EntityData
-entityData clist = M.fromList clist
-
--- | does the entity have the ComponentType
-(#?) :: EntityData -> ComponentType a -> Bool
-e #? (ComponentType c) = Prelude.elem c $ M.keys e
-
--- | get the ComponentType, throws exception, if ComponentType not present
-(#!) :: ComponentClass a => EntityData -> ComponentType a -> a
-e #! (ComponentType c) = fromJust $ M.lookup c e >>= fromMsg
-
--- | get the ComponentType as an maybe, in case wrong type
-(#) :: ComponentClass a => EntityData -> ComponentType a -> Maybe a
-e # (ComponentType c) = M.lookup c e >>= fromMsg
-
--- | modification function, throws exception, if ComponentType not present
-updateDataC :: ComponentClass a => EntityData -> ComponentType a -> (a -> a) -> EntityData
-updateDataC e c'@(ComponentType c) f = M.insert c ((toMsg . f) (e #! c')) e
-
--- | modification function, sets entity ComponentType, needed for events
-setDataC :: ComponentClass a => EntityData -> ComponentType a -> a -> EntityData
-setDataC e (ComponentType c) val = M.insert c (toMsg val) e
-
-
--- References to Entities
-
--- besides Entity, we need atomic references to entities, we call them ERef
--- ERefs also have listeners for updates
-
--- Listener Map, for each k, manages a map of writers, writers geting the old and the new value after a change
-
-type Listeners = IORef (M.Map Word64 [EntityData -> EntityData -> IO ()])
-
--- | ERef, composable objects, referenced Entities with listeners
-data Entity = Entity (IORef EntityData) Listeners deriving (Eq)
-
--- | Add an action (IO function), which will be executed when value of ComponentType is changed
-addListener :: Entity -> ComponentType a -> (EntityData -> EntityData -> IO ()) -> IO ()
-addListener (Entity _ tls) (ComponentType c) l = atomicModifyIORef tls (\m -> let
-            l' = case M.lookup c m of
-                           Just ol -> ol ++ [l]
-                           Nothing -> [l]
-            in (M.insert c l' m, ()))
-
--- | Clear all listeners from Entity
-clearListeners :: Entity -> IO ()
-clearListeners (Entity _ tls) = atomicWriteIORef tls (M.fromList [])
-
-fireListeners :: Entity -> ComponentType a -> EntityData -> EntityData -> IO ()
-fireListeners (Entity _ tls) (ComponentType c) val val' = do
-              ls <- readIORef tls
-              case M.lookup c ls of
-                   Just l -> mapM (\f -> f val val') l >> return ()
-                   Nothing -> return ()
-
--- | creates an Entity
-newE :: [(Word64, Component)] -> IO Entity
-newE inlist = do
-     let e = entityData inlist
-     te <- newIORef e
-     tl <- newIORef (M.fromList [])
-     return $ Entity te tl
-
--- | reads the EntityData from an Entity
-readE :: Entity -> IO EntityData
-readE (Entity te _) = readIORef te
-
--- | reads one ComponentType, throws exception, if ComponentType not present, or wrong type
-readC :: ComponentClass a => Entity -> ComponentType a -> IO a
-readC er c = readE er >>= \e -> return (e #! c)
-
--- | updates one ComponentType
-updateC :: ComponentClass a => Entity -> ComponentType a -> (a -> a) -> IO ()
-updateC er@(Entity te tl) c f = do
-        (e, e') <- atomicModifyIORef te (\olde -> let
-                    newe = updateDataC olde c f
-                    in (newe, (olde, newe)))
-        fireListeners er c e e'
-        return ()
-
--- | sets one ComponentType
-setC :: ComponentClass a => Entity -> ComponentType a -> a -> IO ()
-setC er@(Entity te tl) c val = do
-        (e, e') <- atomicModifyIORef te (\olde -> let
-                    newe = setDataC olde c val
-                    in (newe, (olde, newe)))
-        fireListeners er c e e'
-        return ()
-
--- | sets one ComponentType as Component
-_setC' :: Entity -> Word64 -> Component -> IO ()
-_setC' er@(Entity te tls) c val = do
-        (e, e') <- atomicModifyIORef te (\olde -> let
-                    newe = M.insert c val olde
-                    in (newe, (olde, newe)))
-        ls <- readIORef tls
-        case M.lookup c ls of
-             Just l -> mapM (\f -> f e e') l >> return ()
-             Nothing -> return ()
-        return ()
-
− HGamer3D/ECS/System.hs
@@ -1,255 +0,0 @@--- 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) 2015 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.
-
--- HGamer3D/ECS/System.hs
-
-{-# LANGUAGE ForeignFunctionInterface #-}
-
--- | System of the Entity Component System for HGamer3D
-module HGamer3D.ECS.System
-(
-  SystemData (..),
-  runSystem,
-  addToWorld,
-  removeFromWorld
-)
-where
-
-import Data.Maybe
-import Data.Dynamic
-import Data.Typeable
-import Data.List as L
-import qualified Data.Map as M
-import Data.IORef
-
-import qualified Data.ByteString as B
-import qualified Data.ByteString.Unsafe as BU
-
-import Foreign
-import Foreign.C
-import Foreign.C.String
-import Foreign.Ptr
-
-import Control.Concurrent
-import Control.Applicative
-
-import HGamer3D.Binding
-import HGamer3D.Data 
-import HGamer3D.ECS.Entity
-
-
--- System
-
-
--- ComponentListener, used internally in sytems
-
-type ComponentListener = IORef (Maybe (EntityData, EntityData))
-
-componentListener :: Entity -> ComponentType a -> IO ComponentListener
-componentListener er@(Entity te tl) c  = do
-           tv <- newIORef Nothing
-           let w e e' = atomicModifyIORef tv (\old -> let
-                                                        new = case old of
-                                                          Nothing -> Just (e, e')
-                                                          Just (o, o') -> Just (o, e')
-                                                        in (new, ()))
-           addListener er c w
-           return tv
-
-queryComponentListener :: ComponentListener -> IO (Maybe (EntityData, EntityData))
-queryComponentListener tv = atomicModifyIORef tv (\val -> (Nothing, val))
-
-
-{-
-        A system reacts towards changes/updates in entities and their components. The system does it by creating for each component it handles an internal represenation, which it modifies upon changes to this component and to potentially additional changes in other components. For example an entity representing a light could have a Light component, which is created and modified upon change in the light component data. The entity may well have also a position component and the light entity is moved, in case the position component is modified.
-
-        In general the system works by keeping a list of component listener on each added (each observes one component of an entity) and functions, which are called, in case the component listener exhibits a component change. 
-
--}
-
-type OnUpdateFunction = EntityData -> EntityData -> IO ()
-type OnDeleteFunction = IO ()
-type SystemRecord = (Entity, Either (ComponentListener, OnUpdateFunction) OnDeleteFunction)
-type SystemFunction = SystemData -> Entity -> IO [SystemRecord]
-
--- | this data specifies the type of system
-data SystemData = SystemData {
-     sdLock :: MVar (),
-     sdNewEntities :: IORef [Entity], 
-     sdDelEntities :: IORef [Entity],
-     sdRecords :: [SystemRecord],
-     sdComponents :: [Word64],
-     sdProperties :: [Word64],
-     sdEvents :: [Word64],
-
-     sdCreateItem :: Word64 -> B.ByteString -> IO (
-                            Int, 
-                            Ptr () 
-                            ),
-     sdDestroyItem :: Word64 -> (Ptr ()) -> IO ((Int)),
-     sdGetMessageSender :: Word64 -> Word64 -> IO ((Int), (FunPtr (Ptr () -> Ptr CChar -> CInt -> IO CInt))),
-     sdRegisterMessageReceiver :: Word64 -> Word64 -> (Ptr ()) -> (FunPtr (Ptr () -> Ptr CChar -> CInt -> IO CInt)) -> IO Int,
-     sdErrorMessage :: (Int) -> IO ((String))
-}
-
-addEntity :: SystemData -> Entity -> IO ()
-addEntity sd entity = atomicModifyIORef (sdNewEntities sd) (\a -> (entity : a, ()))
-
-removeEntity :: SystemData -> Entity -> IO ()
-removeEntity sd entity = atomicModifyIORef (sdDelEntities sd) (\a -> (entity : a, ()))
-
-stepRecord (er, Left (listener, updateF)) = do
-  me <- queryComponentListener listener
-  case me of
-        Just (e, e') -> do
-                          updateF e e'
-                          return ()
---                          stepRecord (er, Left (listener, updateF))
-        Nothing -> return ()
-stepRecord (er, Right deleteF) = return ()
-
-stepSystem :: SystemData -> IO Bool -> IO (SystemData, Bool)
-stepSystem sd@(SystemData lock nrefs drefs records cs ps es ci di gm rm em) stepF = do
-
-           -- add and delete Entitys
-           adds <- atomicModifyIORef nrefs (\a -> ([],a))
-           dels <- atomicModifyIORef drefs (\a -> ([],a))
-
-           -- remove instances
-           let delrecs = filter (\r -> (fst r) `elem` dels) records
-           mapM (\r -> clearListeners (fst r)) delrecs
-           mapM (\r -> case snd r of
-                        Right delF ->  do
-                                          delF  -- execute delete function
-                                          return ()
-                        _ -> return ()) delrecs
-           let records' = filter (\r -> not ((fst r) `elem` dels)) records
-           
-           -- add new instances
-           newRecords <- mapM (systemFunction sd) (reverse adds)
-           let records'' = (concat newRecords) ++ records'
-
-           -- run specific stepSystem
-           qFlag <- stepF
-
-           -- run stepfunction on tuples 
-           mapM stepRecord records'' 
-
-           -- return new values
-           let newSD = (SystemData lock nrefs drefs records'' cs ps es ci di gm rm em)
-           return (newSD, qFlag) -- need to add quit condition here
-                 
-runS s stepF stepT = do
-    nowT <- getTime
-    (s', qFlag) <- stepSystem s stepF
-    if qFlag then do
-      shutdownSystem s'
-      return ()
-      else do
-        nowT' <- getTime
-        let timeUsed = nowT' - nowT
-        if timeUsed < stepT then do
-          threadDelay ((fromIntegral . usec) (stepT - timeUsed) )
-          else do
-            return ()
-        runS s' stepF stepT
-
--- | start a new thread, which runs the system
-runSystem :: IO Bool -> GameTime -> SystemData -> IO ()
-runSystem stepF stepT systemData = do
-  forkOS  $ runS systemData  stepF stepT 
-  return ()
-
--- called within the run loop
-
-systemFunction sd entity = do
-
-  let components = sdComponents sd
-  let properties = sdProperties sd
-  let events = sdEvents sd
-
-  let createItem = sdCreateItem sd 
-  let destroyItem = sdDestroyItem sd
-  let getMessageSender = sdGetMessageSender sd
-  let registerMessageReceiver = sdRegisterMessageReceiver sd
-  let errorMessage = sdErrorMessage sd
-
-  let r = []
-  e <- readE entity
-
-  -- create system records, (Entity, Either (Listener, UdateF) DeleteF)
-
-  rs <- mapM (\c -> if c `elem` components
-                        then do (res, rep) <- createItem c (e M.! c)   -- create the item
-                                if res == 0 
-                                    then do let ir = (entity, Right (destroyItem c rep >> return ()))
-
-                                            -- add property records with listeners, also components can act as property
-                                            prs <- mapM (\p -> if p `elem` (properties ++ components) 
-                                                                    then do (res', propF) <- getMessageSender c p
-                                                                            if res' == 0 
-                                                                              then do lp <- componentListener entity (ComponentType p)
-                                                                                      let uf = (\oe ne -> callMsgFunction propF rep (ne M.! p) >> return ())
-                                                                                      uf e e   -- call message function, update component with this property right away
-                                                                                      return [(entity, Left (lp, uf) )]
-                                                                              else return []
-                                                                    else return []
-                                                          ) (M.keys e)
-
-                                            let prs' = concat prs
-
-                                            -- add event writer, in case applicable
-                                            mapM (\p -> if p `elem` events 
-                                                            then do let fwrite = (\_ msgData msgLen -> do   bData <- B.packCStringLen (msgData, fromIntegral msgLen)
-                                                                                                            _setC' entity p bData
-                                                                                                            return 0)
-                                                                    fwritePtr <- mkMsgFunPtr fwrite
-                                                                    registerMessageReceiver c p rep fwritePtr
-                                                                    -- we would also need to delete the funptr later with "freeHaskellFunPtr" currently not implemented
-                                                                    return ()
-                                                            else return ()
-                                                    ) (M.keys e)
-
-                                            return $ (ir : prs')
-                                    else return []
-
-                        else return []
-              ) (M.keys e) 
-
-  return $ concat rs
-
-
-shutdownSystem :: SystemData -> IO ()
-shutdownSystem system = print "Shutdown System received" >> return ()
-
-
--- management of systems
---
-
--- | add an Entity to the world, thread safe        
-addToWorld :: [SystemData] -> Entity -> IO ()
-addToWorld systems e = mapM (\s -> addEntity s e) systems >> return () 
-
--- | remove an Entity from the world, thread safe        
-removeFromWorld :: [SystemData] -> Entity -> IO ()
-removeFromWorld systems e = mapM (\s -> removeEntity s e) systems >> return ()
-    
-
-
-
-                          
HGamer3D/GUI.hs view
@@ -1,34 +1,34 @@-{-
-    Graphical User Interface - GUI
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/GUI.hs
--}
-
--- | GUI for HGamer3D 
-module HGamer3D.GUI
-
-(
-    module HGamer3D.GUI.Button
-    , module HGamer3D.GUI.EditText
-    , module HGamer3D.GUI.Text
-    , module HGamer3D.GUI.Slider
-    , module HGamer3D.GUI.DropDownList
-    , module HGamer3D.GUI.CheckBox
-)
-
-where
-
-import HGamer3D.GUI.Button
-import HGamer3D.GUI.EditText
-import HGamer3D.GUI.Text
-import HGamer3D.GUI.Slider
-import HGamer3D.GUI.DropDownList
-import HGamer3D.GUI.CheckBox
-
-
+{-+    Graphical User Interface - GUI+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/GUI.hs+-}++-- | GUI for HGamer3D +module HGamer3D.GUI++(+    module HGamer3D.GUI.Button+    , module HGamer3D.GUI.EditText+    , module HGamer3D.GUI.Text+    , module HGamer3D.GUI.Slider+    , module HGamer3D.GUI.DropDownList+    , module HGamer3D.GUI.CheckBox+)++where++import HGamer3D.GUI.Button+import HGamer3D.GUI.EditText+import HGamer3D.GUI.Text+import HGamer3D.GUI.Slider+import HGamer3D.GUI.DropDownList+import HGamer3D.GUI.CheckBox++
HGamer3D/GUI/Button.hs view
@@ -1,30 +1,30 @@-{-
-	GUI: Button functionality
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/GUI/Button.hs
--}
-
--- | Module providing the Mouse functionality and settings
-module HGamer3D.GUI.Button
-(
-    ctButton
-)
-
-where
-
-import Data.MessagePack
-import Debug.Trace
-import Data.Text
-
-import HGamer3D.Data
-
-ctButton :: ComponentType Bool
-ctButton = ComponentType 0x68a1857c27690b30  
-  
-
+{-+	GUI: Button functionality+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/GUI/Button.hs+-}++-- | Module providing the Mouse functionality and settings+module HGamer3D.GUI.Button+(+    ctButton+)++where++import Fresco+import Debug.Trace+import Data.Text++import HGamer3D.Data++ctButton :: ComponentType Bool+ctButton = ComponentType 0x68a1857c27690b30  +  +
HGamer3D/GUI/CheckBox.hs view
@@ -1,30 +1,30 @@-{-
-	GUI: Checkbox functionality
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/GUI/CheckBox.hs
--}
-
--- | Module providing the CheckBox gui element
-module HGamer3D.GUI.CheckBox
-(
-    ctCheckBox
-)
-
-where
-
-import Data.MessagePack
-import Debug.Trace
-import Data.Text
-
-import HGamer3D.Data
-
-ctCheckBox :: ComponentType Bool
-ctCheckBox = ComponentType 0xd2425f880fcdd9a4  
-  
-
+{-+	GUI: Checkbox functionality+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/GUI/CheckBox.hs+-}++-- | Module providing the CheckBox gui element+module HGamer3D.GUI.CheckBox+(+    ctCheckBox+)++where++import Fresco+import Debug.Trace+import Data.Text++import HGamer3D.Data++ctCheckBox :: ComponentType Bool+ctCheckBox = ComponentType 0xd2425f880fcdd9a4  +  +
HGamer3D/GUI/DropDownList.hs view
@@ -1,37 +1,38 @@-{-
-	GUI: DropDownList functionality
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/GUI/DropDownList.hs
--}
-
--- | Module providing the Mouse functionality and settings
-module HGamer3D.GUI.DropDownList
-(
-    ctDropDownList,
-    DropDownList (..)
-)
-
-where
-
-import Data.MessagePack
-import Debug.Trace
-import Data.Text
-
-import HGamer3D.Data
-
-data DropDownList = DropDownList [Text] (Maybe Int) deriving (Eq, Show)   -- int is selected item index, starting at 0
-
-instance ComponentClass DropDownList where
-    toObj (DropDownList textlist mb) = ObjectArray [ ObjectArray (Prelude.map toObj textlist), toObj mb]
-    fromObj (ObjectArray [ ObjectArray textlist_o, mb]) = DropDownList (Prelude.map fromObj textlist_o) (fromObj mb)
-
-ctDropDownList :: ComponentType DropDownList
-ctDropDownList = ComponentType 0x200de0e837a8e590
-  
-
+{-+	GUI: DropDownList functionality+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/GUI/DropDownList.hs+-}++-- | Module providing the Mouse functionality and settings+module HGamer3D.GUI.DropDownList+(+    ctDropDownList,+    DropDownList (..)+)++where++import Fresco+import Data.MessagePack+import Debug.Trace+import Data.Text++import HGamer3D.Data++data DropDownList = DropDownList [Text] (Maybe Int) deriving (Eq, Show)   -- int is selected item index, starting at 0++instance ComponentClass DropDownList where+    toObj (DropDownList textlist mb) = ObjectArray [ ObjectArray (Prelude.map toObj textlist), toObj mb]+    fromObj (ObjectArray [ ObjectArray textlist_o, mb]) = DropDownList (Prelude.map fromObj textlist_o) (fromObj mb)++ctDropDownList :: ComponentType DropDownList+ctDropDownList = ComponentType 0x200de0e837a8e590+  +
HGamer3D/GUI/EditText.hs view
@@ -1,28 +1,29 @@-{-
-	GUI: EditText functionality
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/GUI/EditText.hs
--}
-
--- | Module providing the Mouse functionality and settings
-module HGamer3D.GUI.EditText
-(
-    ctEditText
-)
-
-where
-
-import Data.MessagePack
-import Debug.Trace
-import Data.Text
-
-import HGamer3D.Data
-
-ctEditText :: ComponentType Text
-ctEditText = ComponentType 0x8c79de2199331f3a
+{-+	GUI: EditText functionality+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/GUI/EditText.hs+-}++-- | Module providing the Mouse functionality and settings+module HGamer3D.GUI.EditText+(+    ctEditText+)++where++import Fresco+import Data.MessagePack+import Debug.Trace+import Data.Text++import HGamer3D.Data++ctEditText :: ComponentType Text+ctEditText = ComponentType 0x8c79de2199331f3a
HGamer3D/GUI/Slider.hs view
@@ -1,38 +1,39 @@-{-
-	GUI: Slider functionality
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/GUI/Slider.hs
--}
-
--- | Module providing the Mouse functionality and settings
-module HGamer3D.GUI.Slider
-(
-    ctSlider,
-    Slider (..)
-)
-
-where
-
-import Data.MessagePack
-import Debug.Trace
-import Data.Text
-
-import HGamer3D.Data
-
-data Slider = Slider Float Float        -- range end (start = 0) and value
-              deriving (Eq, Show)           
-
-instance ComponentClass Slider where
-    toObj (Slider range value) = ObjectArray [ObjectFloat range, ObjectFloat value]
-    fromObj (ObjectArray [ObjectFloat range, ObjectFloat value]) = Slider range value
-
-ctSlider :: ComponentType Slider
-ctSlider = ComponentType 0x60636b107c77a533
-  
-
+{-+	GUI: Slider functionality+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/GUI/Slider.hs+-}++-- | Module providing the Mouse functionality and settings+module HGamer3D.GUI.Slider+(+    ctSlider,+    Slider (..)+)++where++import Fresco+import Data.MessagePack+import Debug.Trace+import Data.Text++import HGamer3D.Data++data Slider = Slider Float Float        -- range end (start = 0) and value+              deriving (Eq, Show)           ++instance ComponentClass Slider where+    toObj (Slider range value) = ObjectArray [ObjectFloat range, ObjectFloat value]+    fromObj (ObjectArray [ObjectFloat range, ObjectFloat value]) = Slider range value++ctSlider :: ComponentType Slider+ctSlider = ComponentType 0x60636b107c77a533+  +
HGamer3D/GUI/Text.hs view
@@ -1,30 +1,31 @@-{-
-	GUI: Text functionality
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/GUI/Text.hs
--}
-
--- | Module providing the Mouse functionality and settings
-module HGamer3D.GUI.Text
-(
-    ctText
-)
-
-where
-
-import Data.MessagePack
-import Debug.Trace
-import Data.Text
-
-import HGamer3D.Data
-
-ctText :: ComponentType Text
-ctText = ComponentType 0xda9601eaf3319280
-  
-
+{-+	GUI: Text functionality+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/GUI/Text.hs+-}++-- | Module providing the Mouse functionality and settings+module HGamer3D.GUI.Text+(+    ctText+)++where++import Fresco+import Data.MessagePack+import Debug.Trace+import Data.Text++import HGamer3D.Data++ctText :: ComponentType Text+ctText = ComponentType 0xda9601eaf3319280+  +
HGamer3D/Graphics3D.hs view
@@ -1,47 +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.hgamer3d.org
--- 
--- (c) 2015 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.
--- 
--- HGamer3D/Graphics3D.hs
--- 
-
--- | 3D Graphics for HGamer3D 
-module HGamer3D.Graphics3D
-
-(
-	module HGamer3D.Graphics3D.Camera,
-	module HGamer3D.Graphics3D.Geometry,
-	module HGamer3D.Graphics3D.Light,
-	module HGamer3D.Graphics3D.Material,
-	module HGamer3D.Graphics3D.Window,
-	module HGamer3D.Graphics3D.Graphics3DCommand,
-	module HGamer3D.Graphics3D.Graphics3DConfig,
-	module HGamer3D.Graphics3D.SystemGraphics3D
-)
-
-where
-
-import HGamer3D.Graphics3D.Camera
-import HGamer3D.Graphics3D.Geometry
-import HGamer3D.Graphics3D.Light
-import HGamer3D.Graphics3D.Material
-import HGamer3D.Graphics3D.Window
-import HGamer3D.Graphics3D.Graphics3DCommand
-import HGamer3D.Graphics3D.Graphics3DConfig
-import HGamer3D.Graphics3D.SystemGraphics3D
-
-
+-- 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) 2015 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.+-- +-- HGamer3D/Graphics3D.hs+-- ++-- | 3D Graphics for HGamer3D +module HGamer3D.Graphics3D++(+	module HGamer3D.Graphics3D.Camera,+	module HGamer3D.Graphics3D.Geometry,+	module HGamer3D.Graphics3D.Light,+	module HGamer3D.Graphics3D.Material,+	module HGamer3D.Graphics3D.Window,+	module HGamer3D.Graphics3D.Graphics3DCommand,+	module HGamer3D.Graphics3D.Graphics3DConfig,+)++where++import HGamer3D.Graphics3D.Camera+import HGamer3D.Graphics3D.Geometry+import HGamer3D.Graphics3D.Light+import HGamer3D.Graphics3D.Material+import HGamer3D.Graphics3D.Window+import HGamer3D.Graphics3D.Graphics3DCommand+import HGamer3D.Graphics3D.Graphics3DConfig++
HGamer3D/Graphics3D/Camera.hs view
@@ -1,59 +1,62 @@-{-
-    Camera Datatype
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2011-2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Graphics3D/Camera.hs
--}
-
--- | Module providing the Camera type
-module HGamer3D.Graphics3D.Camera
-
-(
-        Camera (..),
-        ctCamera,
-
-        Frustum (..),
-        ctFrustum
-)
-
-where
-
-import Data.MessagePack
-import HGamer3D.Data
-import HGamer3D.ECS
-
--- | The Camera Data Type
-data Camera = FullViewCamera                            -- ^ a camera using the full view
-              | OverlayCamera (Rectangle Float)         -- ^ a camera using only parts of the view (overlay)
-              deriving (Eq, Show)
-
-ctCamera :: ComponentType Camera
-ctCamera = ComponentType 0xd3b0d455ab1f4716 
-
-instance ComponentClass Camera where
-        toObj FullViewCamera = ObjectArray [ObjectInt 0]
-        toObj (OverlayCamera rec) = ObjectArray [ObjectInt 1, toObj rec]
-        fromObj (ObjectArray [ObjectInt 0]) = FullViewCamera
-        fromObj (ObjectArray [ObjectInt 1, rec_ob]) = OverlayCamera (fromObj rec_ob)
-
-data Frustum = Frustum {
-        frNearDistance :: Float,
-        frFarDistance :: Float,
-        frFieldOfViewHorizontal :: Angle
-} deriving (Eq, Show)
-
-instance ComponentClass Frustum where
-        toObj (Frustum nd fd fovh) = ObjectArray [ObjectFloat nd, ObjectFloat fd, toObj fovh]
-        fromObj (ObjectArray [ObjectFloat nd, ObjectFloat fd, fovh_o]) = Frustum nd fd (fromObj fovh_o)
-
-ctFrustum :: ComponentType Frustum
-ctFrustum = ComponentType 0xf3ce3235d4f8e73d
-
-
-
-
+{-+    Camera Datatype+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2011-2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Graphics3D/Camera.hs+-}++-- | Module providing the Camera type+module HGamer3D.Graphics3D.Camera++(+        Camera (..),+        ctCamera,++        Frustum (..),+        ctFrustum+)++where++import Data.MessagePack+import HGamer3D.Data+import Fresco++-- generated++data Camera = FullViewCamera+    | OverlayCamera (Rectangle Int) Float+    deriving (Eq, Show)++instance ComponentClass Camera where+    toObj (FullViewCamera) = ObjectArray [ObjectInt 0, ObjectArray []]+    toObj (OverlayCamera v1 v2) = ObjectArray [ObjectInt 1, ObjectArray [(toObj v1), ObjectFloat v2]]+    fromObj (ObjectArray [ObjectInt 0, ObjectArray []]) = FullViewCamera+    fromObj (ObjectArray [ObjectInt 1, ObjectArray [v1, ObjectFloat v2]]) = OverlayCamera (fromObj v1) v2++ctCamera :: ComponentType Camera+ctCamera = ComponentType 0xd3b0d455ab1f4716++-- generated++data Frustum = Frustum {+        frNearDistance :: Float,+        frFarDistance :: Float,+        frFieldOfViewHorizontal :: Angle+} deriving (Eq, Show)++instance ComponentClass Frustum where+        toObj (Frustum nd fd fovh) = ObjectArray [ObjectFloat nd, ObjectFloat fd, toObj fovh]+        fromObj (ObjectArray [ObjectFloat nd, ObjectFloat fd, fovh_o]) = Frustum nd fd (fromObj fovh_o)++ctFrustum :: ComponentType Frustum+ctFrustum = ComponentType 0xf3ce3235d4f8e73d++++
HGamer3D/Graphics3D/Geometry.hs view
@@ -1,80 +1,82 @@--- 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 - 2015 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.
-
--- HGamer3D/Graphics3D/Geometry.hs
-
--- | Module providing the Geometry type
-module HGamer3D.Graphics3D.Geometry
-
-(
-        Shape (..),
-        Geometry (..),
-        ctGeometry
-)
-
-where
-
-import Data.MessagePack
-import Data.Text
-
-import HGamer3D.Data
-import HGamer3D.Graphics3D.Material
-
--- CH4-4s
--- | A shape is a basic geometric form
-data Shape =   Sphere 
-                | Cube
-                | Plane
-                | Cylinder
-                | Pyramid
-                | Torus
-                deriving (Eq, Show)
-
--- | A geometry is the basic drawable item, it can be a shape or a mesh loaded from a resource
-data Geometry = ShapeGeometry Shape
-                | ResourceGeometry Text
-                deriving (Eq, Show)
-
--- | Component Type for the Geometry
-ctGeometry :: ComponentType Geometry
-ctGeometry = ComponentType 0xee433d1a4b964591 
--- CH4-4e
-
-instance ComponentClass Shape where
-    toObj shape = case shape of
-                    Sphere -> (ObjectInt 1)
-                    Cube -> (ObjectInt 2)
-                    Plane -> (ObjectInt 3)
-                    Cylinder -> (ObjectInt 4)
-                    Pyramid -> (ObjectInt 5)
-                    Torus -> (ObjectInt 6)
-    fromObj (ObjectInt i) = case i of
-                    1 -> Sphere
-                    2 -> Cube
-                    3 -> Plane
-                    4 -> Cylinder
-                    5 -> Pyramid
-                    6 -> Torus
-                    
-instance ComponentClass Geometry where
-        toObj (ShapeGeometry sh) = ObjectArray [ObjectInt 1, toObj sh]
-        toObj (ResourceGeometry mesh) = ObjectArray [ObjectInt 2, toObj mesh]
-        fromObj (ObjectArray [ObjectInt 1, sh_ob])  = ShapeGeometry (fromObj sh_ob) 
-        fromObj (ObjectArray [ObjectInt 2, mesh_o])  = ResourceGeometry (fromObj mesh_o)
-
-
+-- 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 - 2015 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.++-- HGamer3D/Graphics3D/Geometry.hs++-- | Module providing the Geometry type+module HGamer3D.Graphics3D.Geometry++(+        Shape (..),+        Geometry (..),+        ctGeometry+)++where++import Data.MessagePack++import Fresco+import Data.Text++import HGamer3D.Data+import HGamer3D.Graphics3D.Material++-- generated++-- CH4-4s+-- | A shape is a basic geometric formd++data Shape = Sphere+    | Cube+    | Plane+    | Cylinder+    | Pyramid+    | Torus+    deriving (Eq, Read, Show)++instance ComponentClass Shape where+    toObj (Sphere) = ObjectArray [ObjectInt 0, ObjectArray []]+    toObj (Cube) = ObjectArray [ObjectInt 1, ObjectArray []]+    toObj (Plane) = ObjectArray [ObjectInt 2, ObjectArray []]+    toObj (Cylinder) = ObjectArray [ObjectInt 3, ObjectArray []]+    toObj (Pyramid) = ObjectArray [ObjectInt 4, ObjectArray []]+    toObj (Torus) = ObjectArray [ObjectInt 5, ObjectArray []]+    fromObj (ObjectArray [ObjectInt 0, ObjectArray []]) = Sphere+    fromObj (ObjectArray [ObjectInt 1, ObjectArray []]) = Cube+    fromObj (ObjectArray [ObjectInt 2, ObjectArray []]) = Plane+    fromObj (ObjectArray [ObjectInt 3, ObjectArray []]) = Cylinder+    fromObj (ObjectArray [ObjectInt 4, ObjectArray []]) = Pyramid+    fromObj (ObjectArray [ObjectInt 5, ObjectArray []]) = Torus++data Geometry = ShapeGeometry Shape+    | ResourceGeometry Text+    deriving (Eq, Read, Show)++instance ComponentClass Geometry where+    toObj (ShapeGeometry v1) = ObjectArray [ObjectInt 0, ObjectArray [(toObj v1)]]+    toObj (ResourceGeometry v1) = ObjectArray [ObjectInt 1, ObjectArray [(toObj v1)]]+    fromObj (ObjectArray [ObjectInt 0, ObjectArray [v1]]) = ShapeGeometry (fromObj v1)+    fromObj (ObjectArray [ObjectInt 1, ObjectArray [v1]]) = ResourceGeometry (fromObj v1)++ctGeometry :: ComponentType Geometry+ctGeometry = ComponentType 0xee433d1a4b964591++-- CH4-4e++-- generated
HGamer3D/Graphics3D/Graphics3DCommand.hs view
@@ -1,51 +1,54 @@--- 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 - 2015 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.
-
--- HGamer3D/Graphics3D/Graphics3DCommand.hs
-
--- | Module providing the CmdGraphics3D type
-module HGamer3D.Graphics3D.Graphics3DCommand
-
-(
-        Graphics3DCommand (..),
-        ctGraphics3DCommand
-)
-
-where
-
-import Data.MessagePack
-import HGamer3D.Data
-
--- | Commands, which can be sent to graphics system
-data Graphics3DCommand = NoCmd 
-					| Step 
-					deriving (Eq, Show)
-
--- | Component Type of Graphics3DCommand
-ctGraphics3DCommand :: ComponentType Graphics3DCommand
-ctGraphics3DCommand = ComponentType 0xea06bc20a9334af3
-
-instance ComponentClass Graphics3DCommand where
-	toObj c = case c of
-		NoCmd -> ObjectArray [ObjectInt 0]
-		Step -> ObjectArray [ObjectInt 1]
-
-	fromObj c = case c of
-		(ObjectArray [ObjectInt 0]) -> NoCmd
-		(ObjectArray [ObjectInt 1]) -> Step
-
+-- 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 - 2015 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.++-- HGamer3D/Graphics3D/Graphics3DCommand.hs++-- | Module providing the CmdGraphics3D type+module HGamer3D.Graphics3D.Graphics3DCommand++(+        Graphics3DCommand (..),+        ctGraphics3DCommand+)++where++import Data.MessagePack+import Fresco+import HGamer3D.Data++-- | Component Type of Graphics3DCommand+ctGraphics3DCommand :: ComponentType Graphics3DCommand+ctGraphics3DCommand = ComponentType 0xea06bc20a9334af3++-- OUTPUT SINOPIA START HERE++-- | Commands, which can be sent to graphics system+data Graphics3DCommand = NoCmd+    | Step+    deriving (Eq, Read, Show)++instance ComponentClass Graphics3DCommand where+    toObj (NoCmd) = ObjectArray [ObjectInt 0, ObjectArray []]+    toObj (Step) = ObjectArray [ObjectInt 1, ObjectArray []]+    fromObj (ObjectArray [ObjectInt 0, ObjectArray []]) = NoCmd+    fromObj (ObjectArray [ObjectInt 1, ObjectArray []]) = Step++-- OUTPUT SINOPIA ENDS HERE++
HGamer3D/Graphics3D/Graphics3DConfig.hs view
@@ -1,129 +1,124 @@--- 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 - 2015 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.
-
--- HGamer3D/Graphics3D/Graphics3DConfig.hs
-
--- | Module providing the InitGraphics3D type
-module HGamer3D.Graphics3D.Graphics3DConfig
-
-(
-	    EngineConfig (..),
-
-        LogLevel (..),
-        Logging (..),
-        ctLogging,
-
-        GraphicsQuality(..),
-        ctGraphicsQuality,
-
-        Graphics3DConfig (..),
-        ctGraphics3DConfig,
-
-        standardGraphics3DConfig
-)
-
-where
-
-import Data.MessagePack
-import Data.Text
-
-import HGamer3D.Data
-import HGamer3D.ECS
-import HGamer3D.Graphics3D.Window
-
--- ENGINE CONFIG
-
--- | Base Configuration or Graphics Engine
-data EngineConfig = EngineConfig {
-	ig3dHeadless :: Bool, -- ^ run without graphics output
-	ig3dFlushGPU :: Bool, 
-	ig3dThreads :: Bool, -- ^ multi threading enabled
-	ig3dForceGL2 :: Bool -- ^ only GL2 mode, no GL3
-}
-
-instance ComponentClass EngineConfig where
-    toObj (EngineConfig hl fg th fgl2) = ObjectArray [ObjectBool hl, ObjectBool fg, ObjectBool th, ObjectBool fgl2]
-    fromObj (ObjectArray [ObjectBool hl, ObjectBool fg, ObjectBool th, ObjectBool fgl2]) = EngineConfig hl fg th fgl2
-
-stdEngineConfig = EngineConfig False False True False
-
--- LOGGING CONFIG
-
-data LogLevel = WarningLogLevel | InfoLogLevel | DebugLogLevel
-
-data Logging = Logging {
-    logLevel :: LogLevel,
-    quietLogging :: Bool,  -- ^ Logging only to file, not to std output
-    logFileName :: Text   
-}
-
-instance ComponentClass LogLevel where
-    toObj WarningLogLevel = ObjectInt 0
-    toObj InfoLogLevel = ObjectInt 1
-    toObj DebugLogLevel = ObjectInt 2
-    fromObj (ObjectInt 0) = WarningLogLevel
-    fromObj (ObjectInt 1) = InfoLogLevel
-    fromObj (ObjectInt 2) = DebugLogLevel
-
-instance ComponentClass Logging where
-    toObj (Logging l q fn) = ObjectArray [toObj l, ObjectBool q, toObj fn]
-    fromObj (ObjectArray [l, (ObjectBool q), fn_o]) = Logging (fromObj l) q (fromObj fn_o)
-
-ctLogging :: ComponentType Logging
-ctLogging = ComponentType 0x86bc15156976f061
-
--- GRAPHICS QUALITY
-
--- | Graphics Quality Setting
-data GraphicsQuality = GraphicsQuality {
-    gqShadow :: LMH,    -- ^ Shadow Quality
-    gqMaterial :: LMH,  -- ^ Material Quality
-    gqTexture :: LMH,   -- ^ Texture Quality
-    gqMultisample :: LMH -- ^ Multisampling Quality
-}
-
-instance ComponentClass GraphicsQuality where
-    toObj (GraphicsQuality sq mq tq ms) = ObjectArray [toObj sq, toObj mq, toObj tq, toObj ms]
-    fromObj (ObjectArray [sq, mq, tq, ms]) = GraphicsQuality (fromObj sq) (fromObj mq) (fromObj tq) (fromObj ms)
-
-ctGraphicsQuality :: ComponentType GraphicsQuality
-ctGraphicsQuality = ComponentType 0x7d9cff864f27c6d2
-
--- GRAPHICS CONFIG
-
--- | Initial Configuration of Graphics Engine
-data Graphics3DConfig = Graphics3DConfig EngineConfig WindowG3D (Maybe Logging) (Maybe GraphicsQuality)
-
-mbToObj mbA = case mbA of 
-	Just a -> toObj a
-	Nothing -> ObjectNil
-
-objToMb o = case o of
-	ObjectNil -> Nothing
-	_ -> Just (fromObj o)
-
-instance ComponentClass Graphics3DConfig where
-    toObj (Graphics3DConfig ec wc mbL mbGQ) = ObjectArray [toObj ec, toObj wc, mbToObj mbL, mbToObj mbGQ]
-    fromObj (ObjectArray [ec_o, wc_o, l_o, gq_o]) = Graphics3DConfig (fromObj ec_o) (fromObj wc_o) (objToMb l_o) (objToMb gq_o)
-
-standardGraphics3DConfig = Graphics3DConfig stdEngineConfig (xyWindow 800 600) Nothing Nothing 
-
-ctGraphics3DConfig :: ComponentType Graphics3DConfig
-ctGraphics3DConfig = ComponentType 0x0884eb62b6674bff
-
-
+{-# LANGUAGE OverloadedStrings #-}+-- 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 - 2015 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.++-- HGamer3D/Graphics3D/Graphics3DConfig.hs++-- | Module providing the InitGraphics3D type+module HGamer3D.Graphics3D.Graphics3DConfig++(+	    EngineConfig (..),++        LogLevel (..),+        Logging (..),+        ctLogging,++        GraphicsQuality(..),+        ctGraphicsQuality,++        Graphics3DConfig (..),+        ctGraphics3DConfig,++        standardGraphics3DConfig+)++where++import Fresco+import Data.MessagePack+import Data.Text++import HGamer3D.Data+import HGamer3D.Graphics3D.Window+++-- OUTPUT SINOPIA START HERE++data EngineConfig = EngineConfig {+    engineConfigHeadless::Bool,+    engineConfigFlushGPU::Bool,+    engineConfigThreads::Bool,+    engineConfigForceGL2::Bool+}++instance ComponentClass EngineConfig where+    toObj (EngineConfig v1 v2 v3 v4) = ObjectArray [ObjectBool v1, ObjectBool v2, ObjectBool v3, ObjectBool v4]+    fromObj (ObjectArray [ObjectBool v1, ObjectBool v2, ObjectBool v3, ObjectBool v4]) = EngineConfig v1 v2 v3 v4++data LogLevel = Warning+    | Info+    | Debug+    deriving (Eq, Read, Show)++instance ComponentClass LogLevel where+    toObj (Warning) = ObjectArray [ObjectInt 0, ObjectArray []]+    toObj (Info) = ObjectArray [ObjectInt 1, ObjectArray []]+    toObj (Debug) = ObjectArray [ObjectInt 2, ObjectArray []]+    fromObj (ObjectArray [ObjectInt 0, ObjectArray []]) = Warning+    fromObj (ObjectArray [ObjectInt 1, ObjectArray []]) = Info+    fromObj (ObjectArray [ObjectInt 2, ObjectArray []]) = Debug++data Logging = Logging {+    loggingLogLevel::LogLevel,+    loggingQuietLogging::Bool,+    loggingLogFileName::Text+}++instance ComponentClass Logging where+    toObj (Logging v1 v2 v3) = ObjectArray [(toObj v1), ObjectBool v2, (toObj v3)]+    fromObj (ObjectArray [v1, ObjectBool v2, v3]) = Logging (fromObj v1) v2 (fromObj v3)++data GraphicsQuality = GraphicsQuality {+    graphicsQualityShadow::QualityLMH,+    graphicsQualityMaterial::QualityLMH,+    graphicsQualityTexture::QualityLMH,+    graphicsQualityMultisample::QualityLMH+}++instance ComponentClass GraphicsQuality where+    toObj (GraphicsQuality v1 v2 v3 v4) = ObjectArray [(toObj v1), (toObj v2), (toObj v3), (toObj v4)]+    fromObj (ObjectArray [v1, v2, v3, v4]) = GraphicsQuality (fromObj v1) (fromObj v2) (fromObj v3) (fromObj v4)++data Graphics3DConfig = Graphics3DConfig {+    graphics3DConfigEngine::EngineConfig,+    graphics3DConfigQuality::GraphicsQuality,+    graphics3DConfigLogging::Logging,+    graphics3DConfigWindow::WindowG3D+}++instance ComponentClass Graphics3DConfig where+    toObj (Graphics3DConfig v1 v2 v3 v4) = ObjectArray [(toObj v1), (toObj v2), (toObj v3), (toObj v4)]+    fromObj (ObjectArray [v1, v2, v3, v4]) = Graphics3DConfig (fromObj v1) (fromObj v2) (fromObj v3) (fromObj v4)++-- OUTPUT SINOPIA ENDS HERE++stdEngineConfig = EngineConfig False False True False++ctLogging :: ComponentType Logging+ctLogging = ComponentType 0x86bc15156976f061++ctGraphicsQuality :: ComponentType GraphicsQuality+ctGraphicsQuality = ComponentType 0x7d9cff864f27c6d2++standardGraphics3DConfig = Graphics3DConfig stdEngineConfig (GraphicsQuality Medium Medium Medium Medium) (Logging Debug False "hgamer3d.log") (xyWindow 800 600) ++ctGraphics3DConfig :: ComponentType Graphics3DConfig+ctGraphics3DConfig = ComponentType 0x0884eb62b6674bff++
HGamer3D/Graphics3D/Light.hs view
@@ -1,53 +1,54 @@-{-
-    Light Datatype
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2011-2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Graphics3D/Light.hs
--}
-
--- | Module providing the Light type
-module HGamer3D.Graphics3D.Light
-
-(
-    LightType (..),
-    Light (..),
-    ctLight
-)
-
-where
-
-import Data.MessagePack
-import HGamer3D.Data
-
-data LightType =    PointLight              -- ^ casting light in all directions, from position 
-                    | DirectionalLight      -- ^ like a very far light source (the Sun)
-                    | SpotLight Angle Float -- ^ a light with a field of view (Angle) and an aspect-ratio (Float)
-                
-instance ComponentClass LightType where
-    toObj PointLight = ObjectArray [ObjectInt 0]
-    toObj DirectionalLight =  ObjectArray [ObjectInt 1]
-    toObj (SpotLight fov ar) = ObjectArray [ObjectInt 2, toObj fov, ObjectFloat ar]
-
-    fromObj (ObjectArray [ObjectInt 0]) = PointLight
-    fromObj (ObjectArray [ObjectInt 1]) = DirectionalLight 
-    fromObj (ObjectArray [ObjectInt 2, fov_o, ObjectFloat ar]) = SpotLight (fromObj fov_o) ar
-
-    
-data Light = Light 
-                LightType -- ^ Type of light
-                Float     -- ^ brighness
-                Float     -- ^ range
-                Float     -- ^ specular intensity
-
-instance ComponentClass Light where
-    toObj (Light lt b r s) = ObjectArray [toObj lt, ObjectFloat b, ObjectFloat r, ObjectFloat s]
-    fromObj (ObjectArray [lt_o, ObjectFloat b, ObjectFloat r, ObjectFloat s]) = Light (fromObj lt_o) b r s
-    
-ctLight :: ComponentType Light
-ctLight = ComponentType 0x981e80e50d994ea9
-
+{-+    Light Datatype+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2011-2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Graphics3D/Light.hs+-}++-- | Module providing the Light type+module HGamer3D.Graphics3D.Light++(+    LightType (..),+    Light (..),+    ctLight+)++where++import Data.MessagePack+import Fresco+import HGamer3D.Data++data LightType =    PointLight              -- ^ casting light in all directions, from position +                    | DirectionalLight      -- ^ like a very far light source (the Sun)+                    | SpotLight Angle Float -- ^ a light with a field of view (Angle) and an aspect-ratio (Float)+                +instance ComponentClass LightType where+    toObj PointLight = ObjectArray [ObjectInt 0]+    toObj DirectionalLight =  ObjectArray [ObjectInt 1]+    toObj (SpotLight fov ar) = ObjectArray [ObjectInt 2, toObj fov, ObjectFloat ar]++    fromObj (ObjectArray [ObjectInt 0]) = PointLight+    fromObj (ObjectArray [ObjectInt 1]) = DirectionalLight +    fromObj (ObjectArray [ObjectInt 2, fov_o, ObjectFloat ar]) = SpotLight (fromObj fov_o) ar++    +data Light = Light +                LightType -- ^ Type of light+                Float     -- ^ brighness+                Float     -- ^ range+                Float     -- ^ specular intensity++instance ComponentClass Light where+    toObj (Light lt b r s) = ObjectArray [toObj lt, ObjectFloat b, ObjectFloat r, ObjectFloat s]+    fromObj (ObjectArray [lt_o, ObjectFloat b, ObjectFloat r, ObjectFloat s]) = Light (fromObj lt_o) b r s+    +ctLight :: ComponentType Light+ctLight = ComponentType 0x981e80e50d994ea9+
HGamer3D/Graphics3D/Material.hs view
@@ -1,138 +1,144 @@--- 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 - 2015 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.
-
--- HGamer3D/Graphics3D/Camera.hs
-
-{-# LANGUAGE OverloadedStrings #-}
-
--- | Module providing the Material type
-module HGamer3D.Graphics3D.Material
-
-(
-		-- * The Material Type and ComponentType
-        Material (..),
-        ctMaterial,
-
-        -- * Some materials to play with
-		matOrangeCrossMetal,
-		matCrossMetal,
-		matCrossMetalBlue,
-		matMetal,
-		matMetalZigZag,
-		matMetalBumps,
-		matFishEye,
-		matMetalOrnament,
-		matMetalScratch,
-		matMetalLine,
-		matGreenGrass,
-		matBrownGrass,
-		matGreyGrass,
-		matSand,
-		matRedRock,
-		matBlackRock,
-		matBrownStone,
-		matStoneMetalWall,
-		matCoalWall,
-		matBrickWallGray,
-		matBrickWallRed,
-		matTilesOrange,
-		matWoodTiles,
-		matColourTiles,
-		matBlackTiles,
-
-		matWhite,
-		matSilver,
-		matGrey,
-		matDarkGrey,
-		matBlack,
-		matRed,
-		matMaroon,
-		matYellow,
-		matOlive,
-		matLime,
-		matGreen,
-		matAqua,
-		matTeal,
-		matBlue,
-		matNavy,
-		matFuchsia,
-		matPurple 
-)
-
-where
-
-import Data.MessagePack
-import Data.Text
-
-import HGamer3D.Data
-
-data Material = ResourceMaterial Text deriving (Eq, Show)
-
-ctMaterial :: ComponentType Material
-ctMaterial = ComponentType 0xb4bae8b0d0d8c162
-
-instance ComponentClass Material where
-        toObj (ResourceMaterial resource) = ObjectArray [ObjectInt 1, toObj resource]
-        fromObj ( (ObjectArray [ObjectInt 1, resource_o])) = ResourceMaterial (fromObj resource_o)
-
--- some materials from the material folder
-matOrangeCrossMetal = ResourceMaterial "Materials/Pattern_01.xml"
-matCrossMetal = ResourceMaterial "Materials/Pattern_03.xml"
-matCrossMetalBlue = ResourceMaterial "Materials/Pattern_04.xml"
-matMetal = ResourceMaterial "Materials/Pattern_12.xml"
-matMetalZigZag = ResourceMaterial "Materials/Pattern_13.xml"
-matMetalBumps = ResourceMaterial "Materials/Pattern_14.xml"
-matFishEye = ResourceMaterial "Materials/Pattern_15.xml"
-matMetalOrnament = ResourceMaterial "Materials/Pattern_29.xml"
-matMetalScratch = ResourceMaterial "Materials/Pattern_30.xml"
-matMetalLine = ResourceMaterial "Materials/Pattern_31.xml"
-matGreenGrass = ResourceMaterial "Materials/Pattern_42.xml"
-matBrownGrass = ResourceMaterial "Materials/Pattern_43.xml"
-matGreyGrass = ResourceMaterial "Materials/Pattern_44.xml"
-matSand = ResourceMaterial "Materials/Pattern_45.xml"
-matRedRock = ResourceMaterial "Materials/Pattern_46.xml"
-matBlackRock = ResourceMaterial "Materials/Pattern_124.xml"
-matBrownStone = ResourceMaterial "Materials/Pattern_125.xml"
-matStoneMetalWall = ResourceMaterial "Materials/Pattern_126.xml"
-matCoalWall = ResourceMaterial "Materials/Pattern_127.xml"
-matBrickWallGray = ResourceMaterial "Materials/Pattern_100.xml"
-matBrickWallRed = ResourceMaterial "Materials/Pattern_102.xml"
-matTilesOrange = ResourceMaterial "Materials/Pattern_270.xml"
-matWoodTiles = ResourceMaterial "Materials/Pattern_271.xml"
-matColourTiles = ResourceMaterial "Materials/Pattern_272.xml"
-matBlackTiles = ResourceMaterial "Materials/Pattern_273.xml"
-
-matWhite = ResourceMaterial "Materials/ColourWhite.xml"
-matSilver  = ResourceMaterial "Materials/ColourSilver.xml"
-matGrey = ResourceMaterial "Materials/ColourGrey.xml" 
-matDarkGrey = ResourceMaterial "Materials/ColourDarkGrey.xml"
-matBlack = ResourceMaterial "Materials/ColourBlack.xml" 
-matRed = ResourceMaterial "Materials/ColourRed.xml"
-matMaroon = ResourceMaterial "Materials/ColourMaroon.xml"
-matYellow = ResourceMaterial "Materials/ColourYellow.xml"
-matOlive = ResourceMaterial "Materials/ColourOlive.xml" 
-matLime = ResourceMaterial "Materials/ColourLime.xml" 
-matGreen = ResourceMaterial "Materials/ColourGreen.xml"
-matAqua = ResourceMaterial "Materials/ColourAqua.xml" 
-matTeal = ResourceMaterial "Materials/ColourTeal.xml" 
-matBlue = ResourceMaterial "Materials/ColourBlue.xml"  
-matNavy = ResourceMaterial "Materials/ColourNavy.xml"
-matFuchsia = ResourceMaterial "Materials/ColourFuchsia.xml"
-matPurple = ResourceMaterial "Materials/ColourPurple.xml"
-
-
+-- 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 - 2015 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.++-- HGamer3D/Graphics3D/Camera.hs++{-# LANGUAGE OverloadedStrings #-}++-- | Module providing the Material type+module HGamer3D.Graphics3D.Material++(+		-- * The Material Type and ComponentType+        Material (..),+        ctMaterial,++        -- * Some materials to play with+		matOrangeCrossMetal,+		matCrossMetal,+		matCrossMetalBlue,+		matMetal,+		matMetalZigZag,+		matMetalBumps,+		matFishEye,+		matMetalOrnament,+		matMetalScratch,+		matMetalLine,+		matGreenGrass,+		matBrownGrass,+		matGreyGrass,+		matSand,+		matRedRock,+		matBlackRock,+		matBrownStone,+		matStoneMetalWall,+		matCoalWall,+		matBrickWallGray,+		matBrickWallRed,+		matTilesOrange,+		matWoodTiles,+		matColourTiles,+		matBlackTiles,++		matWhite,+		matSilver,+		matGrey,+		matDarkGrey,+		matBlack,+		matRed,+		matMaroon,+		matYellow,+		matOlive,+		matLime,+		matGreen,+		matAqua,+		matTeal,+		matBlue,+		matNavy,+		matFuchsia,+		matPurple +)++where++import Data.MessagePack+import Fresco+import Data.Text++import HGamer3D.Data++-- generated++data Material = ResourceMaterial Text+    deriving (Eq, Read, Show)++instance ComponentClass Material where+    toObj (ResourceMaterial v1) = ObjectArray [ObjectInt 0, ObjectArray [(toObj v1)]]+    fromObj (ObjectArray [ObjectInt 0, ObjectArray [v1]]) = ResourceMaterial (fromObj v1)++ctMaterial :: ComponentType Material+ctMaterial = ComponentType 0xb4bae8b0d0d8c162++-- generated++-- some materials from the material folder+matOrangeCrossMetal = ResourceMaterial "Materials/Pattern_01.xml"+matCrossMetal = ResourceMaterial "Materials/Pattern_03.xml"+matCrossMetalBlue = ResourceMaterial "Materials/Pattern_04.xml"+matMetal = ResourceMaterial "Materials/Pattern_12.xml"+matMetalZigZag = ResourceMaterial "Materials/Pattern_13.xml"+matMetalBumps = ResourceMaterial "Materials/Pattern_14.xml"+matFishEye = ResourceMaterial "Materials/Pattern_15.xml"+matMetalOrnament = ResourceMaterial "Materials/Pattern_29.xml"+matMetalScratch = ResourceMaterial "Materials/Pattern_30.xml"+matMetalLine = ResourceMaterial "Materials/Pattern_31.xml"+matGreenGrass = ResourceMaterial "Materials/Pattern_42.xml"+matBrownGrass = ResourceMaterial "Materials/Pattern_43.xml"+matGreyGrass = ResourceMaterial "Materials/Pattern_44.xml"+matSand = ResourceMaterial "Materials/Pattern_45.xml"+matRedRock = ResourceMaterial "Materials/Pattern_46.xml"+matBlackRock = ResourceMaterial "Materials/Pattern_124.xml"+matBrownStone = ResourceMaterial "Materials/Pattern_125.xml"+matStoneMetalWall = ResourceMaterial "Materials/Pattern_126.xml"+matCoalWall = ResourceMaterial "Materials/Pattern_127.xml"+matBrickWallGray = ResourceMaterial "Materials/Pattern_100.xml"+matBrickWallRed = ResourceMaterial "Materials/Pattern_102.xml"+matTilesOrange = ResourceMaterial "Materials/Pattern_270.xml"+matWoodTiles = ResourceMaterial "Materials/Pattern_271.xml"+matColourTiles = ResourceMaterial "Materials/Pattern_272.xml"+matBlackTiles = ResourceMaterial "Materials/Pattern_273.xml"++matWhite = ResourceMaterial "Materials/ColourWhite.xml"+matSilver  = ResourceMaterial "Materials/ColourSilver.xml"+matGrey = ResourceMaterial "Materials/ColourGrey.xml" +matDarkGrey = ResourceMaterial "Materials/ColourDarkGrey.xml"+matBlack = ResourceMaterial "Materials/ColourBlack.xml" +matRed = ResourceMaterial "Materials/ColourRed.xml"+matMaroon = ResourceMaterial "Materials/ColourMaroon.xml"+matYellow = ResourceMaterial "Materials/ColourYellow.xml"+matOlive = ResourceMaterial "Materials/ColourOlive.xml" +matLime = ResourceMaterial "Materials/ColourLime.xml" +matGreen = ResourceMaterial "Materials/ColourGreen.xml"+matAqua = ResourceMaterial "Materials/ColourAqua.xml" +matTeal = ResourceMaterial "Materials/ColourTeal.xml" +matBlue = ResourceMaterial "Materials/ColourBlue.xml"  +matNavy = ResourceMaterial "Materials/ColourNavy.xml"+matFuchsia = ResourceMaterial "Materials/ColourFuchsia.xml"+matPurple = ResourceMaterial "Materials/ColourPurple.xml"++
− HGamer3D/Graphics3D/SystemGraphics3D.hs
@@ -1,140 +0,0 @@--- 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-2015 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.
-
--- | the Graphics3D System of the Entity-Component-System World
-
-{-# LANGUAGE StandaloneDeriving, OverloadedStrings, ForeignFunctionInterface #-}
-{-# OPTIONS_HADDOCK hide #-}
-
-module HGamer3D.Graphics3D.SystemGraphics3D
-
-( 
-  forkGraphics3DWorld
-)
-
-where
-
-import Control.Monad
-import Control.Concurrent.MVar
-import Data.Maybe
-import Data.Typeable
-import Data.Dynamic
-import Data.IORef
-import Data.Map
-import qualified Data.ByteString as B
-
-import qualified Data.Text as T
-import Data.Word
-
-import Foreign
-import Foreign.C
-import Foreign.Ptr
-
-import HGamer3D.Data
-import HGamer3D.ECS
-import HGamer3D.Util
-
-import qualified HGamer3D.Binding as B
-import HGamer3D.Graphics3D.Graphics3DConfig
-import HGamer3D.Graphics3D.Graphics3DCommand
-import HGamer3D.Graphics3D.Light
-import HGamer3D.Graphics3D.Window
-import HGamer3D.Graphics3D.Camera
-import HGamer3D.Graphics3D.Geometry
-import HGamer3D.Graphics3D.Material
-import HGamer3D.Input
-import HGamer3D.GUI
-import HGamer3D.Audio
-
-
-w64 (ComponentType w) = w
-
-systemData = do
-  lock <- newMVar ()
-  ne <- newIORef []
-  de <- newIORef []
-  
-  return $ SystemData lock ne de [] 
-  
--- CH4-5s
-    -- TABLE OF RECOGNIZED COMPONENTS
-    
-    -- Components, which are objects that means they can be created (and modified if supported): 
-    [
-        w64 ctGraphics3DConfig
-        , w64 ctCamera
-        , w64 ctLight
-        , w64 ctGeometry
-        
-        , w64 ctMouse
-        , w64 ctInputEventHandler
-        
-        , w64 ctButton
-        , w64 ctEditText
-        , w64 ctText
-        , w64 ctSlider
-        , w64 ctCheckBox
-        , w64 ctDropDownList
-        
-        , w64 ctSoundSource
-        , w64 ctSoundListener
-        , w64 ctVolume
-    ]
-    
-    -- Components, which are properties, they can be set on objects:
-    [
-        w64 ctPosition
-        , w64 ctScale
-        , w64 ctOrientation
-        , w64 ctGraphics3DCommand
-        , w64 ctMaterial
-        , w64 ctColour
-        , w64 ctVisible
-        , w64 ctScreenRect
-        , w64 ctPlayCmd
-    ]
-    
-    -- Event receiver, they cannot set by API, they are set by C library (they send messages):
-    [
-        -- events are only receiver
-        w64 ctMouseEvent
-        , w64 ctKeyEvent
-       
-        -- gui elements are both sender and receiver !
-        , w64 ctEditText
-        , w64 ctButton
-        , w64 ctSlider
-        , w64 ctCheckBox
-        , w64 ctDropDownList
-    ]
-    
--- CH4-5e                    
-
-    B.createItem
-    B.destroyItem
-    B.getMessageSender
-    B.registerMessageReceiver
-    B.errorMessage
-    
--- | start a graphics world
-forkGraphics3DWorld :: IO Bool -> GameTime -> IO [SystemData] 
-forkGraphics3DWorld stepF sleepT = do
-                    sd <- systemData
-                    runSystem stepF sleepT sd
-                    return $ [sd]
- 
HGamer3D/Graphics3D/Window.hs view
@@ -1,54 +1,56 @@--- 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 - 2015 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.
-
--- HGamer3D/Graphics3D/Camera.hs
-
--- | Module providing the Window type
-module HGamer3D.Graphics3D.Window
-
-(
-        WindowG3D (..),
-        ctWGr,
-        xyWindow,
-        fullScreen
-)
-
-where
-
-import Data.MessagePack
-import HGamer3D.Data
-import HGamer3D.ECS
-
-data WindowG3D = WindowG3D {
-    wg3dWindowWidth :: Int,
-    wg3dWindowHeight :: Int,
-    wg3dBorderless :: Bool,
-    wg3dFullScreen :: Bool,
-    wg3dWindowResizable :: Bool
-}
-
-instance ComponentClass WindowG3D where
-	toObj (WindowG3D ww wh bl fs wr) = ObjectArray [ObjectInt (fromIntegral ww), ObjectInt (fromIntegral wh), ObjectBool bl, ObjectBool fs, ObjectBool wr]
-	fromObj (ObjectArray [ObjectInt ww, ObjectInt wh, ObjectBool bl, ObjectBool fs, ObjectBool wr]) = WindowG3D (fromIntegral ww) (fromIntegral wh) bl fs wr
-
-ctWGr :: ComponentType WindowG3D
-ctWGr = ComponentType 0xed96843bfb53d99e
-
-xyWindow x y = WindowG3D x y False False True
-fullScreen = WindowG3D 0 0 True True False
-
+-- 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 - 2015 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.++-- HGamer3D/Graphics3D/Camera.hs++-- | Module providing the Window type+module HGamer3D.Graphics3D.Window++(+        WindowG3D (..),+        ctWGr,+        xyWindow,+        fullScreen+)++where++import Data.MessagePack+import Fresco+import HGamer3D.Data+-- import HGamer3D.ECS++data WindowG3D = WindowG3D {+    windowWidth::Int,+    windowHeight::Int,+    windowBorderless::Bool,+    windowFullScreen::Bool,+    windowResizable::Bool+}++instance ComponentClass WindowG3D where+    toObj (WindowG3D v1 v2 v3 v4 v5) = ObjectArray [(toObj v1), (toObj v2), ObjectBool v3, ObjectBool v4, ObjectBool v5]+    fromObj (ObjectArray [v1, v2, ObjectBool v3, ObjectBool v4, ObjectBool v5]) = WindowG3D (fromObj v1) (fromObj v2) v3 v4 v5+++ctWGr :: ComponentType WindowG3D+ctWGr = ComponentType 0xed96843bfb53d99e++xyWindow x y = WindowG3D x y False False True+fullScreen = WindowG3D 0 0 True True False+
HGamer3D/Input.hs view
@@ -1,39 +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.hgamer3d.org
--- 
--- (c) 2015 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.
--- 
--- HGamer3D/Input.hs
--- 
-
--- | Input Devices for HGamer3D 
-module HGamer3D.Input
-
-(
-    module HGamer3D.Input.Mouse,
-    module HGamer3D.Input.Keyboard,
-    module HGamer3D.Input.Joystick,
-    module HGamer3D.Input.InputEventHandler
-)
-
-where
-
-import HGamer3D.Input.Mouse
-import HGamer3D.Input.Keyboard
-import HGamer3D.Input.Joystick
-import HGamer3D.Input.InputEventHandler
-
-
+-- 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) 2015 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.+-- +-- HGamer3D/Input.hs+-- ++-- | Input Devices for HGamer3D +module HGamer3D.Input++(+    module HGamer3D.Input.Mouse,+    module HGamer3D.Input.Keyboard,+    module HGamer3D.Input.Joystick,+    module HGamer3D.Input.InputEventHandler+)++where++import HGamer3D.Input.Mouse+import HGamer3D.Input.Keyboard+import HGamer3D.Input.Joystick+import HGamer3D.Input.InputEventHandler++
HGamer3D/Input/InputEventHandler.hs view
@@ -1,70 +1,88 @@-{-
-	Input Event handler and settings
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Input/Mouse.hs
--}
-
--- | Module providing settings for all input events (Mouse, Keyboard, Joystick)
-module HGamer3D.Input.InputEventHandler
-(
-    InputEventType (..),
-    InputEventHandler (..),
-    ctInputEventHandler
-)
-
-where
-
-import Data.MessagePack
-import Debug.Trace
-import Data.Text
-
-import HGamer3D.Data
-
-data InputEventType  =  IEMouseButtonUp
-                        | IEMouseButtonDown
-                        | IEMouseMove
-                        | IEMouseButtonWheel
-                        | IEMouseButtonVisibleChanged
-                        | IEKeyUp
-                        | IEKeyDown
-
-                        deriving (Eq, Show)
-
-instance ComponentClass InputEventType where
-
-    toObj iet = case iet of
-        IEMouseButtonUp -> ObjectInt 1
-        IEMouseButtonDown -> ObjectInt 2
-        IEMouseMove -> ObjectInt 3
-        IEMouseButtonWheel -> ObjectInt 4
-        IEMouseButtonVisibleChanged -> ObjectInt 5
-        IEKeyUp -> ObjectInt 6
-        IEKeyDown -> ObjectInt 7
-    fromObj (ObjectInt n) = case n of
-        1 -> IEMouseButtonUp
-        2 -> IEMouseButtonDown
-        3 -> IEMouseMove
-        4 -> IEMouseButtonWheel
-        5 -> IEMouseButtonVisibleChanged
-        6 -> IEKeyUp
-        7 -> IEKeyDown
-        
-data InputEventHandler = DefaultEventHandler
-                         | SpecificEventHandler [InputEventType]
-
-instance ComponentClass InputEventHandler where
-    toObj DefaultEventHandler = ObjectArray [ObjectInt 0]
-    toObj (SpecificEventHandler iets) = ObjectArray [ObjectInt 1, ObjectArray (Prelude.map toObj iets)]
-
-    fromObj (ObjectArray [ObjectInt 0]) = DefaultEventHandler
-    fromObj (ObjectArray [ObjectInt 1, (ObjectArray iets_os)]) = SpecificEventHandler (Prelude.map fromObj iets_os)
-    
-ctInputEventHandler :: ComponentType InputEventHandler
-ctInputEventHandler = ComponentType 0xfc0edefcebcb5878
-
+{-+	Input Event handler and settings+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Input/Mouse.hs+-}++-- | Module providing settings for all input events (Mouse, Keyboard, Joystick)+module HGamer3D.Input.InputEventHandler+(+    InputEventType (..),+    InputEventHandler (..),+    ctInputEventHandler,+    ExitRequestedEvent (..),+    ctExitRequestedEvent+)++where++import Fresco+import Data.MessagePack+import Debug.Trace+import Data.Text++import HGamer3D.Data++data InputEventType  =  IEMouseButtonUp+                        | IEMouseButtonDown+                        | IEMouseMove+                        | IEMouseButtonWheel+                        | IEMouseButtonVisibleChanged+                        | IEKeyUp+                        | IEKeyDown+                        | IEExitRequested++                        deriving (Eq, Show)++instance ComponentClass InputEventType where++    toObj iet = case iet of+        IEMouseButtonUp -> ObjectInt 1+        IEMouseButtonDown -> ObjectInt 2+        IEMouseMove -> ObjectInt 3+        IEMouseButtonWheel -> ObjectInt 4+        IEMouseButtonVisibleChanged -> ObjectInt 5+        IEKeyUp -> ObjectInt 6+        IEKeyDown -> ObjectInt 7+        IEExitRequested -> ObjectInt 8+    fromObj (ObjectInt n) = case n of+        1 -> IEMouseButtonUp+        2 -> IEMouseButtonDown+        3 -> IEMouseMove+        4 -> IEMouseButtonWheel+        5 -> IEMouseButtonVisibleChanged+        6 -> IEKeyUp+        7 -> IEKeyDown+        8 -> IEExitRequested+        +data InputEventHandler = DefaultEventHandler+                         | SpecificEventHandler [InputEventType]++instance ComponentClass InputEventHandler where+    toObj DefaultEventHandler = ObjectArray [ObjectInt 0]+    toObj (SpecificEventHandler iets) = ObjectArray [ObjectInt 1, ObjectArray (Prelude.map toObj iets)]++    fromObj (ObjectArray [ObjectInt 0]) = DefaultEventHandler+    fromObj (ObjectArray [ObjectInt 1, (ObjectArray iets_os)]) = SpecificEventHandler (Prelude.map fromObj iets_os)+    +ctInputEventHandler :: ComponentType InputEventHandler+ctInputEventHandler = ComponentType 0xfc0edefcebcb5878+++-- ExitRequestedEvent++data ExitRequestedEvent = ExitRequestedEvent+                      deriving (Eq, Show)++instance ComponentClass ExitRequestedEvent where+    toObj ExitRequestedEvent = ObjectArray [ObjectInt 0]+    fromObj (ObjectArray [ObjectInt 0]) = ExitRequestedEvent+    +ctExitRequestedEvent :: ComponentType ExitRequestedEvent+ctExitRequestedEvent = ComponentType 0x824517eb48d5c653
HGamer3D/Input/Joystick.hs view
@@ -1,25 +1,26 @@-{-
-	Joystick functionality and settings
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Input/Joystick.hs
--}
-
--- | Module providing the Joystick functionality and settings
-module HGamer3D.Input.Joystick
-(
-)
-
-where
-
-import Data.MessagePack
-import Debug.Trace
-import Data.Text
-
-import HGamer3D.Data
-
+{-+	Joystick functionality and settings+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Input/Joystick.hs+-}++-- | Module providing the Joystick functionality and settings+module HGamer3D.Input.Joystick+(+)++where++import Fresco+import Data.MessagePack+import Debug.Trace+import Data.Text++import HGamer3D.Data+
HGamer3D/Input/Keyboard.hs view
@@ -1,47 +1,48 @@-{-
-	Keyboard functionality and settings
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Input/Keyboard.hs
--}
-
--- | Module providing the keyboard functionality and settings
-module HGamer3D.Input.Keyboard
-
-(
-    KeyEvent (..),
-    ctKeyEvent
-)
-
-where
-
-import Data.MessagePack
-import Debug.Trace
-import Data.Text
-
-import HGamer3D.Data
-
-data KeyEvent =   NoKeyEvent
-                | KeyUp Int Int Text      -- Key, Scancode, Name
-                | KeyDown Int Int Text    -- Key, Scancode, Name
-                deriving (Eq, Show)
-                
-instance ComponentClass KeyEvent where
-    toObj NoKeyEvent = ObjectArray [ObjectInt 0]
-    toObj (KeyUp k s n) = ObjectArray [ObjectInt 1, ObjectInt (fromIntegral k), ObjectInt (fromIntegral s), toObj n]
-    toObj (KeyDown k s n) = ObjectArray [ObjectInt 2, ObjectInt (fromIntegral k), ObjectInt (fromIntegral s), toObj n]
-
-    fromObj (ObjectArray [ObjectInt 0]) = NoKeyEvent
-    fromObj (ObjectArray [ObjectInt 1, ObjectInt k, ObjectInt s, n_o]) = KeyUp (fromIntegral k) (fromIntegral s) (fromObj n_o)
-    fromObj (ObjectArray [ObjectInt 2, ObjectInt k, ObjectInt s, n_o]) = KeyDown (fromIntegral k) (fromIntegral s) (fromObj n_o)
-    
-ctKeyEvent :: ComponentType KeyEvent
-ctKeyEvent = ComponentType 0x5ba1617fb50e97e5
-
-
+{-+	Keyboard functionality and settings+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Input/Keyboard.hs+-}++-- | Module providing the keyboard functionality and settings+module HGamer3D.Input.Keyboard++(+    KeyEvent (..),+    ctKeyEvent+)++where++import Fresco+import Data.MessagePack+import Debug.Trace+import Data.Text++import HGamer3D.Data++data KeyEvent =   NoKeyEvent+                | KeyUp Int Int Text      -- Key, Scancode, Name+                | KeyDown Int Int Text    -- Key, Scancode, Name+                deriving (Eq, Show)+                +instance ComponentClass KeyEvent where+    toObj NoKeyEvent = ObjectArray [ObjectInt 0]+    toObj (KeyUp k s n) = ObjectArray [ObjectInt 1, ObjectInt (fromIntegral k), ObjectInt (fromIntegral s), toObj n]+    toObj (KeyDown k s n) = ObjectArray [ObjectInt 2, ObjectInt (fromIntegral k), ObjectInt (fromIntegral s), toObj n]++    fromObj (ObjectArray [ObjectInt 0]) = NoKeyEvent+    fromObj (ObjectArray [ObjectInt 1, ObjectInt k, ObjectInt s, n_o]) = KeyUp (fromIntegral k) (fromIntegral s) (fromObj n_o)+    fromObj (ObjectArray [ObjectInt 2, ObjectInt k, ObjectInt s, n_o]) = KeyDown (fromIntegral k) (fromIntegral s) (fromObj n_o)+    +ctKeyEvent :: ComponentType KeyEvent+ctKeyEvent = ComponentType 0x5ba1617fb50e97e5++     
HGamer3D/Input/Mouse.hs view
@@ -1,83 +1,84 @@-{-
-	Mouse functionality and settings
-	HGamer3D Library (A project to enable 3D game development in Haskell)
-	Copyright 2015 Peter Althainz
-	
-	Distributed under the Apache License, Version 2.0
-	(See attached file LICENSE or copy at 
-	http://www.apache.org/licenses/LICENSE-2.0)
- 
-	file: HGamer3D/Input/Mouse.hs
--}
-
--- | Module providing the Mouse functionality and settings
-module HGamer3D.Input.Mouse
-(
-    MouseMode (..),
-    Mouse (..),
-    MouseEvent (..),
-    ctMouse,
-    ctMouseEvent
-)
-
-where
-
-import Data.MessagePack
-import Debug.Trace
-import Data.Text
-
-import HGamer3D.Data
-
-
--- Mouse mode and Mouse datatype
-
-data MouseMode = MMAbsolute
-                | MMRelative
-                | MMWrap
-                deriving (Eq, Show)
-                
-instance ComponentClass MouseMode where
-    toObj MMAbsolute = ObjectInt 1
-    toObj MMRelative = ObjectInt 2
-    toObj MMWrap = ObjectInt 3
-    fromObj (ObjectInt 1) = MMAbsolute
-    fromObj (ObjectInt 2) = MMRelative
-    fromObj (ObjectInt 3) = MMWrap
-    
-data Mouse = Mouse MouseMode deriving (Eq, Show) 
-
-instance ComponentClass Mouse where
-    toObj (Mouse mm) = ObjectArray [ObjectInt 1, toObj mm]
-    fromObj (ObjectArray [ObjectInt 1, mm_o]) = Mouse (fromObj mm_o)
-
-ctMouse :: ComponentType Mouse
-ctMouse = ComponentType 0xa532f43b1c1c6bc7
-
--- Mouse Events
-
-data MouseEvent =   NoMouseEvent
-                    | MouseButtonUp Int Int Int         -- Button, Buttons, Qualifiers
-                    | MouseButtonDown Int Int Int       -- Button, Buttons, Qualifiers
-                    | MouseMove Int Int Int Int Int Int -- X, Y, DX, DY, Buttons, Qualifiers
-                    | MouseWheel Int Int Int            -- Wheel, Buttons, Qualifiers
-                    | MouseVisibleChanged Bool          -- Visible
-                      deriving (Eq, Show)
-
-instance ComponentClass MouseEvent where
-    toObj NoMouseEvent = ObjectArray [ObjectInt 0]
-    toObj (MouseButtonUp b bs qs) = ObjectArray [ObjectInt 1, ObjectInt (fromIntegral b), ObjectInt (fromIntegral bs), ObjectInt (fromIntegral qs)]
-    toObj (MouseButtonDown b bs qs) = ObjectArray [ObjectInt 2, ObjectInt (fromIntegral b), ObjectInt (fromIntegral bs), ObjectInt (fromIntegral qs)]
-    toObj (MouseMove x y dx dy bs qs) = ObjectArray [ObjectInt 3, ObjectInt (fromIntegral x), ObjectInt (fromIntegral y), ObjectInt (fromIntegral dx), ObjectInt (fromIntegral dy), ObjectInt (fromIntegral bs), ObjectInt (fromIntegral qs)]
-    toObj (MouseWheel w bs qs) = ObjectArray [ObjectInt 4, ObjectInt (fromIntegral w), ObjectInt (fromIntegral bs), ObjectInt (fromIntegral qs)]
-    toObj (MouseVisibleChanged v) = ObjectArray [ObjectInt 5, ObjectBool v]
-    
-    fromObj (ObjectArray [ObjectInt 0]) = NoMouseEvent
-    fromObj (ObjectArray [ObjectInt 1, ObjectInt b, ObjectInt bs, ObjectInt qs]) = MouseButtonUp (fromIntegral b) (fromIntegral bs) (fromIntegral qs)
-    fromObj (ObjectArray [ObjectInt 2, ObjectInt b, ObjectInt bs, ObjectInt qs]) = MouseButtonDown (fromIntegral b) (fromIntegral bs) (fromIntegral qs)
-    fromObj (ObjectArray [ObjectInt 3, ObjectInt x, ObjectInt y, ObjectInt dx, ObjectInt dy, ObjectInt bs, ObjectInt qs]) = MouseMove (fromIntegral x) (fromIntegral y) (fromIntegral dx) (fromIntegral dy) (fromIntegral bs) (fromIntegral qs)
-    fromObj (ObjectArray [ObjectInt 4, ObjectInt w, ObjectInt bs, ObjectInt qs]) = MouseWheel (fromIntegral w) (fromIntegral bs) (fromIntegral qs)
-    fromObj (ObjectArray [ObjectInt 5, ObjectBool v]) = MouseVisibleChanged v
-    
-ctMouseEvent :: ComponentType MouseEvent
-ctMouseEvent = ComponentType 0x27eaf3fd46595d08
-
+{-+	Mouse functionality and settings+	HGamer3D Library (A project to enable 3D game development in Haskell)+	Copyright 2015 Peter Althainz+	+	Distributed under the Apache License, Version 2.0+	(See attached file LICENSE or copy at +	http://www.apache.org/licenses/LICENSE-2.0)+ +	file: HGamer3D/Input/Mouse.hs+-}++-- | Module providing the Mouse functionality and settings+module HGamer3D.Input.Mouse+(+    MouseMode (..),+    Mouse (..),+    MouseEvent (..),+    ctMouse,+    ctMouseEvent+)++where++import Fresco+import Data.MessagePack+import Debug.Trace+import Data.Text++import HGamer3D.Data+++-- Mouse mode and Mouse datatype++data MouseMode = MMAbsolute+                | MMRelative+                | MMWrap+                deriving (Eq, Show)+                +instance ComponentClass MouseMode where+    toObj MMAbsolute = ObjectInt 1+    toObj MMRelative = ObjectInt 2+    toObj MMWrap = ObjectInt 3+    fromObj (ObjectInt 1) = MMAbsolute+    fromObj (ObjectInt 2) = MMRelative+    fromObj (ObjectInt 3) = MMWrap+    +data Mouse = Mouse MouseMode deriving (Eq, Show) ++instance ComponentClass Mouse where+    toObj (Mouse mm) = ObjectArray [ObjectInt 1, toObj mm]+    fromObj (ObjectArray [ObjectInt 1, mm_o]) = Mouse (fromObj mm_o)++ctMouse :: ComponentType Mouse+ctMouse = ComponentType 0xa532f43b1c1c6bc7++-- Mouse Events++data MouseEvent =   NoMouseEvent+                    | MouseButtonUp Int Int Int         -- Button, Buttons, Qualifiers+                    | MouseButtonDown Int Int Int       -- Button, Buttons, Qualifiers+                    | MouseMove Int Int Int Int Int Int -- X, Y, DX, DY, Buttons, Qualifiers+                    | MouseWheel Int Int Int            -- Wheel, Buttons, Qualifiers+                    | MouseVisibleChanged Bool          -- Visible+                      deriving (Eq, Show)++instance ComponentClass MouseEvent where+    toObj NoMouseEvent = ObjectArray [ObjectInt 0]+    toObj (MouseButtonUp b bs qs) = ObjectArray [ObjectInt 1, ObjectInt (fromIntegral b), ObjectInt (fromIntegral bs), ObjectInt (fromIntegral qs)]+    toObj (MouseButtonDown b bs qs) = ObjectArray [ObjectInt 2, ObjectInt (fromIntegral b), ObjectInt (fromIntegral bs), ObjectInt (fromIntegral qs)]+    toObj (MouseMove x y dx dy bs qs) = ObjectArray [ObjectInt 3, ObjectInt (fromIntegral x), ObjectInt (fromIntegral y), ObjectInt (fromIntegral dx), ObjectInt (fromIntegral dy), ObjectInt (fromIntegral bs), ObjectInt (fromIntegral qs)]+    toObj (MouseWheel w bs qs) = ObjectArray [ObjectInt 4, ObjectInt (fromIntegral w), ObjectInt (fromIntegral bs), ObjectInt (fromIntegral qs)]+    toObj (MouseVisibleChanged v) = ObjectArray [ObjectInt 5, ObjectBool v]+    +    fromObj (ObjectArray [ObjectInt 0]) = NoMouseEvent+    fromObj (ObjectArray [ObjectInt 1, ObjectInt b, ObjectInt bs, ObjectInt qs]) = MouseButtonUp (fromIntegral b) (fromIntegral bs) (fromIntegral qs)+    fromObj (ObjectArray [ObjectInt 2, ObjectInt b, ObjectInt bs, ObjectInt qs]) = MouseButtonDown (fromIntegral b) (fromIntegral bs) (fromIntegral qs)+    fromObj (ObjectArray [ObjectInt 3, ObjectInt x, ObjectInt y, ObjectInt dx, ObjectInt dy, ObjectInt bs, ObjectInt qs]) = MouseMove (fromIntegral x) (fromIntegral y) (fromIntegral dx) (fromIntegral dy) (fromIntegral bs) (fromIntegral qs)+    fromObj (ObjectArray [ObjectInt 4, ObjectInt w, ObjectInt bs, ObjectInt qs]) = MouseWheel (fromIntegral w) (fromIntegral bs) (fromIntegral qs)+    fromObj (ObjectArray [ObjectInt 5, ObjectBool v]) = MouseVisibleChanged v+    +ctMouseEvent :: ComponentType MouseEvent+ctMouseEvent = ComponentType 0x27eaf3fd46595d08+
HGamer3D/Util.hs view
@@ -1,34 +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.hgamer3d.org
--- 
--- (c) 2011 - 2015 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.
--- 
--- HGamer3D/Data.hs
--- 
-
--- | Common utilities for HGamer3D 
-module HGamer3D.Util
-
-(
-	module HGamer3D.Util.FileLocation,
-	module HGamer3D.Util.UniqueName
-)
-
-where
-
-import HGamer3D.Util.FileLocation
-import HGamer3D.Util.UniqueName
-
+-- 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 - 2015 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.+-- +-- HGamer3D/Data.hs+-- ++-- | Common utilities for HGamer3D +module HGamer3D.Util++(+	module HGamer3D.Util.FileLocation,+	module HGamer3D.Util.UniqueName,+	module HGamer3D.Util.Variable+)++where++import HGamer3D.Util.FileLocation+import HGamer3D.Util.UniqueName+import HGamer3D.Util.Variable+
HGamer3D/Util/FileLocation.hs view
@@ -1,50 +1,50 @@--- 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 - 2015 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.
-
--- Util.hs
-
--- | Utility to provide file location information to other parts of HGamer3D
-module HGamer3D.Util.FileLocation
-
-(
-  
-        -- * Directories relative to the user-related application directory for HGamer3D
-        getAppDirectory,
-        getMediaDirectory,
-        getConfigDirectory,
-        
-        -- * General utilities for path handling and finding files
-        pathSeparator
-)
-
-where
-
-import Control.Monad
-import Control.Exception
-import System.FilePath
-import System.Directory
-
--- | path of subdirectory within platform specific application directories
-getAppDirectory = getAppUserDataDirectory
-
--- | path of HGamer3D Media Directory
-getMediaDirectory = getAppDirectory ("HGamer3D" ++ [pathSeparator] ++ "media")
-
--- | path of HGamer3D configuration directory 
-getConfigDirectory = getAppDirectory ("HGamer3D" ++ [pathSeparator] ++ "config")
-
+-- 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 - 2015 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.++-- Util.hs++-- | Utility to provide file location information to other parts of HGamer3D+module HGamer3D.Util.FileLocation++(+  +        -- * Directories relative to the user-related application directory for HGamer3D+        getAppDirectory,+        getMediaDirectory,+        getConfigDirectory,+        +        -- * General utilities for path handling and finding files+        pathSeparator+)++where++import Control.Monad+import Control.Exception+import System.FilePath+import System.Directory++-- | path of subdirectory within platform specific application directories+getAppDirectory = getAppUserDataDirectory++-- | path of HGamer3D Media Directory+getMediaDirectory = getAppDirectory ("HGamer3D" ++ [pathSeparator] ++ "media")++-- | path of HGamer3D configuration directory +getConfigDirectory = getAppDirectory ("HGamer3D" ++ [pathSeparator] ++ "config")+
HGamer3D/Util/UniqueName.hs view
@@ -1,48 +1,48 @@--- 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-2013 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.
-
--- UniqueName.hs
-
--- | Utility to provide a unique name, carries internal state in a IORef
-module HGamer3D.Util.UniqueName
-(
-  
-  UniqueName,
-  createUniqueName,
-  nextUniqueName
-  
-) where
-
-import Data.IORef
-
-data UniqueName = UniqueName String (IORef [Int])
-
--- | creates a unique name holder
-createUniqueName :: String -> IO UniqueName
-createUniqueName baseName = do
-  ref <- newIORef [0..]
-  return $ UniqueName baseName ref
-  
--- | delivers the next unique name from the name holder
-nextUniqueName :: UniqueName -> IO String
-nextUniqueName (UniqueName baseName ref) = do
-  name <- atomicModifyIORef ref (\ilist -> (tail ilist, baseName ++ (show (head ilist))))
-  return name
-  
-  
+-- 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-2013 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.++-- UniqueName.hs++-- | Utility to provide a unique name, carries internal state in a IORef+module HGamer3D.Util.UniqueName+(+  +  UniqueName,+  createUniqueName,+  nextUniqueName+  +) where++import Data.IORef++data UniqueName = UniqueName String (IORef [Int])++-- | creates a unique name holder+createUniqueName :: String -> IO UniqueName+createUniqueName baseName = do+  ref <- newIORef [0..]+  return $ UniqueName baseName ref+  +-- | delivers the next unique name from the name holder+nextUniqueName :: UniqueName -> IO String+nextUniqueName (UniqueName baseName ref) = do+  name <- atomicModifyIORef ref (\ilist -> (tail ilist, baseName ++ (show (head ilist))))+  return name+  +                      
+ HGamer3D/Util/Variable.hs 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.hgamer3d.org+--+-- (c) 2011-2013 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.++-- Variable.hs++-- | :-) I'm fundamentally convinced this is missing in Haskell, urs of the backwoods++module HGamer3D.Util.Variable+(+  Var,+  makeVar,+  readVar,+  writeVar,+  writeVar',+  updateVar,+  updateVar'+) where++import Data.IORef++newtype Var a = Var (IORef a)++makeVar :: a -> IO (Var a)+makeVar v = Var <$> newIORef v++readVar :: Var a -> IO a+readVar (Var r) = readIORef r++writeVar :: Var a -> a -> IO a+writeVar (Var r) val = atomicModifyIORef r (\old -> (val, old)) ++writeVar' :: Var a -> a -> IO a+writeVar' (Var r) val = atomicModifyIORef' r (\old -> (val, old))++updateVar :: Var a -> (a -> (a, b)) -> IO b+updateVar (Var r) f = atomicModifyIORef r f++updateVar' :: Var a -> (a -> (a, b)) -> IO b+updateVar' (Var r) f = atomicModifyIORef' r f+
LICENSE view
@@ -1,42 +1,42 @@-LICENSE
--------
-
-(c) 2011-2014 Peter Althainz
-
-
-HGamer3D (http://www.hgamer3d.org)
-----------------------------------
-
-HGamer3D is licensed under the Apache License, Version 2.0 (the "License"); you may not use this software 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.
-
-
-Source Code
------------
-You can obtain the latest version of the source code under http://www.bitbucket.org/althainz/HGamer3D
-
-
-Open Source Software Used - Module HGamer3D
--------------------------------------------
-
-HGamer3D uses a number of open source software libraries. You are responsible to comply to the licenses of those packages and the licenses of software used by those packages if you use HGamer3D. 
-
-The HGamer3D module uses the following Haskell libraries from Hackage:
-
-base, license: BSD3
-containers, license: BSD3
-text,  license: BSD3
-directory, license: BSD3
-mtl, license: BSD3
-FindBin, license: BSD3
-monad-loops, license: PublicDomain, BSD3 similar
-split, license: BSD3
-netwire, license: BSD3
-HGamer3D-Data, license: Apache 2.0
-HGamer3D-Ogre-Binding, license: Apache 2.0 and dependencies see in that module
-HGamer3D-SFML-Binding, license: Apache 2.0 and dependencies see in that module 
-HGamer3D-CEGUI-Binding, license: Apache 2.0 and dependencies see in that module
-HGamer3D-Enet-Binding, license: Apache 2.0 and dependencies see in that module
+LICENSE+-------++(c) 2011-2014 Peter Althainz+++HGamer3D (http://www.hgamer3d.org)+----------------------------------++HGamer3D is licensed under the Apache License, Version 2.0 (the "License"); you may not use this software 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.+++Source Code+-----------+You can obtain the latest version of the source code under http://www.bitbucket.org/althainz/HGamer3D+++Open Source Software Used - Module HGamer3D+-------------------------------------------++HGamer3D uses a number of open source software libraries. You are responsible to comply to the licenses of those packages and the licenses of software used by those packages if you use HGamer3D. ++The HGamer3D module uses the following Haskell libraries from Hackage:++base, license: BSD3+containers, license: BSD3+text,  license: BSD3+directory, license: BSD3+mtl, license: BSD3+FindBin, license: BSD3+monad-loops, license: PublicDomain, BSD3 similar+split, license: BSD3+netwire, license: BSD3+HGamer3D-Data, license: Apache 2.0+HGamer3D-Ogre-Binding, license: Apache 2.0 and dependencies see in that module+HGamer3D-SFML-Binding, license: Apache 2.0 and dependencies see in that module +HGamer3D-CEGUI-Binding, license: Apache 2.0 and dependencies see in that module+HGamer3D-Enet-Binding, license: Apache 2.0 and dependencies see in that module
Setup.hs view
@@ -1,22 +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.hgamer3d.org
---
--- (c) 2011-2013 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
+-- 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-2013 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