;; FPS camera
(add-camera-scene-node-fps! scene-manager)
-(set-visible-cursor! (get-cursor-control device) #f)
+(set-visible! (get-cursor-control device) #f)
;; loop
(define last-fps -1)
-(while (device-run? device)
+(while (run device)
(cond ((is-window-active? device)
(begin-scene driver #:color '(255 200 200 200))
- (scene-draw-all scene-manager)
+ (draw-all scene-manager)
(end-scene driver)
(let ((fps (get-fps driver)))
(yield device))))
;; delete device
-(device-drop! device)
+(drop! device)
(exit #t)
#include <irrlicht/irrlicht.h>
#include <libguile.h>
+
#include "cursor-control.h"
+#include "device.h"
#include "position2d.h"
#include "wrapped.h"
init_cursor_control (void)
{
init_cursor_control_type ();
+ scm_c_define_gsubr ("get-cursor-control", 1, 0, 0, (scm_t_subr)irr_getCursorControl);
+ scm_c_export ("get-cursor-control", NULL);
}
DEFINE_WRAPPED_TYPE (irr::gui::ICursorControl*, "cursor-control",
init_cursor_control_type, cursor_control_p,
wrap_cursor_control, unwrap_cursor_control);
+ SCM
+ irr_getCursorControl (SCM wrapped_device)
+ {
+ irr::gui::ICursorControl* cursor_control =
+ unwrap_device (wrapped_device)->getCursorControl ();
+ return wrap_cursor_control (cursor_control);
+ }
+
SCM
irr_gui_setPosition (SCM wrapped_cursor_control,
SCM position)
DECLARE_WRAPPED_TYPE (irr::gui::ICursorControl*, init_cursor_control_type,
cursor_control_p, wrap_cursor_control, unwrap_cursor_control);
+ SCM
+ irr_getCursorControl (SCM wrapped_device);
+
SCM
irr_gui_setPosition (SCM wrapped_cursor_control,
SCM position);
#include <libguile.h>
#include "cursor-control.h"
+#include "gui-element.h"
#include "mesh-scene-node.h"
#include "misc.h"
#include "scene-node.h"
{
scm_c_define_gsubr ("get-name", 1, 0, 0, (scm_t_subr)irr_getName);
scm_c_define_gsubr ("set-position!", 2, 0, 0, (scm_t_subr)irr_setPosition);
- scm_c_export ("get-name", "set-position!", NULL);
+ scm_c_define_gsubr ("set-visible!", 2, 0, 0, (scm_t_subr)irr_setVisible);
+ scm_c_export ("get-name", "set-position!", "set-visible!", NULL);
}
SCM
}
}
+ SCM
+ irr_setVisible (SCM wrapped_obj,
+ SCM visible)
+ {
+ if (cursor_control_p (wrapped_obj))
+ {
+ unwrap_cursor_control (wrapped_obj)->setVisible (scm_to_bool (visible));
+ }
+ else if (gui_element_p (wrapped_obj))
+ {
+ unwrap_gui_element (wrapped_obj)->setVisible (scm_to_bool (visible));
+ }
+ else if (scene_node_p (wrapped_obj))
+ {
+ unwrap_scene_node (wrapped_obj)->setVisible (scm_to_bool (visible));
+ }
+ else
+ {
+ scm_error (scm_arg_type_key, NULL, "Cannot set visibility for object: ~S",
+ scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj));
+ }
+ return SCM_UNSPECIFIED;
+ }
+
}
irr_setPosition (SCM wrapped_obj,
SCM position);
+ SCM
+ irr_setVisible (SCM wrapped_obj,
+ SCM visible);
+
}
#endif