src/animated-mesh-scene-node.cpp \
src/camera-scene-node.cpp \
src/color.cpp \
+ src/cursor-control.cpp \
src/device.cpp \
src/dimension2d.cpp \
src/driver-types.cpp \
src/mesh.cpp \
src/mesh-scene-node.cpp \
src/misc.cpp \
+ src/position2d.cpp \
src/rect.cpp \
src/reference-counted.cpp \
src/scene-manager.cpp \
--- /dev/null
+/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
+
+ Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
+
+ This file is part of guile-irrlicht.
+
+ guile-irrlicht is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ guile-irrlicht is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with guile-irrlicht. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#include <irrlicht/irrlicht.h>
+#include <libguile.h>
+#include "cursor-control.h"
+#include "position2d.h"
+#include "wrapped.h"
+
+extern "C" {
+
+ void
+ init_cursor_control (void)
+ {
+ init_cursor_control_type ();
+ }
+
+ DEFINE_WRAPPED_TYPE (irr::gui::ICursorControl*, "cursor-control",
+ init_cursor_control_type, cursor_control_p,
+ wrap_cursor_control, unwrap_cursor_control);
+
+ SCM
+ irr_gui_setPosition (SCM wrapped_cursor_control,
+ SCM position)
+ {
+ irr::gui::ICursorControl* control = unwrap_cursor_control (wrapped_cursor_control);
+ if (scm_is_integer (scm_car (position)) && scm_is_integer (scm_cadr (position)))
+ {
+ control->setPosition (scm_to_position2d_s32 (position));
+ }
+ else
+ {
+ control->setPosition (scm_to_position2d_f32 (position));
+ }
+ return SCM_UNSPECIFIED;
+ }
+
+}
--- /dev/null
+/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
+
+ Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
+
+ This file is part of guile-irrlicht.
+
+ guile-irrlicht is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ guile-irrlicht is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with guile-irrlicht. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __GUILE_IRRLICHT_CURSOR_CONTROL_H_INCLUDED__
+#define __GUILE_IRRLICHT_CURSOR_CONTROL_H_INCLUDED__
+
+#include <irrlicht/irrlicht.h>
+#include <libguile.h>
+#include "wrapped.h"
+
+extern "C" {
+
+ void
+ init_cursor_control (void);
+
+ DECLARE_WRAPPED_TYPE (irr::gui::ICursorControl*, init_cursor_control_type,
+ cursor_control_p, wrap_cursor_control, unwrap_cursor_control);
+
+ SCM
+ irr_gui_setPosition (SCM wrapped_cursor_control,
+ SCM position);
+
+}
+
+#endif
#include "animated-mesh.h"
#include "animated-mesh-scene-node.h"
#include "camera-scene-node.h"
+#include "cursor-control.h"
#include "device.h"
#include "file-archive.h"
#include "file-system.h"
init_animated_mesh ();
init_animated_mesh_scene_node ();
init_camera_scene_node ();
+ init_cursor_control ();
init_device ();
init_file_archive ();
init_file_system ();
#include <irrlicht/irrlicht.h>
#include <libguile.h>
+
+#include "cursor-control.h"
+#include "mesh-scene-node.h"
#include "misc.h"
+#include "scene-node.h"
#include "video-driver.h"
#include "wchar.h"
init_misc (void)
{
scm_c_define_gsubr ("get-name", 1, 0, 0, (scm_t_subr)irr_getName);
- scm_c_export ("get-name", NULL);
+ scm_c_define_gsubr ("set-position!", 2, 0, 0, (scm_t_subr)irr_setPosition);
+ scm_c_export ("get-name", "set-position!", NULL);
}
SCM
}
}
+ SCM
+ irr_setPosition (SCM wrapped_obj,
+ SCM position)
+ {
+ if (cursor_control_p (wrapped_obj))
+ {
+ return irr_gui_setPosition (wrapped_obj, position);
+ }
+ else if (scene_node_p (wrapped_obj) || mesh_scene_node_p (wrapped_obj))
+ {
+ return irr_scene_setPosition (wrapped_obj, position);
+ }
+ else
+ {
+ scm_error (scm_arg_type_key, NULL, "Cannot set position for object: ~S",
+ scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj));
+ }
+ }
+
}
SCM
irr_getName (SCM wrapped_obj);
+ SCM
+ irr_setPosition (SCM wrapped_obj,
+ SCM position);
+
}
#endif
--- /dev/null
+/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
+
+ Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
+
+ This file is part of guile-irrlicht.
+
+ guile-irrlicht is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ guile-irrlicht is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with guile-irrlicht. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#include <irrlicht/irrlicht.h>
+#include <libguile.h>
+#include "position2d.h"
+
+extern "C" {
+
+ irr::core::position2d<irr::f32>
+ scm_to_position2d_f32 (SCM position2d)
+ {
+ return irr::core::position2d<irr::f32>
+ (scm_to_double (scm_car (position2d)),
+ scm_to_double (scm_cadr (position2d)));
+ }
+
+ irr::core::position2d<irr::s32>
+ scm_to_position2d_s32 (SCM position2d)
+ {
+ return irr::core::position2d<irr::s32>
+ (scm_to_int32 (scm_car (position2d)),
+ scm_to_int32 (scm_cadr (position2d)));
+ }
+
+}
--- /dev/null
+/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
+
+ Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
+
+ This file is part of guile-irrlicht.
+
+ guile-irrlicht is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ guile-irrlicht is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with guile-irrlicht. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __GUILE_IRRLICHT_POSITION_2D_H_INCLUDED__
+#define __GUILE_IRRLICHT_POSITION_2D_H_INCLUDED__
+
+#include <irrlicht/irrlicht.h>
+#include <libguile.h>
+
+extern "C" {
+
+ irr::core::position2d<irr::f32>
+ scm_to_position2d_f32 (SCM position2d);
+
+ irr::core::position2d<irr::s32>
+ scm_to_position2d_s32 (SCM position2d);
+
+}
+
+#endif
#include <irrlicht/irrlicht.h>
#include <libguile.h>
+
#include "animated-mesh-scene-node.h"
+#include "mesh-scene-node.h"
#include "scene-node.h"
#include "texture.h"
+#include "vector3d.h"
#include "wrapped.h"
extern "C" {
return SCM_UNSPECIFIED;
}
+ SCM
+ irr_scene_setPosition (SCM wrapped_scene_node,
+ SCM position)
+ {
+ if (scene_node_p (wrapped_scene_node))
+ {
+ unwrap_scene_node (wrapped_scene_node)->
+ setPosition (scm_to_vector3df (position));
+ }
+ else if (mesh_scene_node_p (wrapped_scene_node))
+ {
+ unwrap_mesh_scene_node (wrapped_scene_node)->
+ setPosition (scm_to_vector3df (position));
+ }
+ else
+ {
+ scm_error (scm_arg_type_key, NULL, "Cannot set position to object: ~S",
+ scm_list_1 (wrapped_scene_node), scm_list_1 (wrapped_scene_node));
+ }
+ return SCM_UNSPECIFIED;
+ }
+
}
SCM texture_layer,
SCM texture);
+ SCM
+ irr_scene_setPosition (SCM wrapped_scene_node,
+ SCM position);
+
}
#endif