hogre-examples 0.1.0 → 0.1.4
raw patch · 7 files changed
+45/−22 lines, 7 filesdep −haskell98dep ~hogre
Dependencies removed: haskell98
Dependency ranges changed: hogre
Files
- .gitignore +5/−0
- Changelog +16/−0
- hogre-examples.cabal +5/−5
- resources.cfg +3/−0
- src/Common.hs +4/−4
- src/Example_01.hs +3/−3
- src/Example_02.hs +9/−10
+ .gitignore view
@@ -0,0 +1,5 @@+dist/+*.log+Main+ogre.cfg+tmp
+ Changelog view
@@ -0,0 +1,16 @@+0.1.4 - 2010-05-15+- fix compilation with ghc >= 7.2+- update code to work with cgen 0.0.4 name mangling++0.1.0 - 2010-08-05+- adapt to hogre-0.1.0++0.0.3 - 2010-05-15+- Fix compiler error on GHC 6.12.1+- Small corrections to documentation++0.0.2 - 2009-11-12+- Correct git URL++0.0.1 - 2009-11-11+- Initial release
hogre-examples.cabal view
@@ -1,5 +1,5 @@ Name: hogre-examples-Version: 0.1.0+Version: 0.1.4 Cabal-Version: >= 1.6 License: MIT License-File: LICENSE@@ -39,16 +39,16 @@ location: git://github.com/anttisalonen/hogre-examples.git Executable example_01- Build-Depends: base >= 3 && < 5, haskell98, hogre>=0.1.0+ Build-Depends: base >= 3 && < 5, hogre>=0.1.4 Main-is: Example_01.hs Hs-Source-Dirs: src Ghc-options: -Wall- extra-libraries: OgreMain+ extra-libraries: OgreMain stdc++ Executable example_02- Build-Depends: base >= 3 && < 5, haskell98, hogre>=0.1.0+ Build-Depends: base >= 3 && < 5, hogre>=0.1.4 Main-is: Example_02.hs Hs-Source-Dirs: src Ghc-options: -Wall- extra-libraries: OgreMain+ extra-libraries: OgreMain stdc++
+ resources.cfg view
@@ -0,0 +1,3 @@+# Resource locations to be added to the default path+[General]+FileSystem=./Media
src/Common.hs view
@@ -32,7 +32,7 @@ resourceGroupManager_getSingletonPtr >>= resourceGroupManager_initialiseAllResourceGroups -- create the scene manager, here a generic one- smgr <- root_createSceneManager1 root "DefaultSceneManager" "Scene Manager"+ smgr <- root_createSceneManager_RootPcharPcharP root "DefaultSceneManager" "Scene Manager" -- create and position the camera cam <- sceneManager_createCamera smgr "PlayerCam"@@ -62,7 +62,7 @@ if closed then return value else do- success <- root_renderOneFrame1 root+ success <- root_renderOneFrame_RootP root timer <- root_getTimer root time' <- timer_getMicroseconds timer let delta = (fromIntegral (time' - time)) / 1000000@@ -76,9 +76,9 @@ addEntity :: SceneManager -> String -> IO (Entity, SceneNode) addEntity smgr mesh = do- ent <- sceneManager_createEntity2 smgr mesh+ ent <- sceneManager_createEntity_SceneManagerPcharP smgr mesh rootNode <- sceneManager_getRootSceneNode smgr- node <- sceneManager_createSceneNode1 smgr+ node <- sceneManager_createSceneNode_SceneManagerP smgr node_addChild (toNode rootNode) (toNode node) sceneNode_attachObject node (toMovableObject ent) return (ent, node)
src/Example_01.hs view
@@ -13,7 +13,7 @@ smgr <- root_getSceneManager root "Scene Manager" cam <- sceneManager_getCamera smgr "PlayerCam" - camera_setPosition1 cam 0 0 80+ camera_setPosition_CameraPfloatfloatfloat cam 0 0 80 camera_lookAt cam 0 0 (-300) _ <- addEntity smgr "ogrehead.mesh"@@ -22,8 +22,8 @@ colourValue_with 0.5 0.5 0.5 1.0 (sceneManager_setAmbientLight smgr) -- create a light- l <- sceneManager_createLight1 smgr "MainLight"- light_setPosition1 l 20 80 50+ l <- sceneManager_createLight_SceneManagerPcharP smgr "MainLight"+ light_setPosition_LightPfloatfloatfloat l 20 80 50 window <- root_getAutoCreatedWindow root render window root () nullHandler
src/Example_02.hs view
@@ -22,7 +22,7 @@ (robotEntity, robotNode) <- addEntity smgr "robot.mesh" let (initx, initz) = initPos- node_translate2 (toNode robotNode) initx 0 initz TS_WORLD+ node_translate_NodePfloatfloatfloatNodeTransformSpace (toNode robotNode) initx 0 initz TS_WORLD anim <- entity_getAnimationState robotEntity "Walk" animationState_setLoop anim True@@ -32,10 +32,10 @@ addKnot smgr 550 (-10) 50 addKnot smgr (-100) (-10) (-200) - camera_setPosition1 cam 90 280 535+ camera_setPosition_CameraPfloatfloatfloat cam 90 280 535 -- camera_lookAt cam 0 0 30- radian_with1 (-0.52359) $ camera_pitch cam- radian_with1 (-0.26179) $ camera_yaw cam + radian_with_float (-0.52359) $ camera_pitch cam+ radian_with_float (-0.26179) $ camera_yaw cam window <- root_getAutoCreatedWindow root render window root (initState robotEntity robotNode) handler@@ -54,8 +54,8 @@ handler _ delta (ent, node, (locx, locz), wl) = do let (wx, wz) = head wl dist <- - vector3_with4 locx 0 locz $ \locv ->- vector3_with4 wx 0 wz $ vector3_distance locv+ vector3_with_floatfloatfloat locx 0 locz $ \locv ->+ vector3_with_floatfloatfloat wx 0 wz $ vector3_distance locv let wl' = if dist <= 30 then tail wl else wl@@ -64,18 +64,17 @@ locx' = locx - 35 * delta * cos ang locz' = locz - 35 * delta * sin ang when (dist > 150) $- vector3_with4 tgtx 0 tgtz $ \v1 -> - vector3_with4 1 0 0 $ \v -> + vector3_with_floatfloatfloat tgtx 0 tgtz $ \v1 -> + vector3_with_floatfloatfloat 1 0 0 $ \v -> sceneNode_lookAt node v1 TS_WORLD v node_setPosition (toNode node) locx' 0 locz' anim <- entity_getAnimationState ent "Walk" animationState_addTime anim delta- print (dist, tgtx, tgtz) return ((ent, node, (locx', locz'), wl'), True) addKnot :: SceneManager -> Float -> Float -> Float -> IO () addKnot smgr v1 v2 v3 = do (_, knot) <- addEntity smgr "knot.mesh"- node_translate2 (toNode knot) v1 v2 v3 TS_WORLD+ node_translate_NodePfloatfloatfloatNodeTransformSpace (toNode knot) v1 v2 v3 TS_WORLD node_setScale (toNode knot) 0.1 0.1 0.1