1 {-# LANGUAGE ForeignFunctionInterface #-}
10 foreign import ccall
"qpawn.c init"
13 foreign import ccall
"qpawn.c quit"
16 foreign import ccall
"qpawn.c clear"
19 foreign import ccall
"qpawn.c draw"
22 foreign import ccall
"qpawn.c pixel"
23 c_pixel
:: CInt
-> CInt
-> IO ()
25 foreign import ccall
"qpawn.c color"
26 c_color
:: CInt
-> CInt
-> CInt
-> IO ()
28 foreign import ccall
"qpawn.c sleep"
29 c_sleep
:: CInt
-> IO ()
33 -- hide this one from module?
34 cint
:: (Integral a
) => a
-> CInt
35 cint n
= (fromIntegral n
) :: CInt
37 color
:: Int -> Int -> Int -> IO ()
38 color r g b
= c_color r
' g
' b
'
39 where (r
', g
', b
') = (cint r
, cint g
, cint b
)
41 pixel
:: Int32
-> Int32
-> IO ()
42 pixel x y
= c_pixel x
' y
'
43 where (x
', y
') = (cint x
, cint y
)
49 sleep
= c_sleep
. cint