X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fguile-irrlicht.cpp;h=bc76b72078b0a40737e416b6ca44ebe712676e9c;hb=55e6476fba279b10b7732170a72b31426f973ef5;hp=f0ed9c75e74b413bccadbb9de6f41af5b05b7356;hpb=8b5eb514c6fb720fa395ee26fde67b596f47f819;p=guile-irrlicht.git diff --git a/src/guile-irrlicht.cpp b/src/guile-irrlicht.cpp index f0ed9c7..bc76b72 100644 --- a/src/guile-irrlicht.cpp +++ b/src/guile-irrlicht.cpp @@ -31,9 +31,9 @@ #include "file-archive.h" #include "file-system.h" #include "gsubr.h" +#include "gui.h" #include "gui-element.h" #include "gui-environment.h" -#include "gui-static-text.h" #include "guile-irrlicht.h" #include "keymap.h" #include "material.h" @@ -44,6 +44,7 @@ #include "scene-node.h" #include "scene-node-animator.h" #include "texture.h" +#include "timer.h" #include "vertex3d.h" #include "video-driver.h" #include "wchar.h" @@ -63,9 +64,7 @@ extern "C" { init_event_receiver (); init_file_archive (); init_file_system (); - init_gui_element (); - init_gui_environment (); - init_gui_static_text (); + init_gui (); init_keymap (); init_material (); init_mesh (); @@ -75,11 +74,13 @@ extern "C" { init_scene_node (); init_scene_node_animator (); init_texture (); + init_timer (); init_vertex3d (); init_video_driver (); // Shared procedures (used by two or more objects) DEFINE_GSUBR ("draw-all", 1, 0, 0, irr_drawAll); + DEFINE_GSUBR ("get-position", 1, 1, 0, irr_getPosition); DEFINE_GSUBR ("get-name", 1, 0, 0, irr_getName); DEFINE_GSUBR ("set-material!", 2, 0, 0, irr_setMaterial); DEFINE_GSUBR ("set-material-flag!", 3, 0, 0, irr_setMaterialFlag); @@ -120,6 +121,25 @@ extern "C" { } } + SCM + irr_getPosition (SCM wrapped_obj, + SCM i) + { + if (cursor_control_p (wrapped_obj)) + { + return irr_gui_getPosition (wrapped_obj); + } + else if (is_scene_node_object (wrapped_obj)) + { + return irr_scene_getPosition (wrapped_obj); + } + else + { + scm_error (scm_arg_type_key, NULL, "Cannot get position from object: ~S", + scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj)); + } + } + SCM irr_setMaterial (SCM wrapped_obj, SCM material) @@ -140,9 +160,7 @@ extern "C" { SCM flag, SCM newvalue) { - if (animated_mesh_scene_node_p (wrapped_obj) || - mesh_scene_node_p (wrapped_obj) || - scene_node_p (wrapped_obj)) + if (is_scene_node_object (wrapped_obj)) { return irr_scene_ISceneNode_setMaterialFlag (wrapped_obj, flag, newvalue); } @@ -161,7 +179,7 @@ extern "C" { { return irr_gui_setPosition (wrapped_obj, position); } - else if (scene_node_p (wrapped_obj) || mesh_scene_node_p (wrapped_obj)) + else if (is_scene_node_object (wrapped_obj)) { return irr_scene_setPosition (wrapped_obj, position); } @@ -176,17 +194,19 @@ extern "C" { irr_setVisible (SCM wrapped_obj, SCM visible) { +#define SET_VISIBLE(OBJ) OBJ->setVisible (scm_to_bool (visible)); + if (cursor_control_p (wrapped_obj)) { - unwrap_cursor_control (wrapped_obj)->setVisible (scm_to_bool (visible)); + SET_VISIBLE (unwrap_cursor_control (wrapped_obj)); } else if (gui_element_p (wrapped_obj)) { - unwrap_gui_element (wrapped_obj)->setVisible (scm_to_bool (visible)); + SET_VISIBLE (unwrap_gui_element (wrapped_obj)); } - else if (scene_node_p (wrapped_obj)) + else if (is_scene_node_object (wrapped_obj)) { - unwrap_scene_node (wrapped_obj)->setVisible (scm_to_bool (visible)); + SET_VISIBLE (unwrap_scene_node (wrapped_obj)); } else {