0 | {- Tian Z (ecburx@burx.vip) -}
 1 |
 2 | module IdrisGL.SDL.SDL_timer
 3 |
 4 | {- 
 5 |     FFI 
 6 | -}
 7 |
 8 | frgn : String -> String
 9 | frgn func = "C:" ++ func ++ ",sdl_timer"
10 |
11 | --
12 |
13 | %foreign frgn "delayWin"
14 | prim_delayWin : Int -> PrimIO ()
15 |
16 | ||| Wait a specified number of milliseconds before returning.
17 | export
18 | delayWin : HasIO io => Int -> io ()
19 | delayWin ms = primIO $ prim_delayWin ms
20 |
21 | -- Get the number of milliseconds since the SDL library initialization.
22 | -- WARNING: Int overflow
23 |
24 | %foreign frgn "getTicks"
25 | prim_getTicks : Int
26 |
27 | ||| Get the number of milliseconds since SDL library initialization.
28 | export
29 | getTicks : HasIO io => io Int
30 | getTicks = pure prim_getTicks
31 |
32 | -- Get the number of seconds since the SDL library initialization.
33 | -- Relatively safe.
34 |
35 | %foreign frgn "getSecondsTicks"
36 | prim_getSecondsTicks : PrimIO Double
37 |
38 | ||| Get the number of seconds since SDL library initialization.
39 | export
40 | getSecondsTicks : HasIO io => io Double
41 | getSecondsTicks = primIO prim_getSecondsTicks