Add SDL_GetTicks binding.
authorDavid Thompson <dthompson2@worcester.edu>
Sat, 12 Dec 2015 07:54:04 +0000 (02:54 -0500)
committerDavid Thompson <dthompson2@worcester.edu>
Sat, 12 Dec 2015 07:54:04 +0000 (02:54 -0500)
* sdl2/bindings.scm (sdl-get-ticks): New procedure.
* sdl2.scm (sdl-ticks): New procedure.

sdl2.scm
sdl2/bindings.scm

index afed5c0..74839fe 100644 (file)
--- a/sdl2.scm
+++ b/sdl2.scm
@@ -32,7 +32,8 @@
             sdl-error
             sdl-version
             sdl-init
-            sdl-quit))
+            sdl-quit
+            sdl-ticks))
 
 (define %default-init-flags
   '(timer audio video haptic game-controller events))
@@ -77,3 +78,8 @@ The possible flags are 'timer', 'audio', 'video', 'haptic',
   "Quit all activated SDL subsystems.  This procedure should be called
 upon all exit conditions."
   (ffi:sdl-quit))
+
+(define (sdl-ticks)
+  "Return the number of milliseconds since the SDL library
+initialization."
+  (ffi:sdl-get-ticks))
index 138d4fc..25b3576 100644 (file)
@@ -192,3 +192,11 @@ RETURN-TYPE and accept arguments of ARG-TYPES."
 
 (define-foreign sdl-gl-swap-window
   void "SDL_GL_SwapWindow" '(*))
+
+\f
+;;;
+;;; Timer
+;;;
+
+(define-foreign sdl-get-ticks
+  uint32 "SDL_GetTicks" '())