-
Notifications
You must be signed in to change notification settings - Fork 0
/
fungentest.hs
51 lines (48 loc) · 2.32 KB
/
fungentest.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
{-
This executable is used by the "make auto" rule, and is a good place for experiments.
It probably needs to be compiled to work.
-}
module Main where
import Control.Monad
import Graphics.UI.Fungen
import Text.Printf
import Graphics.UI.GLUT
main :: IO ()
main = do
funInit
((400,400),(250,250),"Hello, Fungen World!") -- window configuration
(colorMap 0.0 0.0 0.0 250 250) -- game map
[] -- object managers
() -- u
() -- t
[ -- input handlers
-- q, shift-q, control-q etc. must be matched as different characters, at least on the mac:
(Char 'q', Press,
\mods pos -> do liftIOtoIOGame $ putStrLn $ printf "q pressed with mods %s, pos %s" (show mods) (show pos)
),
(Char 'Q', Press,
\mods pos -> do liftIOtoIOGame $ putStrLn $ printf "shift q pressed with mods %s, pos %s" (show mods) (show pos)
),
(Char '\DC1', Press,
\mods pos -> do liftIOtoIOGame $ putStrLn $ printf "control q pressed with mods %s, pos %s" (show mods) (show pos)
),
(MouseButton LeftButton, Press,
\mods pos -> do liftIOtoIOGame $ putStrLn $ printf "left mouse button pressed with mods %s, pos %s" (show mods) (show pos)
),
-- still down handler - mods and pos remain at the initial values
(MouseButton LeftButton, StillDown,
\mods pos -> do liftIOtoIOGame $ putStrLn $ printf "left mouse button still down with mods %s, pos %s" (show mods) (show pos)
),
(MouseButton LeftButton, Release,
\mods pos -> do liftIOtoIOGame $ putStrLn $ printf "left mouse button released with mods %s, pos %s" (show mods) (show pos)
)
,(SpecialKey KeyRight, Press, \_ _ -> liftIOtoIOGame $ putStrLn "RIGHT")
,(SpecialKey KeyRight, StillDown, \_ _ -> liftIOtoIOGame $ putStrLn "RIGHT STILL DOWN")
,(SpecialKey KeyLeft, Press, \_ _ -> liftIOtoIOGame $ putStrLn "LEFT")
,(SpecialKey KeyLeft, StillDown, \_ _ -> liftIOtoIOGame $ putStrLn "LEFT STILL DOWN")
]
(do -- iogame action
return ()
)
Idle -- refresh type
[] -- file picture list