irrlicht.scm \
irrlicht/base.scm \
irrlicht/foreign.scm \
+ irrlicht/gui.scm \
irrlicht/irr.scm \
+ irrlicht/scene.scm \
irrlicht/video.scm
(define-module (irrlicht)
#:use-module (irrlicht irr)
#:re-export (create-device
+ get-gui-environment
+ get-scene-manager
get-video-driver
set-window-caption!))
--- /dev/null
+;;; guile-irrlicht --- FFI 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/>.
+
+
+(define-module (irrlicht gui)
+ #:use-module (oop goops)
+ #:use-module (irrlicht base)
+ #:use-module (irrlicht foreign))
+
+
+;; IVideoDriver
+(define-class <gui-environment> (<irrlicht-base>))
+
+(export <gui-environment>)
#:use-module (oop goops)
#:use-module (irrlicht base)
#:use-module (irrlicht foreign)
+ #:use-module (irrlicht gui)
+ #:use-module (irrlicht scene)
#:use-module (irrlicht video))
vsync
(irr-pointer receiver))))
+(define-method (get-gui-environment (device <irrlicht-device>))
+ (make <gui-environment>
+ #:irr-pointer (irr_IrrlichtDevice_getGUIEnvironment (irr-pointer device))))
+
+(define-method (get-scene-manager (device <irrlicht-device>))
+ (make <scene-manager>
+ #:irr-pointer (irr_IrrlichtDevice_getSceneManager (irr-pointer device))))
+
(define-method (get-video-driver (device <irrlicht-device>))
- (make <video-driver> #:irr-pointer (irr_IrrlichtDevice_getVideoDriver (irr-pointer device))))
+ (make <video-driver>
+ #:irr-pointer (irr_IrrlichtDevice_getVideoDriver (irr-pointer device))))
(define-method (set-window-caption! (device <irrlicht-device>) text)
(irr_IrrlichtDevice_setWindowCaption (irr-pointer device) text))
-(export create-device get-video-driver set-window-caption!)
+(export create-device get-gui-environment get-scene-manager get-video-driver set-window-caption!)
--- /dev/null
+;;; guile-irrlicht --- FFI 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/>.
+
+
+(define-module (irrlicht scene)
+ #:use-module (oop goops)
+ #:use-module (irrlicht base)
+ #:use-module (irrlicht foreign))
+
+
+;; IVideoDriver
+(define-class <scene-manager> (<irrlicht-base>))
+
+(export <scene-manager>)
{
init_device_type ();
DEFINE_GSUBR ("irr_createDevice", 7, 0, 0, irr_createDevice);
+ DEFINE_GSUBR ("irr_IrrlichtDevice_getGUIEnvironment", 1, 0, 0,
+ irr_IrrlichtDevice_getGUIEnvironment);
+ DEFINE_GSUBR ("irr_IrrlichtDevice_getSceneManager", 1, 0, 0,
+ irr_IrrlichtDevice_getSceneManager);
DEFINE_GSUBR ("irr_IrrlichtDevice_getVideoDriver", 1, 0, 0,
irr_IrrlichtDevice_getVideoDriver);
DEFINE_GSUBR ("irr_IrrlichtDevice_setWindowCaption", 2, 0, 0,
return scm_from_pointer ((void*)device, NULL);
}
+ SCM
+ irr_IrrlichtDevice_getGUIEnvironment (SCM device){
+ gui::IGUIEnvironment* gui_env =
+ ((IrrlichtDevice*)scm_to_pointer (device))->getGUIEnvironment ();
+ return scm_from_pointer ((void*)gui_env, NULL);
+ }
+
+ SCM
+ irr_IrrlichtDevice_getSceneManager (SCM device)
+ {
+ scene::ISceneManager* manager =
+ ((IrrlichtDevice*)scm_to_pointer (device))->getSceneManager ();
+ return scm_from_pointer ((void*)manager, NULL);
+ }
+
SCM
irr_IrrlichtDevice_getVideoDriver (SCM device)
{
SCM vsync,
SCM receiver);
+ SCM
+ irr_IrrlichtDevice_getGUIEnvironment (SCM device);
+
+ SCM
+ irr_IrrlichtDevice_getSceneManager (SCM device);
+
SCM
irr_IrrlichtDevice_getVideoDriver (SCM device);
DEFINE_GSUBR ("add-static-text!", 3, 0, 1, irr_gui_addStaticText);
DEFINE_GSUBR ("add-window!", 2, 0, 1, irr_gui_addWindow);
DEFINE_GSUBR ("get-built-in-font", 1, 0, 0, irr_gui_getBuiltInFont);
- DEFINE_GSUBR ("get-gui-environment", 1, 0, 0, irr_getGUIEnvironment);
DEFINE_GSUBR ("get-skin", 1, 0, 0, irr_gui_getSkin);
}
init_gui_environment_type, gui_environment_p,
wrap_gui_environment, unwrap_gui_environment);
- SCM
- irr_getGUIEnvironment (SCM wrapped_obj)
- {
- irr::gui::IGUIEnvironment* gui_environment;
- if (device_p (wrapped_obj))
- {
- gui_environment = unwrap_device (wrapped_obj)->getGUIEnvironment ();
- }
- else
- {
- scm_error (scm_arg_type_key, NULL, "Cannot get GUI environment from object: ~S",
- scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj));
- }
- return wrap_gui_environment (gui_environment);
- }
-
SCM
irr_gui_addImage (SCM wrapped_gui_environment,
SCM image,
DECLARE_WRAPPED_TYPE (irr::gui::IGUIEnvironment*, init_gui_environment_type,
gui_environment_p, wrap_gui_environment, unwrap_gui_environment);
- SCM
- irr_getGUIEnvironment (SCM wrapped_obj);
-
SCM
irr_gui_addImage (SCM wrapped_gui_environment,
SCM image,
DEFINE_GSUBR ("create-rotation-animator", 2, 0, 0, irr_scene_createRotationAnimator);
DEFINE_GSUBR ("get-mesh", 2, 0, 0, irr_scene_getMesh);
DEFINE_GSUBR ("get-root-scene-node", 1, 0, 0, irr_scene_getRootSceneNode);
- DEFINE_GSUBR ("get-scene-manager", 1, 0, 0, irr_getSceneManager);
}
DEFINE_WRAPPED_TYPE (irr::scene::ISceneManager*, "scene-manager",
return wrap_scene_node (smgr->getRootSceneNode ());
}
- SCM
- irr_getSceneManager (SCM wrapped_obj)
- {
- irr::scene::ISceneManager* scene_manager;
- if (device_p (wrapped_obj))
- {
- scene_manager = unwrap_device (wrapped_obj)->getSceneManager ();
- }
- else
- {
- scm_error (scm_arg_type_key, NULL, "Cannot get scene manager from object: ~S",
- scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj));
- }
- return wrap_scene_manager (scene_manager);
- }
-
}
SCM
irr_scene_getRootSceneNode (SCM wrapped_scene_manager);
- SCM
- irr_getSceneManager (SCM wrapped_obj);
-
}
#endif