-
Notifications
You must be signed in to change notification settings - Fork 6
/
Main.hs
44 lines (40 loc) · 1.74 KB
/
Main.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
module Main where
import Control.Applicative
import Control.Monad.Error
import Control.Monad.Reader
import Data.IORef
import qualified Data.HashMap.Strict as HashMap
import qualified Data.Vector.Mutable as Vector
import Graphics.Rendering.OpenGL
import HCraft.Craft
import HCraft.Math
import HCraft.Engine
main :: IO ()
main = do
state <- EngineState <$> newIORef True
<*> newIORef (Size 800 600)
<*> newIORef HashMap.empty
<*> newIORef HashMap.empty
<*> newIORef HashMap.empty
<*> newIORef Nothing
<*> newIORef Nothing
<*> newIORef Nothing
<*> newIORef Nothing
<*> newIORef Camera{ cPosition = Vec3 (-10.0) 0.0 0.0
, cRotation = Vec3 0.0 0.0 0.0
, cDirection = Vec3 0.0 0.0 1.0
, cProjMat = mident
, cViewMat = mident
, cSkyMat = mident
, cAspect = 0.0
, cFOV = 45.0
, cNearPlane = 0.1
, cFarPlane = 1000.0
}
<*> newIORef HashMap.empty
<*> newIORef Nothing
<*> newIORef 0
status <- runReaderT (runErrorT . run $ engine) state
case status of
Right _ -> return ()
Left err -> putStrLn err