]> git.jsancho.org Git - guile-irrlicht.git/blobdiff - src/IGUIEnvironment.cpp
Use macros for declaring wrapped types
[guile-irrlicht.git] / src / IGUIEnvironment.cpp
index 0f66f7210b7017803ad4c28ed40584aebc13f3ff..c0a2a06a5ccd5f55ce96c5a1fa9cb7b1be6bbdf9 100644 (file)
@@ -22,6 +22,7 @@
 #include <irrlicht/irrlicht.h>
 #include <libguile.h>
 #include "IGUIEnvironment.h"
+#include "util.h"
 
 extern "C" {
 
@@ -31,33 +32,8 @@ extern "C" {
     init_gui_environment_type ();
   }
 
-  static SCM gui_environment_type;
-
-  void
-  init_gui_environment_type (void)
-  {
-    SCM name, slots;
-    scm_t_struct_finalize finalizer;
-
-    name = scm_from_utf8_symbol ("gui_environment");
-    slots = scm_list_1 (scm_from_utf8_symbol ("data"));
-    finalizer = NULL;
-
-    gui_environment_type =
-      scm_make_foreign_object_type (name, slots, finalizer);
-  }
-
-  SCM
-  wrap_gui_environment (irr::gui::IGUIEnvironment* gui_environment)
-  {
-    return scm_make_foreign_object_1 (gui_environment_type, gui_environment);
-  }
-
-  irr::gui::IGUIEnvironment*
-  unwrap_gui_environment (SCM gui_environment_obj)
-  {
-    scm_assert_foreign_object_type (gui_environment_type, gui_environment_obj);
-    return (irr::gui::IGUIEnvironment*)scm_foreign_object_ref (gui_environment_obj, 0);
-  }
+  DEFINE_WRAPPED_TYPE (irr::gui::IGUIEnvironment*, "gui-environment",
+                       init_gui_environment_type,
+                       wrap_gui_environment, unwrap_gui_environment);
 
 }