return wrap_cursor_control (cursor_control);
}
+ SCM
+ irr_gui_getPosition (SCM wrapped_cursor_control)
+ {
+ irr::gui::ICursorControl* control = unwrap_cursor_control (wrapped_cursor_control);
+ return scm_from_position2d_s32 (control->getPosition ());
+ }
+
SCM
irr_gui_setPosition (SCM wrapped_cursor_control,
SCM position)
SCM
irr_getCursorControl (SCM wrapped_device);
+ SCM
+ irr_gui_getPosition (SCM wrapped_cursor_control);
+
SCM
irr_gui_setPosition (SCM wrapped_cursor_control,
SCM position);
// 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);
}
}
+ 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)
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);
}
{
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);
}
{
SET_VISIBLE (unwrap_gui_element (wrapped_obj));
}
- else if (scene_node_p (wrapped_obj))
+ else if (is_scene_node_object (wrapped_obj))
{
SET_VISIBLE (unwrap_scene_node (wrapped_obj));
}
SCM
irr_drawAll (SCM wrapped_obj);
+ SCM
+ irr_getPosition (SCM wrapped_obj,
+ SCM i);
+
SCM
irr_getName (SCM wrapped_obj);
extern "C" {
+ SCM
+ scm_from_position2d_s32 (irr::core::position2d<irr::s32> position2d)
+ {
+ return scm_list_2 (scm_from_int32 (position2d.X),
+ scm_from_int32 (position2d.Y));
+ }
+
irr::core::position2d<irr::f32>
scm_to_position2d_f32 (SCM position2d)
{
extern "C" {
+ SCM
+ scm_from_position2d_s32 (irr::core::position2d<irr::s32> position2d);
+
irr::core::position2d<irr::f32>
scm_to_position2d_f32 (SCM position2d);
init_scene_node_type, scene_node_p,
wrap_scene_node, unwrap_scene_node);
+ bool
+ is_scene_node_object (SCM wrapped_scene_node)
+ {
+ return
+ animated_mesh_scene_node_p (wrapped_scene_node) ||
+ camera_scene_node_p (wrapped_scene_node) ||
+ mesh_scene_node_p (wrapped_scene_node) ||
+ scene_node_p (wrapped_scene_node);
+ }
+
SCM
irr_scene_addAnimator (SCM wrapped_scene_node,
SCM animator)
return scm_from_matrix4 (node->getAbsoluteTransformation ());
}
+ SCM
+ irr_scene_getPosition (SCM wrapped_scene_node)
+ {
+ irr::scene::ISceneNode* node = unwrap_scene_node (wrapped_scene_node, false);
+ return scm_from_vector3df (node->getPosition ());
+ }
+
SCM
irr_scene_ISceneNode_setMaterialFlag (SCM wrapped_scene_node,
SCM flag,
DECLARE_WRAPPED_TYPE (irr::scene::ISceneNode*, init_scene_node_type,
scene_node_p, wrap_scene_node, unwrap_scene_node);
+ bool
+ is_scene_node_object (SCM wrapped_scene_node);
+
SCM
irr_scene_addAnimator (SCM wrapped_scene_node,
SCM animator);
SCM
irr_scene_getAbsoluteTransformation (SCM wrapped_scene_node);
+ SCM
+ irr_scene_getPosition (SCM wrapped_scene_node);
+
SCM
irr_scene_ISceneNode_setMaterialFlag (SCM wrapped_scene_node,
SCM flag,
WRAP (TYPE foreign_obj); \
\
TYPE \
- UNWRAP (SCM wrapped_obj); \
+ UNWRAP (SCM wrapped_obj, bool assert_type = true); \
\
bool \
PRED (SCM wrapped_obj);
} \
\
TYPE \
- UNWRAP (SCM wrapped_obj) \
+ UNWRAP (SCM wrapped_obj, bool assert_type) \
{ \
- scm_assert_foreign_object_type (wrapped_##INIT, wrapped_obj); \
+ if (assert_type) \
+ { \
+ scm_assert_foreign_object_type (wrapped_##INIT, wrapped_obj); \
+ } \
return (TYPE)scm_foreign_object_ref (wrapped_obj, 0); \
} \
\