]> git.jsancho.org Git - guile-irrlicht.git/blobdiff - src/device.cpp
get-timer get-time
[guile-irrlicht.git] / src / device.cpp
index b60ec44e4681b3e4f0572833a402f904dc9fe62b..96442c7e3797300654efd3964cb0901c94b3bdd8 100644 (file)
@@ -27,6 +27,7 @@
 #include "driver-types.h"
 #include "event-receiver.h"
 #include "gsubr.h"
+#include "timer.h"
 #include "wchar.h"
 #include "wrapped.h"
 
@@ -37,6 +38,7 @@ extern "C" {
   {
     init_device_type ();
     DEFINE_GSUBR ("create-device", 0, 0, 1, irr_createDevice);
+    DEFINE_GSUBR ("get-timer", 1, 0, 0, irr_getTimer);
     DEFINE_GSUBR ("is-window-active?", 1, 0, 0, irr_isWindowActive);
     DEFINE_GSUBR ("run", 1, 0, 0, irr_run);
     DEFINE_GSUBR ("set-window-caption!", 2, 0, 0, irr_setWindowCaption);
@@ -54,10 +56,10 @@ extern "C" {
     SCM window_size = scm_list_2 (scm_from_uint32 (640),
                                   scm_from_uint32 (480));
     SCM bits = scm_from_uint32 (16);
-    SCM fullscreen = scm_from_bool (0);
-    SCM stencilbuffer = scm_from_bool (0);
-    SCM vsync = scm_from_bool (0);
-    SCM receiver = scm_from_bool (0);
+    SCM fullscreen = SCM_BOOL_F;
+    SCM stencilbuffer = SCM_BOOL_F;
+    SCM vsync = SCM_BOOL_F;
+    SCM receiver = SCM_BOOL_F;
 
     scm_c_bind_keyword_arguments ("create-device", rest, (scm_t_keyword_arguments_flags)0,
                                   scm_from_utf8_keyword ("device-type"), &device_type,
@@ -80,6 +82,13 @@ extern "C" {
     return wrap_device (device);
   }
 
+  SCM
+  irr_getTimer (SCM wrapped_device)
+  {
+    irr::IrrlichtDevice* device = unwrap_device (wrapped_device);
+    return wrap_timer (device->getTimer ());
+  }
+
   SCM
   irr_isWindowActive (SCM wrapped_device)
   {