-
Notifications
You must be signed in to change notification settings - Fork 1
/
game.hs
57 lines (42 loc) · 1.2 KB
/
game.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{-# LANGUAGE OverloadedStrings #-}
module Main where
import HGamer3D
import Actor
import Switch
import Data
-- MAIN PROGRAM
-- ------------
gameLogic :: HG3D -> IO ()
gameLogic hg3d = do
-- intialize cam
cam <- initializeCam hg3d
-- create main switch actor and send message
switchA <- newSwitchActor hg3d cam
sendMsg switchA StartProgram
return ()
main = do
runGame standardGraphics3DConfig gameLogic (msecT 20)
return ()
initializeCam hg3d = do
let (pos', ori') = (Vec3 1 1 (-30.0), unitU)
let (pos, ori) = cam_pos_1
-- create minimum elements, like a camera and a light
eCam <- newE hg3d [
ctCamera #: FullViewCamera,
ctPosition #: pos,
ctOrientation #: ori
]
l1 <- newE hg3d [
ctPosition #: (Vec3 (-20.0) 5.0 (-30.0)),
ctLight #: Light PointLight 1.0 70.0 1.0,
ctOrientation #: unitU
]
l2 <- newE hg3d [
ctLight #: Light (SpotLight (Deg 70) 1.0) 1.0 200.0 1.0,
ctPosition #: Vec3 (10) (10) (-10.0)
]
l3 <- newE hg3d [
ctLight #: Light (SpotLight (Deg 70) 1.0) 1.0 200.0 1.0,
ctPosition #: Vec3 (-10) (10) (-10.0)
]
return eCam