]> git.jsancho.org Git - guile-irrlicht.git/blobdiff - src/video-driver.cpp
begin-scene
[guile-irrlicht.git] / src / video-driver.cpp
index 632f0dec46a8170ec7e4a56fcfc8dadefd157139..dc9cce60da4a42012f2e91fd31ff4912e8f2f732 100644 (file)
@@ -22,7 +22,9 @@
 #include <irrlicht/irrlicht.h>
 #include <libguile.h>
 
+#include "color.h"
 #include "device.h"
+#include "rect.h"
 #include "texture.h"
 #include "video-driver.h"
 #include "wrapped.h"
@@ -33,6 +35,7 @@ extern "C" {
   init_video_driver (void)
   {
     init_video_driver_type ();
+    scm_c_define_gsubr ("begin-scene", 6, 0, 0, (scm_t_subr)irr_video_beginScene);
     scm_c_define_gsubr ("get-texture", 2, 0, 0, (scm_t_subr)irr_video_getTexture);
     scm_c_define_gsubr ("get-video-driver", 1, 0, 0, (scm_t_subr)irr_getVideoDriver);
   }
@@ -41,6 +44,28 @@ extern "C" {
                        init_video_driver_type, video_driver_p,
                        wrap_video_driver, unwrap_video_driver);
 
+  SCM
+  irr_video_beginScene (SCM wrapped_video_driver,
+                        SCM back_buffer,
+                        SCM z_buffer,
+                        SCM color,
+                        SCM video_data,
+                        SCM source_rect)
+  {
+    irr::video::IVideoDriver* driver = unwrap_video_driver (wrapped_video_driver);
+    irr::core::rect<irr::s32>* sourceRectAddress = 0;
+    if (!scm_is_false (source_rect))
+      {
+        irr::core::rect<irr::s32> sourceRect = scm_to_rect_s32 (source_rect);
+        sourceRectAddress = &sourceRect;
+      }
+    return scm_from_bool (driver->beginScene (scm_to_bool (back_buffer),
+                                              scm_to_bool (z_buffer),
+                                              scm_to_color (color),
+                                              irr::video::SExposedVideoData (),
+                                              sourceRectAddress));
+  }
+
   SCM
   irr_video_getTexture (SCM wrapped_video_driver,
                         SCM filename)