]> git.jsancho.org Git - guile-irrlicht.git/blobdiff - src/device.cpp
get-timer get-time
[guile-irrlicht.git] / src / device.cpp
index 0a4d2c686560e1814719291e6246701aec0fbd44..96442c7e3797300654efd3964cb0901c94b3bdd8 100644 (file)
@@ -26,6 +26,8 @@
 #include "dimension2d.h"
 #include "driver-types.h"
 #include "event-receiver.h"
+#include "gsubr.h"
+#include "timer.h"
 #include "wchar.h"
 #include "wrapped.h"
 
@@ -35,13 +37,12 @@ extern "C" {
   init_device (void)
   {
     init_device_type ();
-    scm_c_define_gsubr ("create-device", 0, 0, 1, (scm_t_subr)irr_createDevice);
-    scm_c_define_gsubr ("is-window-active?", 1, 0, 0, (scm_t_subr)irr_isWindowActive);
-    scm_c_define_gsubr ("run", 1, 0, 0, (scm_t_subr)irr_run);
-    scm_c_define_gsubr ("set-window-caption!", 2, 0, 0, (scm_t_subr)irr_setWindowCaption);
-    scm_c_define_gsubr ("yield", 1, 0, 0, (scm_t_subr)irr_yield);
-    scm_c_export ("create-device", "is-window-active?", "run",
-                  "set-window-caption!", "yield", NULL);
+    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);
+    DEFINE_GSUBR ("yield", 1, 0, 0, irr_yield);
   }
 
   DEFINE_WRAPPED_TYPE (irr::IrrlichtDevice*, "device",
@@ -55,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,
@@ -81,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)
   {