]> git.jsancho.org Git - guile-irrlicht.git/blobdiff - src/misc.cpp
get-fps
[guile-irrlicht.git] / src / misc.cpp
index bd3e037bb0ad43be3ee3f1e95d8972177d4111e4..1c01d2cebc3e17d68601a78fc470ce943f6290db 100644 (file)
 
 #include "cursor-control.h"
 #include "gui-element.h"
+#include "gui-environment.h"
 #include "mesh-scene-node.h"
 #include "misc.h"
+#include "scene-manager.h"
 #include "scene-node.h"
 #include "video-driver.h"
 #include "wchar.h"
@@ -35,10 +37,30 @@ extern "C" {
   void
   init_misc (void)
   {
+    scm_c_define_gsubr ("draw-all", 1, 0, 0, (scm_t_subr)irr_drawAll);
     scm_c_define_gsubr ("get-name", 1, 0, 0, (scm_t_subr)irr_getName);
     scm_c_define_gsubr ("set-position!", 2, 0, 0, (scm_t_subr)irr_setPosition);
     scm_c_define_gsubr ("set-visible!", 2, 0, 0, (scm_t_subr)irr_setVisible);
-    scm_c_export ("get-name", "set-position!", "set-visible!", NULL);
+    scm_c_export ("draw-all", "get-name", "set-position!", "set-visible!", NULL);
+  }
+
+  SCM
+  irr_drawAll (SCM wrapped_obj)
+  {
+    if (gui_environment_p (wrapped_obj))
+      {
+        unwrap_gui_environment (wrapped_obj)->drawAll ();
+      }
+    else if (scene_manager_p (wrapped_obj))
+      {
+        unwrap_scene_manager (wrapped_obj)->drawAll ();
+      }
+    else
+      {
+        scm_error (scm_arg_type_key, NULL, "Cannot draw all elements from object: ~S",
+                   scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj));
+      }
+    return SCM_UNSPECIFIED;
   }
 
   SCM